Skip to content

Commit

Permalink
[feat]: add hash for metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
stone1100 committed Jul 10, 2024
1 parent acd4648 commit e85ab99
Show file tree
Hide file tree
Showing 15 changed files with 518 additions and 521 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lindb-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
cache: true
go-version: 1.22
cache: false
id: go
- name: Test
run: make test
Expand Down
47 changes: 37 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,42 @@ linters-settings:
# Default: 30 (but we recommend 10-20)
min-complexity: 50
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
# Rules to apply.
#
# Variables:
# - File Variables
# you can still use and exclamation mark ! in front of a variable to say not to use it.
# Example !$test will match any file that is not a go test file.
#
# `$all` - matches all go files
# `$test` - matches all go test files
#
# - Package Variables
#
# `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
#
# Default: Only allow $gostd in all files.
rules:
# Name of a rule.
main:
# Used to determine the package matching priority.
# There are three different modes: `original`, `strict`, and `lax`.
# Default: "original"
list-mode: lax
# List of file globs that will match this list of settings to compare against.
# Default: $all
files:
- "!**/*_a _file.go"
# List of allowed packages.
allow:
- $gostd
# Packages that are not allowed where the value is a suggestion.
deny:
- pkg: "github.com/sirupsen/logrus"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package

dupl:
threshold: 100
funlen:
Expand All @@ -36,7 +65,7 @@ linters-settings:
local-prefixes: github.com/lindb/lindb

govet:
check-shadowing: true
shadow: true
settings:
printf:
funcs:
Expand Down Expand Up @@ -172,8 +201,6 @@ issues:

run:
timeout: 5m
skip-dirs:
- test/testdata_etc
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 10m
# list of build tags, all linters use it. Default is empty list.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ header: ## check and add license header.
lint: ## run lint
ifeq (, $(shell which golangci-lint))
# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.51.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.57.2
else
echo "Found golangci-lint"
endif
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/lindb/common

go 1.19
go 1.22

require (
github.com/BurntSushi/toml v1.2.1
Expand Down
16 changes: 12 additions & 4 deletions models/result_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ import (

// ResultSet represents the query result set
type ResultSet struct {
Stats *NodeStats `json:"stats,omitempty"`
Namespace string `json:"namespace,omitempty"`
MetricName string `json:"metricName,omitempty"`
GroupBy []string `json:"groupBy,omitempty"`
Fields []string `json:"fields,omitempty"`
Series []*Series `json:"series,omitempty"`
StartTime int64 `json:"startTime,omitempty"`
EndTime int64 `json:"endTime,omitempty"`
Interval int64 `json:"interval,omitempty"`
Series []*Series `json:"series,omitempty"`
Stats *NodeStats `json:"stats,omitempty"`
}

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

type Exemplar struct {
TraceID string `json:"traceId"`
SpanID string `json:"spanId"`
Duration int64 `json:"duration"`
}

// Series represents one time series for metric.
type Series struct {
Tags map[string]string `json:"tags,omitempty"`
Fields map[string]map[int64]float64 `json:"fields,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Fields map[string]map[int64]float64 `json:"fields,omitempty"`
Exemplars map[string]map[int64][]*Exemplar `json:"exemplars,omitempty"`

TagValues string `json:"-"` // return series in order by tag values
}
Expand Down
68 changes: 21 additions & 47 deletions proto/gen/v1/flatMetricsV1/CompoundField.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e85ab99

Please sign in to comment.