mirror of https://github.com/prometheus/prometheus
commit
10c3e84c90
|
@ -7,6 +7,7 @@ on:
|
||||||
- "**.go"
|
- "**.go"
|
||||||
- "scripts/errcheck_excludes.txt"
|
- "scripts/errcheck_excludes.txt"
|
||||||
- ".github/workflows/golangci-lint.yml"
|
- ".github/workflows/golangci-lint.yml"
|
||||||
|
- ".golangci.yml"
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- "go.sum"
|
- "go.sum"
|
||||||
|
@ -14,6 +15,7 @@ on:
|
||||||
- "**.go"
|
- "**.go"
|
||||||
- "scripts/errcheck_excludes.txt"
|
- "scripts/errcheck_excludes.txt"
|
||||||
- ".github/workflows/golangci-lint.yml"
|
- ".github/workflows/golangci-lint.yml"
|
||||||
|
- ".golangci.yml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
golangci:
|
golangci:
|
||||||
|
|
|
@ -170,7 +170,7 @@ func (importer *ruleImporter) importRule(ctx context.Context, ruleExpr, ruleName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return errors.New(fmt.Sprintf("rule result is wrong type %s", val.Type().String()))
|
return fmt.Errorf("rule result is wrong type %s", val.Type().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.flushAndCommit(ctx); err != nil {
|
if err := app.flushAndCommit(ctx); err != nil {
|
||||||
|
|
|
@ -233,6 +233,7 @@ func TestBackfillLabels(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
ruleImporter, err := newTestRuleImporter(ctx, start, tmpDir, mockAPISamples, defaultBlockDuration)
|
ruleImporter, err := newTestRuleImporter(ctx, start, tmpDir, mockAPISamples, defaultBlockDuration)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
path := filepath.Join(tmpDir, "test.file")
|
path := filepath.Join(tmpDir, "test.file")
|
||||||
recordingRules := `groups:
|
recordingRules := `groups:
|
||||||
|
|
|
@ -188,7 +188,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||||
case "cn":
|
case "cn":
|
||||||
endpointFormat = "https://%s:%d/v%d/gz/discover"
|
endpointFormat = "https://%s:%d/v%d/gz/discover"
|
||||||
default:
|
default:
|
||||||
return nil, errors.New(fmt.Sprintf("unknown role '%s' in configuration", d.sdConfig.Role))
|
return nil, fmt.Errorf("unknown role '%s' in configuration", d.sdConfig.Role)
|
||||||
}
|
}
|
||||||
var endpoint = fmt.Sprintf(endpointFormat, d.sdConfig.Endpoint, d.sdConfig.Port, d.sdConfig.Version)
|
var endpoint = fmt.Sprintf(endpointFormat, d.sdConfig.Endpoint, d.sdConfig.Port, d.sdConfig.Version)
|
||||||
if len(d.sdConfig.Groups) > 0 {
|
if len(d.sdConfig.Groups) > 0 {
|
||||||
|
@ -223,7 +223,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||||
case "cn":
|
case "cn":
|
||||||
return d.processComputeNodeResponse(data, endpoint)
|
return d.processComputeNodeResponse(data, endpoint)
|
||||||
default:
|
default:
|
||||||
return nil, errors.New(fmt.Sprintf("unknown role '%s' in configuration", d.sdConfig.Role))
|
return nil, fmt.Errorf("unknown role '%s' in configuration", d.sdConfig.Role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
type multiError []error
|
type multiError []error
|
||||||
|
|
||||||
// NewMulti returns multiError with provided errors added if not nil.
|
// NewMulti returns multiError with provided errors added if not nil.
|
||||||
func NewMulti(errs ...error) multiError { // nolint:golint
|
func NewMulti(errs ...error) multiError { // nolint:revive
|
||||||
m := multiError{}
|
m := multiError{}
|
||||||
m.Add(errs...)
|
m.Add(errs...)
|
||||||
return m
|
return m
|
||||||
|
|
|
@ -284,7 +284,7 @@ func (ce *CircularExemplarStorage) Resize(l int64) int {
|
||||||
// This math is essentially looking at nextIndex, where we would write the next exemplar to,
|
// This math is essentially looking at nextIndex, where we would write the next exemplar to,
|
||||||
// and find the index in the old exemplar buffer that we should start migrating exemplars from.
|
// and find the index in the old exemplar buffer that we should start migrating exemplars from.
|
||||||
// This way we don't migrate exemplars that would just be overwritten when migrating later exemplars.
|
// This way we don't migrate exemplars that would just be overwritten when migrating later exemplars.
|
||||||
var startIndex int64 = (oldNextIndex - count + int64(len(oldBuffer))) % int64(len(oldBuffer))
|
var startIndex = (oldNextIndex - count + int64(len(oldBuffer))) % int64(len(oldBuffer))
|
||||||
|
|
||||||
for i := int64(0); i < count; i++ {
|
for i := int64(0); i < count; i++ {
|
||||||
idx := (startIndex + i) % int64(len(oldBuffer))
|
idx := (startIndex + i) % int64(len(oldBuffer))
|
||||||
|
|
|
@ -875,7 +875,7 @@ type segmentBufReader struct {
|
||||||
off int // Offset of read data into current segment.
|
off int // Offset of read data into current segment.
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:golint // TODO: Consider exporting segmentBufReader
|
// nolint:revive // TODO: Consider exporting segmentBufReader
|
||||||
func NewSegmentBufReader(segs ...*Segment) *segmentBufReader {
|
func NewSegmentBufReader(segs ...*Segment) *segmentBufReader {
|
||||||
return &segmentBufReader{
|
return &segmentBufReader{
|
||||||
buf: bufio.NewReaderSize(segs[0], 16*pageSize),
|
buf: bufio.NewReaderSize(segs[0], 16*pageSize),
|
||||||
|
@ -883,7 +883,7 @@ func NewSegmentBufReader(segs ...*Segment) *segmentBufReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:golint
|
// nolint:revive
|
||||||
func NewSegmentBufReaderWithOffset(offset int, segs ...*Segment) (sbr *segmentBufReader, err error) {
|
func NewSegmentBufReaderWithOffset(offset int, segs ...*Segment) (sbr *segmentBufReader, err error) {
|
||||||
if offset == 0 {
|
if offset == 0 {
|
||||||
return NewSegmentBufReader(segs...), nil
|
return NewSegmentBufReader(segs...), nil
|
||||||
|
|
Loading…
Reference in New Issue