Skip to content

Commit 230af49

Browse files
authored
[feat]: add hash for metric name (#9)
1 parent acd4648 commit 230af49

File tree

15 files changed

+518
-521
lines changed

15 files changed

+518
-521
lines changed

.github/workflows/lindb-common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
- name: Setup Go
1313
uses: actions/setup-go@v3
1414
with:
15-
go-version: 1.19
16-
cache: true
15+
go-version: 1.22
16+
cache: true
1717
id: go
1818
- name: Test
1919
run: make test

.golangci.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,42 @@ linters-settings:
44
# Default: 30 (but we recommend 10-20)
55
min-complexity: 50
66
depguard:
7-
list-type: blacklist
8-
packages:
9-
# logging is allowed only by logutils.Log, logrus
10-
# is allowed to use only in logutils package
11-
- github.com/sirupsen/logrus
12-
packages-with-error-message:
13-
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
7+
# Rules to apply.
8+
#
9+
# Variables:
10+
# - File Variables
11+
# you can still use and exclamation mark ! in front of a variable to say not to use it.
12+
# Example !$test will match any file that is not a go test file.
13+
#
14+
# `$all` - matches all go files
15+
# `$test` - matches all go test files
16+
#
17+
# - Package Variables
18+
#
19+
# `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
20+
#
21+
# Default: Only allow $gostd in all files.
22+
rules:
23+
# Name of a rule.
24+
main:
25+
# Used to determine the package matching priority.
26+
# There are three different modes: `original`, `strict`, and `lax`.
27+
# Default: "original"
28+
list-mode: lax
29+
# List of file globs that will match this list of settings to compare against.
30+
# Default: $all
31+
files:
32+
- "!**/*_a _file.go"
33+
# List of allowed packages.
34+
allow:
35+
- $gostd
36+
# Packages that are not allowed where the value is a suggestion.
37+
deny:
38+
- pkg: "github.com/sirupsen/logrus"
39+
desc: not allowed
40+
- pkg: "github.com/pkg/errors"
41+
desc: Should be replaced by standard lib errors package
42+
1443
dupl:
1544
threshold: 100
1645
funlen:
@@ -36,7 +65,7 @@ linters-settings:
3665
local-prefixes: github.com/lindb/lindb
3766

3867
govet:
39-
check-shadowing: true
68+
shadow: true
4069
settings:
4170
printf:
4271
funcs:
@@ -172,8 +201,6 @@ issues:
172201

173202
run:
174203
timeout: 5m
175-
skip-dirs:
176-
- test/testdata_etc
177204
# timeout for analysis, e.g. 30s, 5m, default is 1m
178205
deadline: 10m
179206
# list of build tags, all linters use it. Default is empty list.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ header: ## check and add license header.
1717
lint: ## run lint
1818
ifeq (, $(shell which golangci-lint))
1919
# binary will be $(go env GOPATH)/bin/golangci-lint
20-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.51.2
20+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.57.2
2121
else
2222
echo "Found golangci-lint"
2323
endif

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/lindb/common
22

3-
go 1.19
3+
go 1.22
44

55
require (
66
github.com/BurntSushi/toml v1.2.1

models/result_set.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ import (
2929

3030
// ResultSet represents the query result set
3131
type ResultSet struct {
32+
Stats *NodeStats `json:"stats,omitempty"`
33+
Namespace string `json:"namespace,omitempty"`
3234
MetricName string `json:"metricName,omitempty"`
3335
GroupBy []string `json:"groupBy,omitempty"`
3436
Fields []string `json:"fields,omitempty"`
37+
Series []*Series `json:"series,omitempty"`
3538
StartTime int64 `json:"startTime,omitempty"`
3639
EndTime int64 `json:"endTime,omitempty"`
3740
Interval int64 `json:"interval,omitempty"`
38-
Series []*Series `json:"series,omitempty"`
39-
Stats *NodeStats `json:"stats,omitempty"`
4041
}
4142

4243
// NewResultSet creates a new result set
@@ -49,10 +50,17 @@ func (rs *ResultSet) AddSeries(series *Series) {
4950
rs.Series = append(rs.Series, series)
5051
}
5152

53+
type Exemplar struct {
54+
TraceID string `json:"traceId"`
55+
SpanID string `json:"spanId"`
56+
Duration int64 `json:"duration"`
57+
}
58+
5259
// Series represents one time series for metric.
5360
type Series struct {
54-
Tags map[string]string `json:"tags,omitempty"`
55-
Fields map[string]map[int64]float64 `json:"fields,omitempty"`
61+
Tags map[string]string `json:"tags,omitempty"`
62+
Fields map[string]map[int64]float64 `json:"fields,omitempty"`
63+
Exemplars map[string]map[int64][]*Exemplar `json:"exemplars,omitempty"`
5664

5765
TagValues string `json:"-"` // return series in order by tag values
5866
}

proto/gen/v1/flatMetricsV1/CompoundField.go

Lines changed: 21 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)