chore: enable unused-receiver rule from revive

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL 2025-08-04 08:20:57 +02:00
parent 789fddf25a
commit cef219c31c
132 changed files with 570 additions and 569 deletions

View File

@ -160,6 +160,7 @@ linters:
- name: unexported-return - name: unexported-return
- name: unreachable-code - name: unreachable-code
- name: unused-parameter - name: unused-parameter
- name: unused-receiver
- name: var-declaration - name: var-declaration
- name: var-naming - name: var-naming
testifylint: testifylint:

View File

@ -99,7 +99,7 @@ type klogv1Writer struct{}
// This is a hack to support klogv1 without use of go-kit/log. It is inspired // This is a hack to support klogv1 without use of go-kit/log. It is inspired
// by klog's upstream klogv1/v2 coexistence example: // by klog's upstream klogv1/v2 coexistence example:
// https://github.com/kubernetes/klog/blob/main/examples/coexist_klog_v1_and_v2/coexist_klog_v1_and_v2.go // https://github.com/kubernetes/klog/blob/main/examples/coexist_klog_v1_and_v2/coexist_klog_v1_and_v2.go
func (kw klogv1Writer) Write(p []byte) (n int, err error) { func (klogv1Writer) Write(p []byte) (n int, err error) {
if len(p) < klogv1DefaultPrefixLength { if len(p) < klogv1DefaultPrefixLength {
klogv2.InfoDepth(klogv1OutputCallDepth, string(p)) klogv2.InfoDepth(klogv1OutputCallDepth, string(p))
return len(p), nil return len(p), nil
@ -157,7 +157,7 @@ func init() {
// serverOnlyFlag creates server-only kingpin flag. // serverOnlyFlag creates server-only kingpin flag.
func serverOnlyFlag(app *kingpin.Application, name, help string) *kingpin.FlagClause { func serverOnlyFlag(app *kingpin.Application, name, help string) *kingpin.FlagClause {
return app.Flag(name, fmt.Sprintf("%s Use with server mode only.", help)). return app.Flag(name, fmt.Sprintf("%s Use with server mode only.", help)).
PreAction(func(_ *kingpin.ParseContext) error { PreAction(func(*kingpin.ParseContext) error {
// This will be invoked only if flag is actually provided by user. // This will be invoked only if flag is actually provided by user.
serverOnlyFlags = append(serverOnlyFlags, "--"+name) serverOnlyFlags = append(serverOnlyFlags, "--"+name)
return nil return nil
@ -167,7 +167,7 @@ func serverOnlyFlag(app *kingpin.Application, name, help string) *kingpin.FlagCl
// agentOnlyFlag creates agent-only kingpin flag. // agentOnlyFlag creates agent-only kingpin flag.
func agentOnlyFlag(app *kingpin.Application, name, help string) *kingpin.FlagClause { func agentOnlyFlag(app *kingpin.Application, name, help string) *kingpin.FlagClause {
return app.Flag(name, fmt.Sprintf("%s Use with agent mode only.", help)). return app.Flag(name, fmt.Sprintf("%s Use with agent mode only.", help)).
PreAction(func(_ *kingpin.ParseContext) error { PreAction(func(*kingpin.ParseContext) error {
// This will be invoked only if flag is actually provided by user. // This will be invoked only if flag is actually provided by user.
agentOnlyFlags = append(agentOnlyFlags, "--"+name) agentOnlyFlags = append(agentOnlyFlags, "--"+name)
return nil return nil
@ -568,7 +568,7 @@ func main() {
promslogflag.AddFlags(a, &cfg.promslogConfig) promslogflag.AddFlags(a, &cfg.promslogConfig)
a.Flag("write-documentation", "Generate command line documentation. Internal use.").Hidden().Action(func(_ *kingpin.ParseContext) error { a.Flag("write-documentation", "Generate command line documentation. Internal use.").Hidden().Action(func(*kingpin.ParseContext) error {
if err := documentcli.GenerateMarkdown(a.Model(), os.Stdout); err != nil { if err := documentcli.GenerateMarkdown(a.Model(), os.Stdout); err != nil {
os.Exit(1) os.Exit(1)
return err return err
@ -1082,7 +1082,7 @@ func main() {
} }
return nil return nil
}, },
func(_ error) { func(error) {
close(cancel) close(cancel)
webHandler.SetReady(web.Stopping) webHandler.SetReady(web.Stopping)
notifs.AddNotification(notifications.ShuttingDown) notifs.AddNotification(notifications.ShuttingDown)
@ -1097,7 +1097,7 @@ func main() {
logger.Info("Scrape discovery manager stopped") logger.Info("Scrape discovery manager stopped")
return err return err
}, },
func(_ error) { func(error) {
logger.Info("Stopping scrape discovery manager...") logger.Info("Stopping scrape discovery manager...")
cancelScrape() cancelScrape()
}, },
@ -1111,7 +1111,7 @@ func main() {
logger.Info("Notify discovery manager stopped") logger.Info("Notify discovery manager stopped")
return err return err
}, },
func(_ error) { func(error) {
logger.Info("Stopping notify discovery manager...") logger.Info("Stopping notify discovery manager...")
cancelNotify() cancelNotify()
}, },
@ -1125,7 +1125,7 @@ func main() {
ruleManager.Run() ruleManager.Run()
return nil return nil
}, },
func(_ error) { func(error) {
ruleManager.Stop() ruleManager.Stop()
}, },
) )
@ -1144,7 +1144,7 @@ func main() {
logger.Info("Scrape manager stopped") logger.Info("Scrape manager stopped")
return err return err
}, },
func(_ error) { func(error) {
// Scrape manager needs to be stopped before closing the local TSDB // Scrape manager needs to be stopped before closing the local TSDB
// so that it doesn't try to write samples to a closed storage. // so that it doesn't try to write samples to a closed storage.
// We should also wait for rule manager to be fully stopped to ensure // We should also wait for rule manager to be fully stopped to ensure
@ -1162,7 +1162,7 @@ func main() {
tracingManager.Run() tracingManager.Run()
return nil return nil
}, },
func(_ error) { func(error) {
tracingManager.Stop() tracingManager.Stop()
}, },
) )
@ -1243,7 +1243,7 @@ func main() {
} }
} }
}, },
func(_ error) { func(error) {
// Wait for any in-progress reloads to complete to avoid // Wait for any in-progress reloads to complete to avoid
// reloading things after they have been shutdown. // reloading things after they have been shutdown.
cancel <- struct{}{} cancel <- struct{}{}
@ -1275,7 +1275,7 @@ func main() {
<-cancel <-cancel
return nil return nil
}, },
func(_ error) { func(error) {
close(cancel) close(cancel)
}, },
) )
@ -1328,7 +1328,7 @@ func main() {
<-cancel <-cancel
return nil return nil
}, },
func(_ error) { func(error) {
if err := fanoutStorage.Close(); err != nil { if err := fanoutStorage.Close(); err != nil {
logger.Error("Error stopping storage", "err", err) logger.Error("Error stopping storage", "err", err)
} }
@ -1383,7 +1383,7 @@ func main() {
<-cancel <-cancel
return nil return nil
}, },
func(_ error) { func(error) {
if err := fanoutStorage.Close(); err != nil { if err := fanoutStorage.Close(); err != nil {
logger.Error("Error stopping storage", "err", err) logger.Error("Error stopping storage", "err", err)
} }
@ -1400,7 +1400,7 @@ func main() {
} }
return nil return nil
}, },
func(_ error) { func(error) {
cancelWeb() cancelWeb()
}, },
) )
@ -1422,7 +1422,7 @@ func main() {
logger.Info("Notifier manager stopped") logger.Info("Notifier manager stopped")
return nil return nil
}, },
func(_ error) { func(error) {
notifierManager.Stop() notifierManager.Stop()
}, },
) )
@ -1703,35 +1703,35 @@ func (s *readyStorage) Appender(ctx context.Context) storage.Appender {
type notReadyAppender struct{} type notReadyAppender struct{}
// SetOptions does nothing in this appender implementation. // SetOptions does nothing in this appender implementation.
func (n notReadyAppender) SetOptions(_ *storage.AppendOptions) {} func (notReadyAppender) SetOptions(*storage.AppendOptions) {}
func (n notReadyAppender) Append(_ storage.SeriesRef, _ labels.Labels, _ int64, _ float64) (storage.SeriesRef, error) { func (notReadyAppender) Append(storage.SeriesRef, labels.Labels, int64, float64) (storage.SeriesRef, error) {
return 0, tsdb.ErrNotReady return 0, tsdb.ErrNotReady
} }
func (n notReadyAppender) AppendExemplar(_ storage.SeriesRef, _ labels.Labels, _ exemplar.Exemplar) (storage.SeriesRef, error) { func (notReadyAppender) AppendExemplar(storage.SeriesRef, labels.Labels, exemplar.Exemplar) (storage.SeriesRef, error) {
return 0, tsdb.ErrNotReady return 0, tsdb.ErrNotReady
} }
func (n notReadyAppender) AppendHistogram(_ storage.SeriesRef, _ labels.Labels, _ int64, _ *histogram.Histogram, _ *histogram.FloatHistogram) (storage.SeriesRef, error) { func (notReadyAppender) AppendHistogram(storage.SeriesRef, labels.Labels, int64, *histogram.Histogram, *histogram.FloatHistogram) (storage.SeriesRef, error) {
return 0, tsdb.ErrNotReady return 0, tsdb.ErrNotReady
} }
func (n notReadyAppender) AppendHistogramCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64, _ *histogram.Histogram, _ *histogram.FloatHistogram) (storage.SeriesRef, error) { func (notReadyAppender) AppendHistogramCTZeroSample(storage.SeriesRef, labels.Labels, int64, int64, *histogram.Histogram, *histogram.FloatHistogram) (storage.SeriesRef, error) {
return 0, tsdb.ErrNotReady return 0, tsdb.ErrNotReady
} }
func (n notReadyAppender) UpdateMetadata(_ storage.SeriesRef, _ labels.Labels, _ metadata.Metadata) (storage.SeriesRef, error) { func (notReadyAppender) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error) {
return 0, tsdb.ErrNotReady return 0, tsdb.ErrNotReady
} }
func (n notReadyAppender) AppendCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64) (storage.SeriesRef, error) { func (notReadyAppender) AppendCTZeroSample(storage.SeriesRef, labels.Labels, int64, int64) (storage.SeriesRef, error) {
return 0, tsdb.ErrNotReady return 0, tsdb.ErrNotReady
} }
func (n notReadyAppender) Commit() error { return tsdb.ErrNotReady } func (notReadyAppender) Commit() error { return tsdb.ErrNotReady }
func (n notReadyAppender) Rollback() error { return tsdb.ErrNotReady } func (notReadyAppender) Rollback() error { return tsdb.ErrNotReady }
// Close implements the Storage interface. // Close implements the Storage interface.
func (s *readyStorage) Close() error { func (s *readyStorage) Close() error {
@ -1941,7 +1941,7 @@ func rwProtoMsgFlagValue(msgs *[]config.RemoteWriteProtoMsg) kingpin.Value {
} }
// IsCumulative is used by kingpin to tell if it's an array or not. // IsCumulative is used by kingpin to tell if it's an array or not.
func (p *rwProtoMsgFlagParser) IsCumulative() bool { func (*rwProtoMsgFlagParser) IsCumulative() bool {
return true return true
} }

View File

@ -1190,17 +1190,17 @@ type printer interface {
type promqlPrinter struct{} type promqlPrinter struct{}
func (p *promqlPrinter) printValue(v model.Value) { func (*promqlPrinter) printValue(v model.Value) {
fmt.Println(v) fmt.Println(v)
} }
func (p *promqlPrinter) printSeries(val []model.LabelSet) { func (*promqlPrinter) printSeries(val []model.LabelSet) {
for _, v := range val { for _, v := range val {
fmt.Println(v) fmt.Println(v)
} }
} }
func (p *promqlPrinter) printLabelValues(val model.LabelValues) { func (*promqlPrinter) printLabelValues(val model.LabelValues) {
for _, v := range val { for _, v := range val {
fmt.Println(v) fmt.Println(v)
} }
@ -1208,17 +1208,17 @@ func (p *promqlPrinter) printLabelValues(val model.LabelValues) {
type jsonPrinter struct{} type jsonPrinter struct{}
func (j *jsonPrinter) printValue(v model.Value) { func (*jsonPrinter) printValue(v model.Value) {
//nolint:errcheck //nolint:errcheck
json.NewEncoder(os.Stdout).Encode(v) json.NewEncoder(os.Stdout).Encode(v)
} }
func (j *jsonPrinter) printSeries(v []model.LabelSet) { func (*jsonPrinter) printSeries(v []model.LabelSet) {
//nolint:errcheck //nolint:errcheck
json.NewEncoder(os.Stdout).Encode(v) json.NewEncoder(os.Stdout).Encode(v)
} }
func (j *jsonPrinter) printLabelValues(v model.LabelValues) { func (*jsonPrinter) printLabelValues(v model.LabelValues) {
//nolint:errcheck //nolint:errcheck
json.NewEncoder(os.Stdout).Encode(v) json.NewEncoder(os.Stdout).Encode(v)
} }

View File

@ -35,7 +35,7 @@ type mockQueryRangeAPI struct {
samples model.Matrix samples model.Matrix
} }
func (mockAPI mockQueryRangeAPI) QueryRange(_ context.Context, _ string, _ v1.Range, _ ...v1.Option) (model.Value, v1.Warnings, error) { func (mockAPI mockQueryRangeAPI) QueryRange(context.Context, string, v1.Range, ...v1.Option) (model.Value, v1.Warnings, error) {
return mockAPI.samples, v1.Warnings{}, nil return mockAPI.samples, v1.Warnings{}, nil
} }

View File

@ -225,7 +225,7 @@ func (tg *testGroup) test(testname string, evalInterval time.Duration, groupOrde
QueryFunc: rules.EngineQueryFunc(suite.QueryEngine(), suite.Storage()), QueryFunc: rules.EngineQueryFunc(suite.QueryEngine(), suite.Storage()),
Appendable: suite.Storage(), Appendable: suite.Storage(),
Context: context.Background(), Context: context.Background(),
NotifyFunc: func(_ context.Context, _ string, _ ...*rules.Alert) {}, NotifyFunc: func(context.Context, string, ...*rules.Alert) {},
Logger: promslog.NewNopLogger(), Logger: promslog.NewNopLogger(),
} }
m := rules.NewManager(opts) m := rules.NewManager(opts)

View File

@ -399,7 +399,7 @@ func newMockEC2Client(ec2Data *ec2DataStore) *mockEC2Client {
return &client return &client
} }
func (m *mockEC2Client) DescribeAvailabilityZonesWithContext(_ aws.Context, _ *ec2.DescribeAvailabilityZonesInput, _ ...request.Option) (*ec2.DescribeAvailabilityZonesOutput, error) { func (m *mockEC2Client) DescribeAvailabilityZonesWithContext(aws.Context, *ec2.DescribeAvailabilityZonesInput, ...request.Option) (*ec2.DescribeAvailabilityZonesOutput, error) {
if len(m.ec2Data.azToAZID) == 0 { if len(m.ec2Data.azToAZID) == 0 {
return nil, errors.New("No AZs found") return nil, errors.New("No AZs found")
} }

View File

@ -24,9 +24,9 @@ type ec2Metrics struct {
var _ discovery.DiscovererMetrics = (*ec2Metrics)(nil) var _ discovery.DiscovererMetrics = (*ec2Metrics)(nil)
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *ec2Metrics) Register() error { func (*ec2Metrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *ec2Metrics) Unregister() {} func (*ec2Metrics) Unregister() {}

View File

@ -24,9 +24,9 @@ type lightsailMetrics struct {
var _ discovery.DiscovererMetrics = (*lightsailMetrics)(nil) var _ discovery.DiscovererMetrics = (*lightsailMetrics)(nil)
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *lightsailMetrics) Register() error { func (*lightsailMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *lightsailMetrics) Unregister() {} func (*lightsailMetrics) Unregister() {}

View File

@ -723,11 +723,11 @@ func createMockAzureClient(t *testing.T, vmResp []armcompute.VirtualMachinesClie
func defaultMockInterfaceServer(interfaceResp armnetwork.Interface) fakenetwork.InterfacesServer { func defaultMockInterfaceServer(interfaceResp armnetwork.Interface) fakenetwork.InterfacesServer {
return fakenetwork.InterfacesServer{ return fakenetwork.InterfacesServer{
Get: func(_ context.Context, _, _ string, _ *armnetwork.InterfacesClientGetOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetResponse], errResp azfake.ErrorResponder) { Get: func(context.Context, string, string, *armnetwork.InterfacesClientGetOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetResponse], errResp azfake.ErrorResponder) {
resp.SetResponse(http.StatusOK, armnetwork.InterfacesClientGetResponse{Interface: interfaceResp}, nil) resp.SetResponse(http.StatusOK, armnetwork.InterfacesClientGetResponse{Interface: interfaceResp}, nil)
return return
}, },
GetVirtualMachineScaleSetNetworkInterface: func(_ context.Context, _, _, _, _ string, _ *armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse], errResp azfake.ErrorResponder) { GetVirtualMachineScaleSetNetworkInterface: func(context.Context, string, string, string, string, *armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse], errResp azfake.ErrorResponder) {
resp.SetResponse(http.StatusOK, armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{Interface: interfaceResp}, nil) resp.SetResponse(http.StatusOK, armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{Interface: interfaceResp}, nil)
return return
}, },
@ -736,7 +736,7 @@ func defaultMockInterfaceServer(interfaceResp armnetwork.Interface) fakenetwork.
func defaultMockVMServer(vmResp []armcompute.VirtualMachinesClientListAllResponse) fake.VirtualMachinesServer { func defaultMockVMServer(vmResp []armcompute.VirtualMachinesClientListAllResponse) fake.VirtualMachinesServer {
return fake.VirtualMachinesServer{ return fake.VirtualMachinesServer{
NewListAllPager: func(_ *armcompute.VirtualMachinesClientListAllOptions) (resp azfake.PagerResponder[armcompute.VirtualMachinesClientListAllResponse]) { NewListAllPager: func(*armcompute.VirtualMachinesClientListAllOptions) (resp azfake.PagerResponder[armcompute.VirtualMachinesClientListAllResponse]) {
for _, page := range vmResp { for _, page := range vmResp {
resp.AddPage(http.StatusOK, page, nil) resp.AddPage(http.StatusOK, page, nil)
} }
@ -747,7 +747,7 @@ func defaultMockVMServer(vmResp []armcompute.VirtualMachinesClientListAllRespons
func defaultMockVMSSServer(vmssResp []armcompute.VirtualMachineScaleSetsClientListAllResponse) fake.VirtualMachineScaleSetsServer { func defaultMockVMSSServer(vmssResp []armcompute.VirtualMachineScaleSetsClientListAllResponse) fake.VirtualMachineScaleSetsServer {
return fake.VirtualMachineScaleSetsServer{ return fake.VirtualMachineScaleSetsServer{
NewListAllPager: func(_ *armcompute.VirtualMachineScaleSetsClientListAllOptions) (resp azfake.PagerResponder[armcompute.VirtualMachineScaleSetsClientListAllResponse]) { NewListAllPager: func(*armcompute.VirtualMachineScaleSetsClientListAllOptions) (resp azfake.PagerResponder[armcompute.VirtualMachineScaleSetsClientListAllResponse]) {
for _, page := range vmssResp { for _, page := range vmssResp {
resp.AddPage(http.StatusOK, page, nil) resp.AddPage(http.StatusOK, page, nil)
} }

View File

@ -24,9 +24,9 @@ type digitaloceanMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *digitaloceanMetrics) Register() error { func (*digitaloceanMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *digitaloceanMetrics) Unregister() {} func (*digitaloceanMetrics) Unregister() {}

View File

@ -148,7 +148,7 @@ func (c StaticConfig) NewDiscoverer(DiscovererOptions) (Discoverer, error) {
// NewDiscovererMetrics returns NoopDiscovererMetrics because no metrics are // NewDiscovererMetrics returns NoopDiscovererMetrics because no metrics are
// needed for this service discovery mechanism. // needed for this service discovery mechanism.
func (c StaticConfig) NewDiscovererMetrics(prometheus.Registerer, RefreshMetricsInstantiator) DiscovererMetrics { func (StaticConfig) NewDiscovererMetrics(prometheus.Registerer, RefreshMetricsInstantiator) DiscovererMetrics {
return &NoopDiscovererMetrics{} return &NoopDiscovererMetrics{}
} }

View File

@ -52,7 +52,7 @@ func TestDNS(t *testing.T) {
Port: 80, Port: 80,
Type: "A", Type: "A",
}, },
lookup: func(_ string, _ uint16, _ *slog.Logger) (*dns.Msg, error) { lookup: func(string, uint16, *slog.Logger) (*dns.Msg, error) {
return nil, errors.New("some error") return nil, errors.New("some error")
}, },
expected: []*targetgroup.Group{}, expected: []*targetgroup.Group{},
@ -65,7 +65,7 @@ func TestDNS(t *testing.T) {
Port: 80, Port: 80,
Type: "A", Type: "A",
}, },
lookup: func(_ string, _ uint16, _ *slog.Logger) (*dns.Msg, error) { lookup: func(string, uint16, *slog.Logger) (*dns.Msg, error) {
return &dns.Msg{ return &dns.Msg{
Answer: []dns.RR{ Answer: []dns.RR{
&dns.A{A: net.IPv4(192, 0, 2, 2)}, &dns.A{A: net.IPv4(192, 0, 2, 2)},
@ -97,7 +97,7 @@ func TestDNS(t *testing.T) {
Port: 80, Port: 80,
Type: "AAAA", Type: "AAAA",
}, },
lookup: func(_ string, _ uint16, _ *slog.Logger) (*dns.Msg, error) { lookup: func(string, uint16, *slog.Logger) (*dns.Msg, error) {
return &dns.Msg{ return &dns.Msg{
Answer: []dns.RR{ Answer: []dns.RR{
&dns.AAAA{AAAA: net.IPv6loopback}, &dns.AAAA{AAAA: net.IPv6loopback},
@ -128,7 +128,7 @@ func TestDNS(t *testing.T) {
Type: "SRV", Type: "SRV",
RefreshInterval: model.Duration(time.Minute), RefreshInterval: model.Duration(time.Minute),
}, },
lookup: func(_ string, _ uint16, _ *slog.Logger) (*dns.Msg, error) { lookup: func(string, uint16, *slog.Logger) (*dns.Msg, error) {
return &dns.Msg{ return &dns.Msg{
Answer: []dns.RR{ Answer: []dns.RR{
&dns.SRV{Port: 3306, Target: "db1.example.com."}, &dns.SRV{Port: 3306, Target: "db1.example.com."},
@ -167,7 +167,7 @@ func TestDNS(t *testing.T) {
Names: []string{"_mysql._tcp.db.example.com."}, Names: []string{"_mysql._tcp.db.example.com."},
RefreshInterval: model.Duration(time.Minute), RefreshInterval: model.Duration(time.Minute),
}, },
lookup: func(_ string, _ uint16, _ *slog.Logger) (*dns.Msg, error) { lookup: func(string, uint16, *slog.Logger) (*dns.Msg, error) {
return &dns.Msg{ return &dns.Msg{
Answer: []dns.RR{ Answer: []dns.RR{
&dns.SRV{Port: 3306, Target: "db1.example.com."}, &dns.SRV{Port: 3306, Target: "db1.example.com."},
@ -198,7 +198,7 @@ func TestDNS(t *testing.T) {
Names: []string{"_mysql._tcp.db.example.com."}, Names: []string{"_mysql._tcp.db.example.com."},
RefreshInterval: model.Duration(time.Minute), RefreshInterval: model.Duration(time.Minute),
}, },
lookup: func(_ string, _ uint16, _ *slog.Logger) (*dns.Msg, error) { lookup: func(string, uint16, *slog.Logger) (*dns.Msg, error) {
return &dns.Msg{}, nil return &dns.Msg{}, nil
}, },
expected: []*targetgroup.Group{ expected: []*targetgroup.Group{
@ -215,7 +215,7 @@ func TestDNS(t *testing.T) {
Port: 25, Port: 25,
RefreshInterval: model.Duration(time.Minute), RefreshInterval: model.Duration(time.Minute),
}, },
lookup: func(_ string, _ uint16, _ *slog.Logger) (*dns.Msg, error) { lookup: func(string, uint16, *slog.Logger) (*dns.Msg, error) {
return &dns.Msg{ return &dns.Msg{
Answer: []dns.RR{ Answer: []dns.RR{
&dns.MX{Preference: 0, Mx: "smtp1.example.com."}, &dns.MX{Preference: 0, Mx: "smtp1.example.com."},

View File

@ -24,9 +24,9 @@ type eurekaMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *eurekaMetrics) Register() error { func (*eurekaMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *eurekaMetrics) Unregister() {} func (*eurekaMetrics) Unregister() {}

View File

@ -24,9 +24,9 @@ type gceMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *gceMetrics) Register() error { func (*gceMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *gceMetrics) Unregister() {} func (*gceMetrics) Unregister() {}

View File

@ -24,9 +24,9 @@ type hetznerMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *hetznerMetrics) Register() error { func (*hetznerMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *hetznerMetrics) Unregister() {} func (*hetznerMetrics) Unregister() {}

View File

@ -96,7 +96,7 @@ func (*SDConfig) NewDiscovererMetrics(_ prometheus.Registerer, rmi discovery.Ref
} }
// Name returns the name of the IONOS Cloud service discovery. // Name returns the name of the IONOS Cloud service discovery.
func (c SDConfig) Name() string { func (SDConfig) Name() string {
return "ionos" return "ionos"
} }

View File

@ -24,9 +24,9 @@ type ionosMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *ionosMetrics) Register() error { func (*ionosMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *ionosMetrics) Unregister() {} func (*ionosMetrics) Unregister() {}

View File

@ -311,7 +311,7 @@ func TestFailuresCountMetric(t *testing.T) {
require.Equal(t, float64(0), prom_testutil.ToFloat64(n.metrics.failuresCount)) require.Equal(t, float64(0), prom_testutil.ToFloat64(n.metrics.failuresCount))
// Simulate an error on watch requests. // Simulate an error on watch requests.
c.Discovery().(*fakediscovery.FakeDiscovery).PrependWatchReactor("*", func(_ kubetesting.Action) (bool, watch.Interface, error) { c.Discovery().(*fakediscovery.FakeDiscovery).PrependWatchReactor("*", func(kubetesting.Action) (bool, watch.Interface, error) {
return true, nil, apierrors.NewUnauthorized("unauthorized") return true, nil, apierrors.NewUnauthorized("unauthorized")
}) })

View File

@ -258,7 +258,7 @@ func podLabels(pod *apiv1.Pod) model.LabelSet {
return ls return ls
} }
func (p *Pod) findPodContainerStatus(statuses *[]apiv1.ContainerStatus, containerName string) (*apiv1.ContainerStatus, error) { func (*Pod) findPodContainerStatus(statuses *[]apiv1.ContainerStatus, containerName string) (*apiv1.ContainerStatus, error) {
for _, s := range *statuses { for _, s := range *statuses {
if s.Name == containerName { if s.Name == containerName {
return &s, nil return &s, nil

View File

@ -1158,7 +1158,7 @@ func TestApplyConfigDoesNotModifyStaticTargets(t *testing.T) {
type errorConfig struct{ err error } type errorConfig struct{ err error }
func (e errorConfig) Name() string { return "error" } func (errorConfig) Name() string { return "error" }
func (e errorConfig) NewDiscoverer(DiscovererOptions) (Discoverer, error) { return nil, e.err } func (e errorConfig) NewDiscoverer(DiscovererOptions) (Discoverer, error) { return nil, e.err }
// NewDiscovererMetrics implements discovery.Config. // NewDiscovererMetrics implements discovery.Config.
@ -1176,7 +1176,7 @@ func (lockStaticConfig) NewDiscovererMetrics(prometheus.Registerer, RefreshMetri
return &NoopDiscovererMetrics{} return &NoopDiscovererMetrics{}
} }
func (s lockStaticConfig) Name() string { return "lockstatic" } func (lockStaticConfig) Name() string { return "lockstatic" }
func (s lockStaticConfig) NewDiscoverer(DiscovererOptions) (Discoverer, error) { func (s lockStaticConfig) NewDiscoverer(DiscovererOptions) (Discoverer, error) {
return (lockStaticDiscoverer)(s), nil return (lockStaticDiscoverer)(s), nil
} }
@ -1521,7 +1521,7 @@ func (*testDiscoverer) NewDiscovererMetrics(prometheus.Registerer, RefreshMetric
} }
// Name implements Config. // Name implements Config.
func (t *testDiscoverer) Name() string { func (*testDiscoverer) Name() string {
return "test" return "test"
} }

View File

@ -64,7 +64,7 @@ func testUpdateServices(client appListClient) ([]*targetgroup.Group, error) {
func TestMarathonSDHandleError(t *testing.T) { func TestMarathonSDHandleError(t *testing.T) {
var ( var (
errTesting = errors.New("testing failure") errTesting = errors.New("testing failure")
client = func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client = func(context.Context, *http.Client, string) (*appList, error) {
return nil, errTesting return nil, errTesting
} }
) )
@ -74,7 +74,7 @@ func TestMarathonSDHandleError(t *testing.T) {
} }
func TestMarathonSDEmptyList(t *testing.T) { func TestMarathonSDEmptyList(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { return &appList{}, nil } client := func(context.Context, *http.Client, string) (*appList, error) { return &appList{}, nil }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
require.NoError(t, err) require.NoError(t, err)
require.Empty(t, tgs, "Expected no target groups.") require.Empty(t, tgs, "Expected no target groups.")
@ -107,7 +107,7 @@ func marathonTestAppList(labels map[string]string, runningTasks int) *appList {
} }
func TestMarathonSDSendGroup(t *testing.T) { func TestMarathonSDSendGroup(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppList(marathonValidLabel, 1), nil return marathonTestAppList(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -135,7 +135,7 @@ func TestMarathonSDRemoveApp(t *testing.T) {
md, err := NewDiscovery(cfg, nil, metrics) md, err := NewDiscovery(cfg, nil, metrics)
require.NoError(t, err) require.NoError(t, err)
md.appsClient = func(_ context.Context, _ *http.Client, _ string) (*appList, error) { md.appsClient = func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppList(marathonValidLabel, 1), nil return marathonTestAppList(marathonValidLabel, 1), nil
} }
tgs, err := md.refresh(context.Background()) tgs, err := md.refresh(context.Background())
@ -143,7 +143,7 @@ func TestMarathonSDRemoveApp(t *testing.T) {
require.Len(t, tgs, 1, "Expected 1 targetgroup.") require.Len(t, tgs, 1, "Expected 1 targetgroup.")
tg1 := tgs[0] tg1 := tgs[0]
md.appsClient = func(_ context.Context, _ *http.Client, _ string) (*appList, error) { md.appsClient = func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppList(marathonValidLabel, 0), nil return marathonTestAppList(marathonValidLabel, 0), nil
} }
tgs, err = md.refresh(context.Background()) tgs, err = md.refresh(context.Background())
@ -184,7 +184,7 @@ func marathonTestAppListWithMultiplePorts(labels map[string]string, runningTasks
} }
func TestMarathonSDSendGroupWithMultiplePort(t *testing.T) { func TestMarathonSDSendGroupWithMultiplePort(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppListWithMultiplePorts(marathonValidLabel, 1), nil return marathonTestAppListWithMultiplePorts(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -229,7 +229,7 @@ func marathonTestZeroTaskPortAppList(labels map[string]string, runningTasks int)
} }
func TestMarathonZeroTaskPorts(t *testing.T) { func TestMarathonZeroTaskPorts(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestZeroTaskPortAppList(marathonValidLabel, 1), nil return marathonTestZeroTaskPortAppList(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -287,7 +287,7 @@ func marathonTestAppListWithPortDefinitions(labels map[string]string, runningTas
} }
func TestMarathonSDSendGroupWithPortDefinitions(t *testing.T) { func TestMarathonSDSendGroupWithPortDefinitions(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppListWithPortDefinitions(marathonValidLabel, 1), nil return marathonTestAppListWithPortDefinitions(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -341,7 +341,7 @@ func marathonTestAppListWithPortDefinitionsRequirePorts(labels map[string]string
} }
func TestMarathonSDSendGroupWithPortDefinitionsRequirePorts(t *testing.T) { func TestMarathonSDSendGroupWithPortDefinitionsRequirePorts(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppListWithPortDefinitionsRequirePorts(marathonValidLabel, 1), nil return marathonTestAppListWithPortDefinitionsRequirePorts(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -388,7 +388,7 @@ func marathonTestAppListWithPorts(labels map[string]string, runningTasks int) *a
} }
func TestMarathonSDSendGroupWithPorts(t *testing.T) { func TestMarathonSDSendGroupWithPorts(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppListWithPorts(marathonValidLabel, 1), nil return marathonTestAppListWithPorts(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -444,7 +444,7 @@ func marathonTestAppListWithContainerPortMappings(labels map[string]string, runn
} }
func TestMarathonSDSendGroupWithContainerPortMappings(t *testing.T) { func TestMarathonSDSendGroupWithContainerPortMappings(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppListWithContainerPortMappings(marathonValidLabel, 1), nil return marathonTestAppListWithContainerPortMappings(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -500,7 +500,7 @@ func marathonTestAppListWithDockerContainerPortMappings(labels map[string]string
} }
func TestMarathonSDSendGroupWithDockerContainerPortMappings(t *testing.T) { func TestMarathonSDSendGroupWithDockerContainerPortMappings(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppListWithDockerContainerPortMappings(marathonValidLabel, 1), nil return marathonTestAppListWithDockerContainerPortMappings(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)
@ -560,7 +560,7 @@ func marathonTestAppListWithContainerNetworkAndPortMappings(labels map[string]st
} }
func TestMarathonSDSendGroupWithContainerNetworkAndPortMapping(t *testing.T) { func TestMarathonSDSendGroupWithContainerNetworkAndPortMapping(t *testing.T) {
client := func(_ context.Context, _ *http.Client, _ string) (*appList, error) { client := func(context.Context, *http.Client, string) (*appList, error) {
return marathonTestAppListWithContainerNetworkAndPortMappings(marathonValidLabel, 1), nil return marathonTestAppListWithContainerNetworkAndPortMappings(marathonValidLabel, 1), nil
} }
tgs, err := testUpdateServices(client) tgs, err := testUpdateServices(client)

View File

@ -24,9 +24,9 @@ type marathonMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *marathonMetrics) Register() error { func (*marathonMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *marathonMetrics) Unregister() {} func (*marathonMetrics) Unregister() {}

View File

@ -176,27 +176,27 @@ func (f *clientGoWorkqueueMetricsProvider) RegisterWithK8sGoClient() {
workqueue.SetProvider(f) workqueue.SetProvider(f)
} }
func (f *clientGoWorkqueueMetricsProvider) NewDepthMetric(name string) workqueue.GaugeMetric { func (*clientGoWorkqueueMetricsProvider) NewDepthMetric(name string) workqueue.GaugeMetric {
return clientGoWorkqueueDepthMetricVec.WithLabelValues(name) return clientGoWorkqueueDepthMetricVec.WithLabelValues(name)
} }
func (f *clientGoWorkqueueMetricsProvider) NewAddsMetric(name string) workqueue.CounterMetric { func (*clientGoWorkqueueMetricsProvider) NewAddsMetric(name string) workqueue.CounterMetric {
return clientGoWorkqueueAddsMetricVec.WithLabelValues(name) return clientGoWorkqueueAddsMetricVec.WithLabelValues(name)
} }
func (f *clientGoWorkqueueMetricsProvider) NewLatencyMetric(name string) workqueue.HistogramMetric { func (*clientGoWorkqueueMetricsProvider) NewLatencyMetric(name string) workqueue.HistogramMetric {
return clientGoWorkqueueLatencyMetricVec.WithLabelValues(name) return clientGoWorkqueueLatencyMetricVec.WithLabelValues(name)
} }
func (f *clientGoWorkqueueMetricsProvider) NewWorkDurationMetric(name string) workqueue.HistogramMetric { func (*clientGoWorkqueueMetricsProvider) NewWorkDurationMetric(name string) workqueue.HistogramMetric {
return clientGoWorkqueueWorkDurationMetricVec.WithLabelValues(name) return clientGoWorkqueueWorkDurationMetricVec.WithLabelValues(name)
} }
func (f *clientGoWorkqueueMetricsProvider) NewUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric { func (*clientGoWorkqueueMetricsProvider) NewUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric {
return clientGoWorkqueueUnfinishedWorkSecondsMetricVec.WithLabelValues(name) return clientGoWorkqueueUnfinishedWorkSecondsMetricVec.WithLabelValues(name)
} }
func (f *clientGoWorkqueueMetricsProvider) NewLongestRunningProcessorSecondsMetric(name string) workqueue.SettableGaugeMetric { func (*clientGoWorkqueueMetricsProvider) NewLongestRunningProcessorSecondsMetric(name string) workqueue.SettableGaugeMetric {
return clientGoWorkqueueLongestRunningProcessorMetricVec.WithLabelValues(name) return clientGoWorkqueueLongestRunningProcessorMetricVec.WithLabelValues(name)
} }

View File

@ -24,9 +24,9 @@ type dockerMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *dockerMetrics) Register() error { func (*dockerMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *dockerMetrics) Unregister() {} func (*dockerMetrics) Unregister() {}

View File

@ -24,9 +24,9 @@ type dockerswarmMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *dockerswarmMetrics) Register() error { func (*dockerswarmMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *dockerswarmMetrics) Unregister() {} func (*dockerswarmMetrics) Unregister() {}

View File

@ -24,9 +24,9 @@ type openstackMetrics struct {
var _ discovery.DiscovererMetrics = (*openstackMetrics)(nil) var _ discovery.DiscovererMetrics = (*openstackMetrics)(nil)
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *openstackMetrics) Register() error { func (*openstackMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *openstackMetrics) Unregister() {} func (*openstackMetrics) Unregister() {}

View File

@ -93,7 +93,7 @@ func getDedicatedServerDetails(client *ovh.Client, serverName string) (*dedicate
return &dedicatedServerDetails, nil return &dedicatedServerDetails, nil
} }
func (d *dedicatedServerDiscovery) getService() string { func (*dedicatedServerDiscovery) getService() string {
return "dedicated_server" return "dedicated_server"
} }

View File

@ -24,9 +24,9 @@ type ovhcloudMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *ovhcloudMetrics) Register() error { func (*ovhcloudMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *ovhcloudMetrics) Unregister() {} func (*ovhcloudMetrics) Unregister() {}

View File

@ -61,7 +61,7 @@ func (*SDConfig) NewDiscovererMetrics(_ prometheus.Registerer, rmi discovery.Ref
} }
// Name implements the Discoverer interface. // Name implements the Discoverer interface.
func (c SDConfig) Name() string { func (SDConfig) Name() string {
return "ovhcloud" return "ovhcloud"
} }

View File

@ -109,7 +109,7 @@ func getVpsList(client *ovh.Client) ([]string, error) {
return vpsListName, nil return vpsListName, nil
} }
func (d *vpsDiscovery) getService() string { func (*vpsDiscovery) getService() string {
return "vps" return "vps"
} }

View File

@ -24,9 +24,9 @@ type puppetdbMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *puppetdbMetrics) Register() error { func (*puppetdbMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *puppetdbMetrics) Unregister() {} func (*puppetdbMetrics) Unregister() {}

View File

@ -56,7 +56,7 @@ func TestRefresh(t *testing.T) {
} }
var i int var i int
refresh := func(_ context.Context) ([]*targetgroup.Group, error) { refresh := func(context.Context) ([]*targetgroup.Group, error) {
i++ i++
switch i { switch i {
case 1: case 1:

View File

@ -24,9 +24,9 @@ type scalewayMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *scalewayMetrics) Register() error { func (*scalewayMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *scalewayMetrics) Unregister() {} func (*scalewayMetrics) Unregister() {}

View File

@ -111,7 +111,7 @@ func (*SDConfig) NewDiscovererMetrics(_ prometheus.Registerer, rmi discovery.Ref
} }
} }
func (c SDConfig) Name() string { func (SDConfig) Name() string {
return "scaleway" return "scaleway"
} }

View File

@ -24,9 +24,9 @@ type stackitMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *stackitMetrics) Register() error { func (*stackitMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *stackitMetrics) Unregister() {} func (*stackitMetrics) Unregister() {}

View File

@ -24,9 +24,9 @@ type tritonMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *tritonMetrics) Register() error { func (*tritonMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *tritonMetrics) Unregister() {} func (*tritonMetrics) Unregister() {}

View File

@ -24,9 +24,9 @@ type uyuniMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *uyuniMetrics) Register() error { func (*uyuniMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *uyuniMetrics) Unregister() {} func (*uyuniMetrics) Unregister() {}

View File

@ -330,7 +330,7 @@ func (d *Discovery) getTargetsForSystems(
return result, nil return result, nil
} }
func (d *Discovery) refresh(_ context.Context) ([]*targetgroup.Group, error) { func (d *Discovery) refresh(context.Context) ([]*targetgroup.Group, error) {
rpcClient, err := xmlrpc.NewClient(d.apiURL.String(), d.roundTripper) rpcClient, err := xmlrpc.NewClient(d.apiURL.String(), d.roundTripper)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -24,9 +24,9 @@ type vultrMetrics struct {
} }
// Register implements discovery.DiscovererMetrics. // Register implements discovery.DiscovererMetrics.
func (m *vultrMetrics) Register() error { func (*vultrMetrics) Register() error {
return nil return nil
} }
// Unregister implements discovery.DiscovererMetrics. // Unregister implements discovery.DiscovererMetrics.
func (m *vultrMetrics) Unregister() {} func (*vultrMetrics) Unregister() {}

View File

@ -106,7 +106,7 @@ func createTestHTTPResourceClient(t *testing.T, conf *HTTPResourceClientConfig,
} }
func TestHTTPResourceClientFetchEmptyResponse(t *testing.T) { func TestHTTPResourceClientFetchEmptyResponse(t *testing.T) {
client, cleanup := createTestHTTPResourceClient(t, testHTTPResourceConfig(), ProtocolV3, func(_ *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { client, cleanup := createTestHTTPResourceClient(t, testHTTPResourceConfig(), ProtocolV3, func(*v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) {
return nil, nil return nil, nil
}) })
defer cleanup() defer cleanup()
@ -146,7 +146,7 @@ func TestHTTPResourceClientFetchFullResponse(t *testing.T) {
} }
func TestHTTPResourceClientServerError(t *testing.T) { func TestHTTPResourceClientServerError(t *testing.T) {
client, cleanup := createTestHTTPResourceClient(t, testHTTPResourceConfig(), ProtocolV3, func(_ *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { client, cleanup := createTestHTTPResourceClient(t, testHTTPResourceConfig(), ProtocolV3, func(*v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) {
return nil, errors.New("server error") return nil, errors.New("server error")
}) })
defer cleanup() defer cleanup()

View File

@ -88,7 +88,7 @@ func (c *KumaSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
return c.HTTPClientConfig.Validate() return c.HTTPClientConfig.Validate()
} }
func (c *KumaSDConfig) Name() string { func (*KumaSDConfig) Name() string {
return "kuma" return "kuma"
} }

View File

@ -85,7 +85,7 @@ func createTestHTTPServer(t *testing.T, responder discoveryResponder) *httptest.
} }
func constantResourceParser(targets []model.LabelSet, err error) resourceParser { func constantResourceParser(targets []model.LabelSet, err error) resourceParser {
return func(_ []*anypb.Any, _ string) ([]model.LabelSet, error) { return func([]*anypb.Any, string) ([]model.LabelSet, error) {
return targets, err return targets, err
} }
} }
@ -111,16 +111,16 @@ func (rc testResourceClient) Fetch(ctx context.Context) (*v3.DiscoveryResponse,
return rc.fetch(ctx) return rc.fetch(ctx)
} }
func (rc testResourceClient) ID() string { func (testResourceClient) ID() string {
return "test-client" return "test-client"
} }
func (rc testResourceClient) Close() { func (testResourceClient) Close() {
} }
func TestPollingRefreshSkipUpdate(t *testing.T) { func TestPollingRefreshSkipUpdate(t *testing.T) {
rc := &testResourceClient{ rc := &testResourceClient{
fetch: func(_ context.Context) (*v3.DiscoveryResponse, error) { fetch: func(context.Context) (*v3.DiscoveryResponse, error) {
return nil, nil return nil, nil
}, },
} }
@ -167,7 +167,7 @@ func TestPollingRefreshAttachesGroupMetadata(t *testing.T) {
rc := &testResourceClient{ rc := &testResourceClient{
server: server, server: server,
protocolVersion: ProtocolV3, protocolVersion: ProtocolV3,
fetch: func(_ context.Context) (*v3.DiscoveryResponse, error) { fetch: func(context.Context) (*v3.DiscoveryResponse, error) {
return &v3.DiscoveryResponse{}, nil return &v3.DiscoveryResponse{}, nil
}, },
} }
@ -223,14 +223,14 @@ func TestPollingDisappearingTargets(t *testing.T) {
rc := &testResourceClient{ rc := &testResourceClient{
server: server, server: server,
protocolVersion: ProtocolV3, protocolVersion: ProtocolV3,
fetch: func(_ context.Context) (*v3.DiscoveryResponse, error) { fetch: func(context.Context) (*v3.DiscoveryResponse, error) {
return &v3.DiscoveryResponse{}, nil return &v3.DiscoveryResponse{}, nil
}, },
} }
// On the first poll, send back two targets. On the next, send just one. // On the first poll, send back two targets. On the next, send just one.
counter := 0 counter := 0
parser := func(_ []*anypb.Any, _ string) ([]model.LabelSet, error) { parser := func([]*anypb.Any, string) ([]model.LabelSet, error) {
counter++ counter++
if counter == 1 { if counter == 1 {
return []model.LabelSet{ return []model.LabelSet{

View File

@ -59,7 +59,7 @@ type ServersetSDConfig struct {
} }
// NewDiscovererMetrics implements discovery.Config. // NewDiscovererMetrics implements discovery.Config.
func (*ServersetSDConfig) NewDiscovererMetrics(_ prometheus.Registerer, _ discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { func (*ServersetSDConfig) NewDiscovererMetrics(prometheus.Registerer, discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics {
return &discovery.NoopDiscovererMetrics{} return &discovery.NoopDiscovererMetrics{}
} }
@ -101,7 +101,7 @@ type NerveSDConfig struct {
} }
// NewDiscovererMetrics implements discovery.Config. // NewDiscovererMetrics implements discovery.Config.
func (*NerveSDConfig) NewDiscovererMetrics(_ prometheus.Registerer, _ discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { func (*NerveSDConfig) NewDiscovererMetrics(prometheus.Registerer, discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics {
return &discovery.NoopDiscovererMetrics{} return &discovery.NoopDiscovererMetrics{}
} }

View File

@ -33,6 +33,6 @@ func TestNewDiscoveryError(t *testing.T) {
[]string{"unreachable.invalid"}, []string{"unreachable.invalid"},
time.Second, []string{"/"}, time.Second, []string{"/"},
nil, nil,
func(_ []byte, _ string) (model.LabelSet, error) { return nil, nil }) func([]byte, string) (model.LabelSet, error) { return nil, nil })
require.Error(t, err) require.Error(t, err)
} }

View File

@ -94,7 +94,7 @@ type discovery struct {
oldSourceList map[string]bool oldSourceList map[string]bool
} }
func (d *discovery) parseServiceNodes(resp *http.Response, name string) (*targetgroup.Group, error) { func (*discovery) parseServiceNodes(resp *http.Response, name string) (*targetgroup.Group, error) {
var nodes []*CatalogService var nodes []*CatalogService
tgroup := targetgroup.Group{ tgroup := targetgroup.Group{
Source: name, Source: name,

View File

@ -104,6 +104,6 @@ func (c *Client) Write(samples model.Samples) error {
} }
// Name identifies the client as a Graphite client. // Name identifies the client as a Graphite client.
func (c Client) Name() string { func (Client) Name() string {
return "graphite" return "graphite"
} }

View File

@ -326,7 +326,7 @@ func mergeSamples(a, b []prompb.Sample) []prompb.Sample {
} }
// Name identifies the client as an InfluxDB client. // Name identifies the client as an InfluxDB client.
func (c Client) Name() string { func (Client) Name() string {
return "influxdb" return "influxdb"
} }

View File

@ -139,6 +139,6 @@ func (c *Client) Write(samples model.Samples) error {
} }
// Name identifies the client as an OpenTSDB client. // Name identifies the client as an OpenTSDB client.
func (c Client) Name() string { func (Client) Name() string {
return "opentsdb" return "opentsdb"
} }

View File

@ -453,7 +453,7 @@ func NewScratchBuilder(n int) ScratchBuilder {
} }
// NewBuilderWithSymbolTable creates a Builder, for api parity with dedupelabels. // NewBuilderWithSymbolTable creates a Builder, for api parity with dedupelabels.
func NewBuilderWithSymbolTable(_ *SymbolTable) *Builder { func NewBuilderWithSymbolTable(*SymbolTable) *Builder {
return NewBuilder(EmptyLabels()) return NewBuilder(EmptyLabels())
} }
@ -462,7 +462,7 @@ func NewScratchBuilderWithSymbolTable(_ *SymbolTable, n int) ScratchBuilder {
return NewScratchBuilder(n) return NewScratchBuilder(n)
} }
func (b *ScratchBuilder) SetSymbolTable(_ *SymbolTable) { func (b *ScratchBuilder) SetSymbolTable(*SymbolTable) {
// no-op // no-op
} }

View File

@ -449,11 +449,11 @@ func (ls Labels) DropReserved(shouldDropFn func(name string) bool) Labels {
} }
// InternStrings is a no-op because it would only save when the whole set of labels is identical. // InternStrings is a no-op because it would only save when the whole set of labels is identical.
func (ls *Labels) InternStrings(_ func(string) string) { func (*Labels) InternStrings(func(string) string) {
} }
// ReleaseStrings is a no-op for the same reason as InternStrings. // ReleaseStrings is a no-op for the same reason as InternStrings.
func (ls Labels) ReleaseStrings(_ func(string)) { func (Labels) ReleaseStrings(func(string)) {
} }
// Builder allows modifying Labels. // Builder allows modifying Labels.
@ -664,10 +664,10 @@ type SymbolTable struct{}
func NewSymbolTable() *SymbolTable { return nil } func NewSymbolTable() *SymbolTable { return nil }
func (t *SymbolTable) Len() int { return 0 } func (*SymbolTable) Len() int { return 0 }
// NewBuilderWithSymbolTable creates a Builder, for api parity with dedupelabels. // NewBuilderWithSymbolTable creates a Builder, for api parity with dedupelabels.
func NewBuilderWithSymbolTable(_ *SymbolTable) *Builder { func NewBuilderWithSymbolTable(*SymbolTable) *Builder {
return NewBuilder(EmptyLabels()) return NewBuilder(EmptyLabels())
} }
@ -676,7 +676,7 @@ func NewScratchBuilderWithSymbolTable(_ *SymbolTable, n int) ScratchBuilder {
return NewScratchBuilder(n) return NewScratchBuilder(n)
} }
func (b *ScratchBuilder) SetSymbolTable(_ *SymbolTable) { func (*ScratchBuilder) SetSymbolTable(*SymbolTable) {
// no-op // no-op
} }

View File

@ -695,7 +695,7 @@ func (m *literalSuffixStringMatcher) Matches(s string) bool {
// emptyStringMatcher matches an empty string. // emptyStringMatcher matches an empty string.
type emptyStringMatcher struct{} type emptyStringMatcher struct{}
func (m emptyStringMatcher) Matches(s string) bool { func (emptyStringMatcher) Matches(s string) bool {
return len(s) == 0 return len(s) == 0
} }
@ -756,7 +756,7 @@ func (m *equalMultiStringSliceMatcher) add(s string) {
m.values = append(m.values, s) m.values = append(m.values, s)
} }
func (m *equalMultiStringSliceMatcher) addPrefix(_ string, _ bool, _ StringMatcher) { func (*equalMultiStringSliceMatcher) addPrefix(string, bool, StringMatcher) {
panic("not implemented") panic("not implemented")
} }
@ -897,7 +897,7 @@ func toNormalisedLowerSlow(s string, i int, a []byte) string {
// (including an empty one) as far as it doesn't contain any newline character. // (including an empty one) as far as it doesn't contain any newline character.
type anyStringWithoutNewlineMatcher struct{} type anyStringWithoutNewlineMatcher struct{}
func (m anyStringWithoutNewlineMatcher) Matches(s string) bool { func (anyStringWithoutNewlineMatcher) Matches(s string) bool {
// We need to make sure it doesn't contain a newline. Since the newline is // We need to make sure it doesn't contain a newline. Since the newline is
// an ASCII character, we can use strings.IndexByte(). // an ASCII character, we can use strings.IndexByte().
return strings.IndexByte(s, '\n') == -1 return strings.IndexByte(s, '\n') == -1
@ -947,7 +947,7 @@ func (m *zeroOrOneCharacterStringMatcher) Matches(s string) bool {
// trueMatcher is a stringMatcher which matches any string (always returns true). // trueMatcher is a stringMatcher which matches any string (always returns true).
type trueMatcher struct{} type trueMatcher struct{}
func (m trueMatcher) Matches(_ string) bool { func (trueMatcher) Matches(string) bool {
return true return true
} }

View File

@ -603,14 +603,14 @@ func TestNHCBParser_NoNHCBWhenExponential(t *testing.T) {
return "ProtoBuf", factory, []int{1, 2, 3}, parserOptions{useUTF8sep: true, hasCreatedTimeStamp: true} return "ProtoBuf", factory, []int{1, 2, 3}, parserOptions{useUTF8sep: true, hasCreatedTimeStamp: true}
}, },
func() (string, parserFactory, []int, parserOptions) { func() (string, parserFactory, []int, parserOptions) {
factory := func(_ bool) Parser { factory := func(bool) Parser {
input := createTestOpenMetricsHistogram() input := createTestOpenMetricsHistogram()
return NewOpenMetricsParser([]byte(input), labels.NewSymbolTable(), WithOMParserCTSeriesSkipped()) return NewOpenMetricsParser([]byte(input), labels.NewSymbolTable(), WithOMParserCTSeriesSkipped())
} }
return "OpenMetrics", factory, []int{1}, parserOptions{hasCreatedTimeStamp: true} return "OpenMetrics", factory, []int{1}, parserOptions{hasCreatedTimeStamp: true}
}, },
func() (string, parserFactory, []int, parserOptions) { func() (string, parserFactory, []int, parserOptions) {
factory := func(_ bool) Parser { factory := func(bool) Parser {
input := createTestPromHistogram() input := createTestPromHistogram()
return NewPromParser([]byte(input), labels.NewSymbolTable(), false) return NewPromParser([]byte(input), labels.NewSymbolTable(), false)
} }

View File

@ -172,7 +172,7 @@ func (p *OpenMetricsParser) Series() ([]byte, *int64, float64) {
// Histogram returns (nil, nil, nil, nil) for now because OpenMetrics does not // Histogram returns (nil, nil, nil, nil) for now because OpenMetrics does not
// support sparse histograms yet. // support sparse histograms yet.
func (p *OpenMetricsParser) Histogram() ([]byte, *int64, *histogram.Histogram, *histogram.FloatHistogram) { func (*OpenMetricsParser) Histogram() ([]byte, *int64, *histogram.Histogram, *histogram.FloatHistogram) {
return nil, nil, nil, nil return nil, nil, nil, nil
} }

View File

@ -189,7 +189,7 @@ func (p *PromParser) Series() ([]byte, *int64, float64) {
// Histogram returns (nil, nil, nil, nil) for now because the Prometheus text // Histogram returns (nil, nil, nil, nil) for now because the Prometheus text
// format does not support sparse histograms yet. // format does not support sparse histograms yet.
func (p *PromParser) Histogram() ([]byte, *int64, *histogram.Histogram, *histogram.FloatHistogram) { func (*PromParser) Histogram() ([]byte, *int64, *histogram.Histogram, *histogram.FloatHistogram) {
return nil, nil, nil, nil return nil, nil, nil, nil
} }
@ -216,7 +216,7 @@ func (p *PromParser) Type() ([]byte, model.MetricType) {
// Unit returns the metric name and unit in the current entry. // Unit returns the metric name and unit in the current entry.
// Must only be called after Next returned a unit entry. // Must only be called after Next returned a unit entry.
// The returned byte slices become invalid after the next call to Next. // The returned byte slices become invalid after the next call to Next.
func (p *PromParser) Unit() ([]byte, []byte) { func (*PromParser) Unit() ([]byte, []byte) {
// The Prometheus format does not have units. // The Prometheus format does not have units.
return nil, nil return nil, nil
} }
@ -270,13 +270,13 @@ func (p *PromParser) Labels(l *labels.Labels) {
// Exemplar implements the Parser interface. However, since the classic // Exemplar implements the Parser interface. However, since the classic
// Prometheus text format does not support exemplars, this implementation simply // Prometheus text format does not support exemplars, this implementation simply
// returns false and does nothing else. // returns false and does nothing else.
func (p *PromParser) Exemplar(*exemplar.Exemplar) bool { func (*PromParser) Exemplar(*exemplar.Exemplar) bool {
return false return false
} }
// CreatedTimestamp returns 0 as it's not implemented yet. // CreatedTimestamp returns 0 as it's not implemented yet.
// TODO(bwplotka): https://github.com/prometheus/prometheus/issues/12980 // TODO(bwplotka): https://github.com/prometheus/prometheus/issues/12980
func (p *PromParser) CreatedTimestamp() int64 { func (*PromParser) CreatedTimestamp() int64 {
return 0 return 0
} }

View File

@ -299,7 +299,7 @@ func (p *ProtobufParser) Unit() ([]byte, []byte) {
// Comment always returns nil because comments aren't supported by the protobuf // Comment always returns nil because comments aren't supported by the protobuf
// format. // format.
func (p *ProtobufParser) Comment() []byte { func (*ProtobufParser) Comment() []byte {
return nil return nil
} }

View File

@ -725,7 +725,7 @@ func TestHangingNotifier(t *testing.T) {
// Set up a faulty Alertmanager. // Set up a faulty Alertmanager.
var faultyCalled atomic.Bool var faultyCalled atomic.Bool
faultyServer := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) { faultyServer := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
faultyCalled.Store(true) faultyCalled.Store(true)
select { select {
case <-done: case <-done:
@ -737,7 +737,7 @@ func TestHangingNotifier(t *testing.T) {
// Set up a functional Alertmanager. // Set up a functional Alertmanager.
var functionalCalled atomic.Bool var functionalCalled atomic.Bool
functionalServer := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) { functionalServer := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
functionalCalled.Store(true) functionalCalled.Store(true)
})) }))
functionalURL, err := url.Parse(functionalServer.URL) functionalURL, err := url.Parse(functionalServer.URL)

View File

@ -146,11 +146,11 @@ func (m *MetricStreamingDecoder) resetMetric() {
} }
} }
func (m *MetricStreamingDecoder) GetMetric() { func (*MetricStreamingDecoder) GetMetric() {
panic("don't use GetMetric, use Metric directly") panic("don't use GetMetric, use Metric directly")
} }
func (m *MetricStreamingDecoder) GetLabel() { func (*MetricStreamingDecoder) GetLabel() {
panic("don't use GetLabel, use Label instead") panic("don't use GetLabel, use Label instead")
} }

View File

@ -1087,7 +1087,7 @@ func (ev *evaluator) errorf(format string, args ...interface{}) {
} }
// error causes a panic with the given error. // error causes a panic with the given error.
func (ev *evaluator) error(err error) { func (*evaluator) error(err error) {
panic(err) panic(err)
} }
@ -2562,7 +2562,7 @@ loop:
return floats, histograms return floats, histograms
} }
func (ev *evaluator) VectorAnd(lhs, rhs Vector, matching *parser.VectorMatching, lhsh, rhsh []EvalSeriesHelper, enh *EvalNodeHelper) Vector { func (*evaluator) VectorAnd(lhs, rhs Vector, matching *parser.VectorMatching, lhsh, rhsh []EvalSeriesHelper, enh *EvalNodeHelper) Vector {
if matching.Card != parser.CardManyToMany { if matching.Card != parser.CardManyToMany {
panic("set operations must only use many-to-many matching") panic("set operations must only use many-to-many matching")
} }
@ -2586,7 +2586,7 @@ func (ev *evaluator) VectorAnd(lhs, rhs Vector, matching *parser.VectorMatching,
return enh.Out return enh.Out
} }
func (ev *evaluator) VectorOr(lhs, rhs Vector, matching *parser.VectorMatching, lhsh, rhsh []EvalSeriesHelper, enh *EvalNodeHelper) Vector { func (*evaluator) VectorOr(lhs, rhs Vector, matching *parser.VectorMatching, lhsh, rhsh []EvalSeriesHelper, enh *EvalNodeHelper) Vector {
switch { switch {
case matching.Card != parser.CardManyToMany: case matching.Card != parser.CardManyToMany:
panic("set operations must only use many-to-many matching") panic("set operations must only use many-to-many matching")
@ -2613,7 +2613,7 @@ func (ev *evaluator) VectorOr(lhs, rhs Vector, matching *parser.VectorMatching,
return enh.Out return enh.Out
} }
func (ev *evaluator) VectorUnless(lhs, rhs Vector, matching *parser.VectorMatching, lhsh, rhsh []EvalSeriesHelper, enh *EvalNodeHelper) Vector { func (*evaluator) VectorUnless(lhs, rhs Vector, matching *parser.VectorMatching, lhsh, rhsh []EvalSeriesHelper, enh *EvalNodeHelper) Vector {
if matching.Card != parser.CardManyToMany { if matching.Card != parser.CardManyToMany {
panic("set operations must only use many-to-many matching") panic("set operations must only use many-to-many matching")
} }
@ -3523,7 +3523,7 @@ seriesLoop:
// aggregationCountValues evaluates count_values on vec. // aggregationCountValues evaluates count_values on vec.
// Outputs as many series per group as there are values in the input. // Outputs as many series per group as there are values in the input.
func (ev *evaluator) aggregationCountValues(e *parser.AggregateExpr, grouping []string, valueLabel string, vec Vector, enh *EvalNodeHelper) (Vector, annotations.Annotations) { func (*evaluator) aggregationCountValues(e *parser.AggregateExpr, grouping []string, valueLabel string, vec Vector, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
type groupCount struct { type groupCount struct {
labels labels.Labels labels labels.Labels
count int count int
@ -3607,7 +3607,7 @@ func addToSeries(ss *Series, ts int64, f float64, h *histogram.FloatHistogram, n
ss.Histograms = append(ss.Histograms, HPoint{T: ts, H: h}) ss.Histograms = append(ss.Histograms, HPoint{T: ts, H: h})
} }
func (ev *evaluator) nextValues(ts int64, series *Series) (f float64, h *histogram.FloatHistogram, b bool) { func (*evaluator) nextValues(ts int64, series *Series) (f float64, h *histogram.FloatHistogram, b bool) {
switch { switch {
case len(series.Floats) > 0 && series.Floats[0].T == ts: case len(series.Floats) > 0 && series.Floats[0].T == ts:
f = series.Floats[0].F f = series.Floats[0].F
@ -3922,7 +3922,7 @@ func NewHashRatioSampler() *HashRatioSampler {
return &HashRatioSampler{} return &HashRatioSampler{}
} }
func (s *HashRatioSampler) sampleOffset(_ int64, sample *Sample) float64 { func (*HashRatioSampler) sampleOffset(_ int64, sample *Sample) float64 {
const ( const (
float64MaxUint64 = float64(math.MaxUint64) float64MaxUint64 = float64(math.MaxUint64)
) )

View File

@ -253,7 +253,7 @@ type errSeriesSet struct {
func (errSeriesSet) Next() bool { return false } func (errSeriesSet) Next() bool { return false }
func (errSeriesSet) At() storage.Series { return nil } func (errSeriesSet) At() storage.Series { return nil }
func (e errSeriesSet) Err() error { return e.err } func (e errSeriesSet) Err() error { return e.err }
func (e errSeriesSet) Warnings() annotations.Annotations { return nil } func (errSeriesSet) Warnings() annotations.Annotations { return nil }
func TestQueryError(t *testing.T) { func TestQueryError(t *testing.T) {
opts := promql.EngineOpts{ opts := promql.EngineOpts{
@ -2282,7 +2282,7 @@ func TestQueryLogger_error(t *testing.T) {
ctx = promql.NewOriginContext(ctx, map[string]interface{}{"foo": "bar"}) ctx = promql.NewOriginContext(ctx, map[string]interface{}{"foo": "bar"})
defer cancelCtx() defer cancelCtx()
testErr := errors.New("failure") testErr := errors.New("failure")
query := engine.NewTestQuery(func(_ context.Context) error { query := engine.NewTestQuery(func(context.Context) error {
return testErr return testErr
}) })
@ -3790,7 +3790,7 @@ func TestHistogramRateWithFloatStaleness(t *testing.T) {
require.Nil(t, newc) require.Nil(t, newc)
querier := storage.MockQuerier{ querier := storage.MockQuerier{
SelectMockFunction: func(_ bool, _ *storage.SelectHints, _ ...*labels.Matcher) storage.SeriesSet { SelectMockFunction: func(bool, *storage.SelectHints, ...*labels.Matcher) storage.SeriesSet {
return &singleSeriesSet{ return &singleSeriesSet{
series: mockSeries{chunks: []chunkenc.Chunk{c1, c2, c3}, labelSet: []string{"__name__", "foo"}}, series: mockSeries{chunks: []chunkenc.Chunk{c1, c2, c3}, labelSet: []string{"__name__", "foo"}},
} }
@ -3827,8 +3827,8 @@ type singleSeriesSet struct {
func (s *singleSeriesSet) Next() bool { c := s.consumed; s.consumed = true; return !c } func (s *singleSeriesSet) Next() bool { c := s.consumed; s.consumed = true; return !c }
func (s singleSeriesSet) At() storage.Series { return s.series } func (s singleSeriesSet) At() storage.Series { return s.series }
func (s singleSeriesSet) Err() error { return nil } func (singleSeriesSet) Err() error { return nil }
func (s singleSeriesSet) Warnings() annotations.Annotations { return nil } func (singleSeriesSet) Warnings() annotations.Annotations { return nil }
type mockSeries struct { type mockSeries struct {
chunks []chunkenc.Chunk chunks []chunkenc.Chunk

View File

@ -1018,7 +1018,7 @@ func funcAbsentOverTime(_ []Vector, _ Matrix, _ parser.Expressions, enh *EvalNod
// === present_over_time(Vector parser.ValueTypeMatrix) (Vector, Annotations) === // === present_over_time(Vector parser.ValueTypeMatrix) (Vector, Annotations) ===
func funcPresentOverTime(_ []Vector, matrixVals Matrix, _ parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) { func funcPresentOverTime(_ []Vector, matrixVals Matrix, _ parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
return aggrOverTime(matrixVals, enh, func(_ Series) float64 { return aggrOverTime(matrixVals, enh, func(Series) float64 {
return 1 return 1
}), nil }), nil
} }
@ -1154,7 +1154,7 @@ func funcDeg(vectorVals []Vector, _ Matrix, _ parser.Expressions, enh *EvalNodeH
} }
// === pi() Scalar === // === pi() Scalar ===
func funcPi(_ []Vector, _ Matrix, _ parser.Expressions, _ *EvalNodeHelper) (Vector, annotations.Annotations) { func funcPi([]Vector, Matrix, parser.Expressions, *EvalNodeHelper) (Vector, annotations.Annotations) {
return Vector{Sample{F: math.Pi}}, nil return Vector{Sample{F: math.Pi}}, nil
} }

View File

@ -221,9 +221,9 @@ func newHistogramSeries(histograms []*histogram.Histogram) *histogramSeries {
} }
} }
func (m histogramSeries) Labels() labels.Labels { return labels.EmptyLabels() } func (histogramSeries) Labels() labels.Labels { return labels.EmptyLabels() }
func (m histogramSeries) Iterator(_ chunkenc.Iterator) chunkenc.Iterator { func (m histogramSeries) Iterator(chunkenc.Iterator) chunkenc.Iterator {
return &histogramIterator{ return &histogramIterator{
i: -1, i: -1,
histograms: m.histograms, histograms: m.histograms,
@ -243,18 +243,18 @@ func (h *histogramIterator) Next() chunkenc.ValueType {
return chunkenc.ValNone return chunkenc.ValNone
} }
func (h *histogramIterator) Seek(_ int64) chunkenc.ValueType { panic("not implemented") } func (*histogramIterator) Seek(int64) chunkenc.ValueType { panic("not implemented") }
func (h *histogramIterator) At() (int64, float64) { panic("not implemented") } func (*histogramIterator) At() (int64, float64) { panic("not implemented") }
func (h *histogramIterator) AtHistogram(_ *histogram.Histogram) (int64, *histogram.Histogram) { func (h *histogramIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) {
return 0, h.histograms[h.i] return 0, h.histograms[h.i]
} }
func (h *histogramIterator) AtFloatHistogram(_ *histogram.FloatHistogram) (int64, *histogram.FloatHistogram) { func (h *histogramIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) {
return 0, h.histograms[h.i].ToFloat(nil) return 0, h.histograms[h.i].ToFloat(nil)
} }
func (h *histogramIterator) AtT() int64 { return 0 } func (*histogramIterator) AtT() int64 { return 0 }
func (h *histogramIterator) Err() error { return nil } func (*histogramIterator) Err() error { return nil }

View File

@ -243,15 +243,15 @@ func (TestStmt) PositionRange() posrange.PositionRange {
End: -1, End: -1,
} }
} }
func (e *AggregateExpr) Type() ValueType { return ValueTypeVector } func (*AggregateExpr) Type() ValueType { return ValueTypeVector }
func (e *Call) Type() ValueType { return e.Func.ReturnType } func (e *Call) Type() ValueType { return e.Func.ReturnType }
func (e *MatrixSelector) Type() ValueType { return ValueTypeMatrix } func (*MatrixSelector) Type() ValueType { return ValueTypeMatrix }
func (e *SubqueryExpr) Type() ValueType { return ValueTypeMatrix } func (*SubqueryExpr) Type() ValueType { return ValueTypeMatrix }
func (e *NumberLiteral) Type() ValueType { return ValueTypeScalar } func (*NumberLiteral) Type() ValueType { return ValueTypeScalar }
func (e *ParenExpr) Type() ValueType { return e.Expr.Type() } func (e *ParenExpr) Type() ValueType { return e.Expr.Type() }
func (e *StringLiteral) Type() ValueType { return ValueTypeString } func (*StringLiteral) Type() ValueType { return ValueTypeString }
func (e *UnaryExpr) Type() ValueType { return e.Expr.Type() } func (e *UnaryExpr) Type() ValueType { return e.Expr.Type() }
func (e *VectorSelector) Type() ValueType { return ValueTypeVector } func (*VectorSelector) Type() ValueType { return ValueTypeVector }
func (e *BinaryExpr) Type() ValueType { func (e *BinaryExpr) Type() ValueType {
if e.LHS.Type() == ValueTypeScalar && e.RHS.Type() == ValueTypeScalar { if e.LHS.Type() == ValueTypeScalar && e.RHS.Type() == ValueTypeScalar {
return ValueTypeScalar return ValueTypeScalar
@ -259,7 +259,7 @@ func (e *BinaryExpr) Type() ValueType {
return ValueTypeVector return ValueTypeVector
} }
func (e *StepInvariantExpr) Type() ValueType { return e.Expr.Type() } func (e *StepInvariantExpr) Type() ValueType { return e.Expr.Type() }
func (e *DurationExpr) Type() ValueType { return ValueTypeScalar } func (*DurationExpr) Type() ValueType { return ValueTypeScalar }
func (*AggregateExpr) PromQLExpr() {} func (*AggregateExpr) PromQLExpr() {}
func (*BinaryExpr) PromQLExpr() {} func (*BinaryExpr) PromQLExpr() {}

View File

@ -334,7 +334,7 @@ func (p *parser) unexpected(context, expected string) {
var errUnexpected = errors.New("unexpected error") var errUnexpected = errors.New("unexpected error")
// recover is the handler that turns panics into returns from the top level of Parse. // recover is the handler that turns panics into returns from the top level of Parse.
func (p *parser) recover(errp *error) { func (*parser) recover(errp *error) {
e := recover() e := recover()
switch _, ok := e.(runtime.Error); { switch _, ok := e.(runtime.Error); {
case ok: case ok:
@ -402,7 +402,7 @@ func (p *parser) Lex(lval *yySymType) int {
// It is a no-op since the parsers error routines are triggered // It is a no-op since the parsers error routines are triggered
// by mechanisms that allow more fine-grained control // by mechanisms that allow more fine-grained control
// For more information, see https://pkg.go.dev/golang.org/x/tools/cmd/goyacc. // For more information, see https://pkg.go.dev/golang.org/x/tools/cmd/goyacc.
func (p *parser) Error(string) { func (*parser) Error(string) {
} }
// InjectItem allows injecting a single Item at the beginning of the token stream // InjectItem allows injecting a single Item at the beginning of the token stream
@ -425,7 +425,7 @@ func (p *parser) InjectItem(typ ItemType) {
p.injecting = true p.injecting = true
} }
func (p *parser) newBinaryExpression(lhs Node, op Item, modifiers, rhs Node) *BinaryExpr { func (*parser) newBinaryExpression(lhs Node, op Item, modifiers, rhs Node) *BinaryExpr {
ret := modifiers.(*BinaryExpr) ret := modifiers.(*BinaryExpr)
ret.LHS = lhs.(Expr) ret.LHS = lhs.(Expr)
@ -435,7 +435,7 @@ func (p *parser) newBinaryExpression(lhs Node, op Item, modifiers, rhs Node) *Bi
return ret return ret
} }
func (p *parser) assembleVectorSelector(vs *VectorSelector) { func (*parser) assembleVectorSelector(vs *VectorSelector) {
// If the metric name was set outside the braces, add a matcher for it. // If the metric name was set outside the braces, add a matcher for it.
// If the metric name was inside the braces we don't need to do anything. // If the metric name was inside the braces we don't need to do anything.
if vs.Name != "" { if vs.Name != "" {
@ -493,7 +493,7 @@ func (p *parser) newAggregateExpr(op Item, modifier, args Node) (ret *AggregateE
} }
// newMap is used when building the FloatHistogram from a map. // newMap is used when building the FloatHistogram from a map.
func (p *parser) newMap() (ret map[string]interface{}) { func (*parser) newMap() (ret map[string]interface{}) {
return map[string]interface{}{} return map[string]interface{}{}
} }
@ -522,7 +522,7 @@ func (p *parser) histogramsDecreaseSeries(base, inc *histogram.FloatHistogram, t
}) })
} }
func (p *parser) histogramsSeries(base, inc *histogram.FloatHistogram, times uint64, func (*parser) histogramsSeries(base, inc *histogram.FloatHistogram, times uint64,
combine func(*histogram.FloatHistogram, *histogram.FloatHistogram) (*histogram.FloatHistogram, error), combine func(*histogram.FloatHistogram, *histogram.FloatHistogram) (*histogram.FloatHistogram, error),
) ([]SequenceValue, error) { ) ([]SequenceValue, error) {
ret := make([]SequenceValue, times+1) ret := make([]SequenceValue, times+1)

View File

@ -105,7 +105,7 @@ func (e *Call) Pretty(level int) string {
return s return s
} }
func (e *EvalStmt) Pretty(_ int) string { func (e *EvalStmt) Pretty(int) string {
return "EVAL " + e.Expr.String() return "EVAL " + e.Expr.String()
} }

View File

@ -314,7 +314,7 @@ func validateExpectedCmds(cmd *evalCmd) error {
return nil return nil
} }
func (t *test) parseEval(lines []string, i int) (int, *evalCmd, error) { func (*test) parseEval(lines []string, i int) (int, *evalCmd, error) {
instantParts := patEvalInstant.FindStringSubmatch(lines[i]) instantParts := patEvalInstant.FindStringSubmatch(lines[i])
rangeParts := patEvalRange.FindStringSubmatch(lines[i]) rangeParts := patEvalRange.FindStringSubmatch(lines[i])
@ -532,7 +532,7 @@ func newLoadCmd(gap time.Duration, withNHCB bool) *loadCmd {
} }
} }
func (cmd loadCmd) String() string { func (loadCmd) String() string {
return "load" return "load"
} }
@ -795,7 +795,7 @@ func newRangeEvalCmd(expr string, start, end time.Time, step time.Duration, line
} }
} }
func (ev *evalCmd) String() string { func (*evalCmd) String() string {
return "eval" return "eval"
} }
@ -1195,7 +1195,7 @@ func HistogramTestExpression(h *histogram.FloatHistogram) string {
// clearCmd is a command that wipes the test's storage state. // clearCmd is a command that wipes the test's storage state.
type clearCmd struct{} type clearCmd struct{}
func (cmd clearCmd) String() string { func (clearCmd) String() string {
return "clear" return "clear"
} }

View File

@ -471,7 +471,7 @@ func (ssi *storageSeriesIterator) At() (t int64, v float64) {
return ssi.currT, ssi.currF return ssi.currT, ssi.currF
} }
func (ssi *storageSeriesIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) { func (*storageSeriesIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) {
panic(errors.New("storageSeriesIterator: AtHistogram not supported")) panic(errors.New("storageSeriesIterator: AtHistogram not supported"))
} }
@ -535,7 +535,7 @@ func (ssi *storageSeriesIterator) Next() chunkenc.ValueType {
} }
} }
func (ssi *storageSeriesIterator) Err() error { func (*storageSeriesIterator) Err() error {
return nil return nil
} }

View File

@ -109,7 +109,7 @@ func TestAlertingRuleTemplateWithHistogram(t *testing.T) {
NegativeBuckets: []float64{-2, 2, 2, 7, 5, 5, 2}, NegativeBuckets: []float64{-2, 2, 2, 7, 5, 5, 2},
} }
q := func(_ context.Context, _ string, _ time.Time) (promql.Vector, error) { q := func(context.Context, string, time.Time) (promql.Vector, error) {
return []promql.Sample{{H: &h}}, nil return []promql.Sample{{H: &h}}, nil
} }
@ -678,7 +678,7 @@ func TestQueryForStateSeries(t *testing.T) {
tests := []testInput{ tests := []testInput{
// Test for empty series. // Test for empty series.
{ {
selectMockFunction: func(_ bool, _ *storage.SelectHints, _ ...*labels.Matcher) storage.SeriesSet { selectMockFunction: func(bool, *storage.SelectHints, ...*labels.Matcher) storage.SeriesSet {
return storage.EmptySeriesSet() return storage.EmptySeriesSet()
}, },
expectedSeries: nil, expectedSeries: nil,
@ -686,7 +686,7 @@ func TestQueryForStateSeries(t *testing.T) {
}, },
// Test for error series. // Test for error series.
{ {
selectMockFunction: func(_ bool, _ *storage.SelectHints, _ ...*labels.Matcher) storage.SeriesSet { selectMockFunction: func(bool, *storage.SelectHints, ...*labels.Matcher) storage.SeriesSet {
return storage.ErrSeriesSet(testError) return storage.ErrSeriesSet(testError)
}, },
expectedSeries: nil, expectedSeries: nil,
@ -694,7 +694,7 @@ func TestQueryForStateSeries(t *testing.T) {
}, },
// Test for mock series. // Test for mock series.
{ {
selectMockFunction: func(_ bool, _ *storage.SelectHints, _ ...*labels.Matcher) storage.SeriesSet { selectMockFunction: func(bool, *storage.SelectHints, ...*labels.Matcher) storage.SeriesSet {
return storage.TestSeriesSet(storage.MockSeries( return storage.TestSeriesSet(storage.MockSeries(
[]int64{1, 2, 3}, []int64{1, 2, 3},
[]float64{1, 2, 3}, []float64{1, 2, 3},

View File

@ -465,7 +465,7 @@ type RuleDependencyController interface {
type ruleDependencyController struct{} type ruleDependencyController struct{}
// AnalyseRules implements RuleDependencyController. // AnalyseRules implements RuleDependencyController.
func (c ruleDependencyController) AnalyseRules(rules []Rule) { func (ruleDependencyController) AnalyseRules(rules []Rule) {
depMap := buildDependencyMap(rules) depMap := buildDependencyMap(rules)
if depMap == nil { if depMap == nil {
@ -509,11 +509,11 @@ func newRuleConcurrencyController(maxConcurrency int64) RuleConcurrencyControlle
} }
} }
func (c *concurrentRuleEvalController) Allow(_ context.Context, _ *Group, _ Rule) bool { func (c *concurrentRuleEvalController) Allow(context.Context, *Group, Rule) bool {
return c.sema.TryAcquire(1) return c.sema.TryAcquire(1)
} }
func (c *concurrentRuleEvalController) SplitGroupIntoBatches(_ context.Context, g *Group) []ConcurrentRules { func (*concurrentRuleEvalController) SplitGroupIntoBatches(_ context.Context, g *Group) []ConcurrentRules {
// Using the rule dependency controller information (rules being identified as having no dependencies or no dependants), // Using the rule dependency controller information (rules being identified as having no dependencies or no dependants),
// we can safely run the following concurrent groups: // we can safely run the following concurrent groups:
// 1. Concurrently, all rules that have no dependencies // 1. Concurrently, all rules that have no dependencies
@ -549,7 +549,7 @@ func (c *concurrentRuleEvalController) SplitGroupIntoBatches(_ context.Context,
return order return order
} }
func (c *concurrentRuleEvalController) Done(_ context.Context) { func (c *concurrentRuleEvalController) Done(context.Context) {
c.sema.Release(1) c.sema.Release(1)
} }
@ -558,15 +558,15 @@ var _ RuleConcurrencyController = &sequentialRuleEvalController{}
// sequentialRuleEvalController is a RuleConcurrencyController that runs every rule sequentially. // sequentialRuleEvalController is a RuleConcurrencyController that runs every rule sequentially.
type sequentialRuleEvalController struct{} type sequentialRuleEvalController struct{}
func (c sequentialRuleEvalController) Allow(_ context.Context, _ *Group, _ Rule) bool { func (sequentialRuleEvalController) Allow(context.Context, *Group, Rule) bool {
return false return false
} }
func (c sequentialRuleEvalController) SplitGroupIntoBatches(_ context.Context, _ *Group) []ConcurrentRules { func (sequentialRuleEvalController) SplitGroupIntoBatches(context.Context, *Group) []ConcurrentRules {
return nil return nil
} }
func (c sequentialRuleEvalController) Done(_ context.Context) {} func (sequentialRuleEvalController) Done(context.Context) {}
// FromMaps returns new sorted Labels from the given maps, overriding each other in order. // FromMaps returns new sorted Labels from the given maps, overriding each other in order.
func FromMaps(maps ...map[string]string) labels.Labels { func FromMaps(maps ...map[string]string) labels.Labels {

View File

@ -377,7 +377,7 @@ func TestForStateRestore(t *testing.T) {
Queryable: storage, Queryable: storage,
Context: context.Background(), Context: context.Background(),
Logger: promslog.NewNopLogger(), Logger: promslog.NewNopLogger(),
NotifyFunc: func(_ context.Context, _ string, _ ...*Alert) {}, NotifyFunc: func(context.Context, string, ...*Alert) {},
OutageTolerance: 30 * time.Minute, OutageTolerance: 30 * time.Minute,
ForGracePeriod: 10 * time.Minute, ForGracePeriod: 10 * time.Minute,
} }
@ -1355,7 +1355,7 @@ func TestRuleGroupEvalIterationFunc(t *testing.T) {
testValue = 3 testValue = 3
} }
skipEvalIterationFunc := func(_ context.Context, _ *Group, _ time.Time) { skipEvalIterationFunc := func(context.Context, *Group, time.Time) {
testValue = 4 testValue = 4
} }
@ -1394,7 +1394,7 @@ func TestRuleGroupEvalIterationFunc(t *testing.T) {
Queryable: storage, Queryable: storage,
Context: context.Background(), Context: context.Background(),
Logger: promslog.NewNopLogger(), Logger: promslog.NewNopLogger(),
NotifyFunc: func(_ context.Context, _ string, _ ...*Alert) {}, NotifyFunc: func(context.Context, string, ...*Alert) {},
OutageTolerance: 30 * time.Minute, OutageTolerance: 30 * time.Minute,
ForGracePeriod: 10 * time.Minute, ForGracePeriod: 10 * time.Minute,
} }
@ -1527,7 +1527,7 @@ func TestManager_LoadGroups_ShouldCheckWhetherEachRuleHasDependentsAndDependenci
Context: context.Background(), Context: context.Background(),
Logger: promslog.NewNopLogger(), Logger: promslog.NewNopLogger(),
Appendable: storage, Appendable: storage,
QueryFunc: func(_ context.Context, _ string, _ time.Time) (promql.Vector, error) { return nil, nil }, QueryFunc: func(context.Context, string, time.Time) (promql.Vector, error) { return nil, nil },
}) })
t.Run("load a mix of dependent and independent rules", func(t *testing.T) { t.Run("load a mix of dependent and independent rules", func(t *testing.T) {
@ -2299,11 +2299,11 @@ func TestNewRuleGroupRestoration(t *testing.T) {
option := optsFactory(store, &maxInflight, &inflightQueries, maxConcurrency) option := optsFactory(store, &maxInflight, &inflightQueries, maxConcurrency)
option.Queryable = store option.Queryable = store
option.Appendable = store option.Appendable = store
option.NotifyFunc = func(_ context.Context, _ string, _ ...*Alert) {} option.NotifyFunc = func(context.Context, string, ...*Alert) {}
var evalCount atomic.Int32 var evalCount atomic.Int32
ch := make(chan int32) ch := make(chan int32)
noopEvalIterFunc := func(_ context.Context, _ *Group, _ time.Time) { noopEvalIterFunc := func(context.Context, *Group, time.Time) {
evalCount.Inc() evalCount.Inc()
ch <- evalCount.Load() ch <- evalCount.Load()
} }
@ -2363,11 +2363,11 @@ func TestNewRuleGroupRestorationWithRestoreNewGroupOption(t *testing.T) {
option.Queryable = store option.Queryable = store
option.Appendable = store option.Appendable = store
option.RestoreNewRuleGroups = true option.RestoreNewRuleGroups = true
option.NotifyFunc = func(_ context.Context, _ string, _ ...*Alert) {} option.NotifyFunc = func(context.Context, string, ...*Alert) {}
var evalCount atomic.Int32 var evalCount atomic.Int32
ch := make(chan int32) ch := make(chan int32)
noopEvalIterFunc := func(_ context.Context, _ *Group, _ time.Time) { noopEvalIterFunc := func(context.Context, *Group, time.Time) {
evalCount.Inc() evalCount.Inc()
ch <- evalCount.Load() ch <- evalCount.Load()
} }
@ -2669,7 +2669,7 @@ func TestRuleDependencyController_AnalyseRules(t *testing.T) {
Context: context.Background(), Context: context.Background(),
Logger: promslog.NewNopLogger(), Logger: promslog.NewNopLogger(),
Appendable: storage, Appendable: storage,
QueryFunc: func(_ context.Context, _ string, _ time.Time) (promql.Vector, error) { return nil, nil }, QueryFunc: func(context.Context, string, time.Time) (promql.Vector, error) { return nil, nil },
}) })
groups, errs := ruleManager.LoadGroups(time.Second, labels.EmptyLabels(), "", nil, false, tc.ruleFile) groups, errs := ruleManager.LoadGroups(time.Second, labels.EmptyLabels(), "", nil, false, tc.ruleFile)
@ -2698,7 +2698,7 @@ func BenchmarkRuleDependencyController_AnalyseRules(b *testing.B) {
Context: context.Background(), Context: context.Background(),
Logger: promslog.NewNopLogger(), Logger: promslog.NewNopLogger(),
Appendable: storage, Appendable: storage,
QueryFunc: func(_ context.Context, _ string, _ time.Time) (promql.Vector, error) { return nil, nil }, QueryFunc: func(context.Context, string, time.Time) (promql.Vector, error) { return nil, nil },
}) })
groups, errs := ruleManager.LoadGroups(time.Second, labels.EmptyLabels(), "", nil, false, "fixtures/rules_multiple.yaml") groups, errs := ruleManager.LoadGroups(time.Second, labels.EmptyLabels(), "", nil, false, "fixtures/rules_multiple.yaml")

View File

@ -29,27 +29,27 @@ import (
type unknownRule struct{} type unknownRule struct{}
func (u unknownRule) Name() string { return "" } func (unknownRule) Name() string { return "" }
func (u unknownRule) Labels() labels.Labels { return labels.EmptyLabels() } func (unknownRule) Labels() labels.Labels { return labels.EmptyLabels() }
func (u unknownRule) Eval(context.Context, time.Duration, time.Time, QueryFunc, *url.URL, int) (promql.Vector, error) { func (unknownRule) Eval(context.Context, time.Duration, time.Time, QueryFunc, *url.URL, int) (promql.Vector, error) {
return nil, nil return nil, nil
} }
func (u unknownRule) String() string { return "" } func (unknownRule) String() string { return "" }
func (u unknownRule) Query() parser.Expr { return nil } func (unknownRule) Query() parser.Expr { return nil }
func (u unknownRule) SetLastError(error) {} func (unknownRule) SetLastError(error) {}
func (u unknownRule) LastError() error { return nil } func (unknownRule) LastError() error { return nil }
func (u unknownRule) SetHealth(RuleHealth) {} func (unknownRule) SetHealth(RuleHealth) {}
func (u unknownRule) Health() RuleHealth { return "" } func (unknownRule) Health() RuleHealth { return "" }
func (u unknownRule) SetEvaluationDuration(time.Duration) {} func (unknownRule) SetEvaluationDuration(time.Duration) {}
func (u unknownRule) GetEvaluationDuration() time.Duration { return 0 } func (unknownRule) GetEvaluationDuration() time.Duration { return 0 }
func (u unknownRule) SetEvaluationTimestamp(time.Time) {} func (unknownRule) SetEvaluationTimestamp(time.Time) {}
func (u unknownRule) GetEvaluationTimestamp() time.Time { return time.Time{} } func (unknownRule) GetEvaluationTimestamp() time.Time { return time.Time{} }
func (u unknownRule) SetDependentRules([]Rule) {} func (unknownRule) SetDependentRules([]Rule) {}
func (u unknownRule) NoDependentRules() bool { return false } func (unknownRule) NoDependentRules() bool { return false }
func (u unknownRule) DependentRules() []Rule { return nil } func (unknownRule) DependentRules() []Rule { return nil }
func (u unknownRule) SetDependencyRules([]Rule) {} func (unknownRule) SetDependencyRules([]Rule) {}
func (u unknownRule) NoDependencyRules() bool { return false } func (unknownRule) NoDependencyRules() bool { return false }
func (u unknownRule) DependencyRules() []Rule { return nil } func (unknownRule) DependencyRules() []Rule { return nil }
func TestNewRuleDetailPanics(t *testing.T) { func TestNewRuleDetailPanics(t *testing.T) {
require.PanicsWithValue(t, `unknown rule type "rules.unknownRule"`, func() { require.PanicsWithValue(t, `unknown rule type "rules.unknownRule"`, func() {

View File

@ -37,40 +37,40 @@ import (
type nopAppendable struct{} type nopAppendable struct{}
func (a nopAppendable) Appender(_ context.Context) storage.Appender { func (nopAppendable) Appender(context.Context) storage.Appender {
return nopAppender{} return nopAppender{}
} }
type nopAppender struct{} type nopAppender struct{}
func (a nopAppender) SetOptions(_ *storage.AppendOptions) {} func (nopAppender) SetOptions(*storage.AppendOptions) {}
func (a nopAppender) Append(storage.SeriesRef, labels.Labels, int64, float64) (storage.SeriesRef, error) { func (nopAppender) Append(storage.SeriesRef, labels.Labels, int64, float64) (storage.SeriesRef, error) {
return 1, nil return 1, nil
} }
func (a nopAppender) AppendExemplar(storage.SeriesRef, labels.Labels, exemplar.Exemplar) (storage.SeriesRef, error) { func (nopAppender) AppendExemplar(storage.SeriesRef, labels.Labels, exemplar.Exemplar) (storage.SeriesRef, error) {
return 2, nil return 2, nil
} }
func (a nopAppender) AppendHistogram(storage.SeriesRef, labels.Labels, int64, *histogram.Histogram, *histogram.FloatHistogram) (storage.SeriesRef, error) { func (nopAppender) AppendHistogram(storage.SeriesRef, labels.Labels, int64, *histogram.Histogram, *histogram.FloatHistogram) (storage.SeriesRef, error) {
return 3, nil return 3, nil
} }
func (a nopAppender) AppendHistogramCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64, _ *histogram.Histogram, _ *histogram.FloatHistogram) (storage.SeriesRef, error) { func (nopAppender) AppendHistogramCTZeroSample(storage.SeriesRef, labels.Labels, int64, int64, *histogram.Histogram, *histogram.FloatHistogram) (storage.SeriesRef, error) {
return 0, nil return 0, nil
} }
func (a nopAppender) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error) { func (nopAppender) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error) {
return 4, nil return 4, nil
} }
func (a nopAppender) AppendCTZeroSample(storage.SeriesRef, labels.Labels, int64, int64) (storage.SeriesRef, error) { func (nopAppender) AppendCTZeroSample(storage.SeriesRef, labels.Labels, int64, int64) (storage.SeriesRef, error) {
return 5, nil return 5, nil
} }
func (a nopAppender) Commit() error { return nil } func (nopAppender) Commit() error { return nil }
func (a nopAppender) Rollback() error { return nil } func (nopAppender) Rollback() error { return nil }
type floatSample struct { type floatSample struct {
metric labels.Labels metric labels.Labels
@ -115,7 +115,7 @@ type collectResultAppendable struct {
*collectResultAppender *collectResultAppender
} }
func (a *collectResultAppendable) Appender(_ context.Context) storage.Appender { func (a *collectResultAppendable) Appender(context.Context) storage.Appender {
return a return a
} }
@ -137,7 +137,7 @@ type collectResultAppender struct {
pendingMetadata []metadataEntry pendingMetadata []metadataEntry
} }
func (a *collectResultAppender) SetOptions(_ *storage.AppendOptions) {} func (*collectResultAppender) SetOptions(*storage.AppendOptions) {}
func (a *collectResultAppender) Append(ref storage.SeriesRef, lset labels.Labels, t int64, v float64) (storage.SeriesRef, error) { func (a *collectResultAppender) Append(ref storage.SeriesRef, lset labels.Labels, t int64, v float64) (storage.SeriesRef, error) {
a.mtx.Lock() a.mtx.Lock()

View File

@ -474,7 +474,7 @@ func (sp *scrapePool) Sync(tgs []*targetgroup.Group) {
for _, t := range targets { for _, t := range targets {
// Replicate .Labels().IsEmpty() with a loop here to avoid generating garbage. // Replicate .Labels().IsEmpty() with a loop here to avoid generating garbage.
nonEmpty := false nonEmpty := false
t.LabelsRange(func(_ labels.Label) { nonEmpty = true }) t.LabelsRange(func(labels.Label) { nonEmpty = true })
switch { switch {
case nonEmpty: case nonEmpty:
all = append(all, t) all = append(all, t)

View File

@ -127,7 +127,7 @@ func runScrapeLoopTest(t *testing.T, s *teststorage.TestStorage, expectOutOfOrde
// Create an appender for adding samples to the storage. // Create an appender for adding samples to the storage.
app := s.Appender(context.Background()) app := s.Appender(context.Background())
capp := &collectResultAppender{next: app} capp := &collectResultAppender{next: app}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return capp }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return capp }, 0)
// Current time for generating timestamps. // Current time for generating timestamps.
now := time.Now() now := time.Now()
@ -222,7 +222,7 @@ test_metric2{foo="bar"} 22
// Create an appender for adding samples to the storage. // Create an appender for adding samples to the storage.
capp := &collectResultAppender{next: nopAppender{}} capp := &collectResultAppender{next: nopAppender{}}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return capp }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return capp }, 0)
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -256,12 +256,12 @@ type nopScraper struct {
scraper scraper
} }
func (n nopScraper) Report(_ time.Time, _ time.Duration, _ error) {} func (nopScraper) Report(time.Time, time.Duration, error) {}
func TestScrapeReportMetadataUpdate(t *testing.T) { func TestScrapeReportMetadataUpdate(t *testing.T) {
// Create an appender for adding samples to the storage. // Create an appender for adding samples to the storage.
capp := &collectResultAppender{next: nopAppender{}} capp := &collectResultAppender{next: nopAppender{}}
sl := newBasicScrapeLoop(t, context.Background(), nopScraper{}, func(_ context.Context) storage.Appender { return capp }, 0) sl := newBasicScrapeLoop(t, context.Background(), nopScraper{}, func(context.Context) storage.Appender { return capp }, 0)
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -407,7 +407,7 @@ type testLoop struct {
timeout time.Duration timeout time.Duration
} }
func (l *testLoop) setScrapeFailureLogger(FailureLogger) { func (*testLoop) setScrapeFailureLogger(FailureLogger) {
} }
func (l *testLoop) run(errc chan<- error) { func (l *testLoop) run(errc chan<- error) {
@ -418,7 +418,7 @@ func (l *testLoop) run(errc chan<- error) {
l.startFunc(l.interval, l.timeout, errc) l.startFunc(l.interval, l.timeout, errc)
} }
func (l *testLoop) disableEndOfRunStalenessMarkers() { func (*testLoop) disableEndOfRunStalenessMarkers() {
} }
func (l *testLoop) setForcedError(err error) { func (l *testLoop) setForcedError(err error) {
@ -437,7 +437,7 @@ func (l *testLoop) stop() {
l.stopFunc() l.stopFunc()
} }
func (l *testLoop) getCache() *scrapeCache { func (*testLoop) getCache() *scrapeCache {
return nil return nil
} }
@ -666,7 +666,7 @@ func TestScrapePoolTargetLimit(t *testing.T) {
var wg sync.WaitGroup var wg sync.WaitGroup
// On starting to run, new loops created on reload check whether their preceding // On starting to run, new loops created on reload check whether their preceding
// equivalents have been stopped. // equivalents have been stopped.
newLoop := func(_ scrapeLoopOptions) loop { newLoop := func(scrapeLoopOptions) loop {
wg.Add(1) wg.Add(1)
l := &testLoop{ l := &testLoop{
startFunc: func(_, _ time.Duration, _ chan<- error) { startFunc: func(_, _ time.Duration, _ chan<- error) {
@ -909,7 +909,7 @@ func TestScrapePoolRaces(t *testing.T) {
func TestScrapePoolScrapeLoopsStarted(t *testing.T) { func TestScrapePoolScrapeLoopsStarted(t *testing.T) {
var wg sync.WaitGroup var wg sync.WaitGroup
newLoop := func(_ scrapeLoopOptions) loop { newLoop := func(scrapeLoopOptions) loop {
wg.Add(1) wg.Add(1)
l := &testLoop{ l := &testLoop{
startFunc: func(_, _ time.Duration, _ chan<- error) { startFunc: func(_, _ time.Duration, _ chan<- error) {
@ -1051,7 +1051,7 @@ func TestScrapeLoopStop(t *testing.T) {
signal = make(chan struct{}, 1) signal = make(chan struct{}, 1)
appender = &collectResultAppender{} appender = &collectResultAppender{}
scraper = &testScraper{} scraper = &testScraper{}
app = func(_ context.Context) storage.Appender { return appender } app = func(context.Context) storage.Appender { return appender }
) )
// Since we're writing samples directly below we need to provide a protocol fallback. // Since we're writing samples directly below we need to provide a protocol fallback.
@ -1107,7 +1107,7 @@ func TestScrapeLoopRun(t *testing.T) {
errc = make(chan error) errc = make(chan error)
scraper = &testScraper{} scraper = &testScraper{}
app = func(_ context.Context) storage.Appender { return &nopAppender{} } app = func(context.Context) storage.Appender { return &nopAppender{} }
scrapeMetrics = newTestScrapeMetrics(t) scrapeMetrics = newTestScrapeMetrics(t)
) )
@ -1217,7 +1217,7 @@ func TestScrapeLoopForcedErr(t *testing.T) {
errc = make(chan error) errc = make(chan error)
scraper = &testScraper{} scraper = &testScraper{}
app = func(_ context.Context) storage.Appender { return &nopAppender{} } app = func(context.Context) storage.Appender { return &nopAppender{} }
) )
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
@ -1266,7 +1266,7 @@ func TestScrapeLoopMetadata(t *testing.T) {
nil, nil, nil, nil,
nopMutator, nopMutator,
nopMutator, nopMutator,
func(_ context.Context) storage.Appender { return nopAppender{} }, func(context.Context) storage.Appender { return nopAppender{} },
cache, cache,
labels.NewSymbolTable(), labels.NewSymbolTable(),
0, 0,
@ -1584,7 +1584,7 @@ func TestSetOptionsHandlingStaleness(t *testing.T) {
// Wait a bit then start a new target. // Wait a bit then start a new target.
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
go func() { go func() {
runScrapeLoop(ctx, t, 4, func(_ *scrapeLoop) { runScrapeLoop(ctx, t, 4, func(*scrapeLoop) {
cancel() cancel()
}) })
signal <- struct{}{} signal <- struct{}{}
@ -1636,7 +1636,7 @@ func TestScrapeLoopRunCreatesStaleMarkersOnFailedScrape(t *testing.T) {
var ( var (
signal = make(chan struct{}, 1) signal = make(chan struct{}, 1)
scraper = &testScraper{} scraper = &testScraper{}
app = func(_ context.Context) storage.Appender { return appender } app = func(context.Context) storage.Appender { return appender }
) )
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
@ -1682,7 +1682,7 @@ func TestScrapeLoopRunCreatesStaleMarkersOnParseFailure(t *testing.T) {
var ( var (
signal = make(chan struct{}, 1) signal = make(chan struct{}, 1)
scraper = &testScraper{} scraper = &testScraper{}
app = func(_ context.Context) storage.Appender { return appender } app = func(context.Context) storage.Appender { return appender }
numScrapes = 0 numScrapes = 0
) )
@ -1798,7 +1798,7 @@ func TestScrapeLoopCacheMemoryExhaustionProtection(t *testing.T) {
var ( var (
signal = make(chan struct{}, 1) signal = make(chan struct{}, 1)
scraper = &testScraper{} scraper = &testScraper{}
app = func(_ context.Context) storage.Appender { return appender } app = func(context.Context) storage.Appender { return appender }
) )
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
@ -1894,7 +1894,7 @@ func TestScrapeLoopAppend(t *testing.T) {
labels: labels.FromStrings(test.discoveryLabels...), labels: labels.FromStrings(test.discoveryLabels...),
} }
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
return mutateSampleLabels(l, discoveryLabels, test.honorLabels, nil) return mutateSampleLabels(l, discoveryLabels, test.honorLabels, nil)
} }
@ -1982,7 +1982,7 @@ func TestScrapeLoopAppendForConflictingPrefixedLabels(t *testing.T) {
for name, tc := range testcases { for name, tc := range testcases {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
return mutateSampleLabels(l, &Target{labels: labels.FromStrings(tc.targetLabels...)}, false, nil) return mutateSampleLabels(l, &Target{labels: labels.FromStrings(tc.targetLabels...)}, false, nil)
} }
@ -2006,7 +2006,7 @@ func TestScrapeLoopAppendForConflictingPrefixedLabels(t *testing.T) {
func TestScrapeLoopAppendCacheEntryButErrNotFound(t *testing.T) { func TestScrapeLoopAppendCacheEntryButErrNotFound(t *testing.T) {
// collectResultAppender's AddFast always returns ErrNotFound if we don't give it a next. // collectResultAppender's AddFast always returns ErrNotFound if we don't give it a next.
app := &collectResultAppender{} app := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
fakeRef := storage.SeriesRef(1) fakeRef := storage.SeriesRef(1)
expValue := float64(1) expValue := float64(1)
@ -2044,7 +2044,7 @@ func TestScrapeLoopAppendSampleLimit(t *testing.T) {
resApp := &collectResultAppender{} resApp := &collectResultAppender{}
app := &limitAppender{Appender: resApp, limit: 1} app := &limitAppender{Appender: resApp, limit: 1}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
if l.Has("deleteme") { if l.Has("deleteme") {
return labels.EmptyLabels() return labels.EmptyLabels()
@ -2103,7 +2103,7 @@ func TestScrapeLoop_HistogramBucketLimit(t *testing.T) {
resApp := &collectResultAppender{} resApp := &collectResultAppender{}
app := &bucketLimitAppender{Appender: resApp, limit: 2} app := &bucketLimitAppender{Appender: resApp, limit: 2}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.enableNativeHistogramIngestion = true sl.enableNativeHistogramIngestion = true
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
if l.Has("deleteme") { if l.Has("deleteme") {
@ -2215,7 +2215,7 @@ func TestScrapeLoop_ChangingMetricString(t *testing.T) {
defer s.Close() defer s.Close()
capp := &collectResultAppender{} capp := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return capp }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return capp }, 0)
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -2247,7 +2247,7 @@ func TestScrapeLoopAppendFailsWithNoContentType(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
// Explicitly setting the lack of fallback protocol here to make it obvious. // Explicitly setting the lack of fallback protocol here to make it obvious.
sl := newBasicScrapeLoopWithFallback(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0, "") sl := newBasicScrapeLoopWithFallback(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0, "")
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -2261,7 +2261,7 @@ func TestScrapeLoopAppendEmptyWithNoContentType(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
// Explicitly setting the lack of fallback protocol here to make it obvious. // Explicitly setting the lack of fallback protocol here to make it obvious.
sl := newBasicScrapeLoopWithFallback(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0, "") sl := newBasicScrapeLoopWithFallback(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0, "")
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -2273,7 +2273,7 @@ func TestScrapeLoopAppendEmptyWithNoContentType(t *testing.T) {
func TestScrapeLoopAppendStaleness(t *testing.T) { func TestScrapeLoopAppendStaleness(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -2303,7 +2303,7 @@ func TestScrapeLoopAppendStaleness(t *testing.T) {
func TestScrapeLoopAppendNoStalenessIfTimestamp(t *testing.T) { func TestScrapeLoopAppendNoStalenessIfTimestamp(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
_, _, _, err := sl.append(slApp, []byte("metric_a 1 1000\n"), "text/plain", now) _, _, _, err := sl.append(slApp, []byte("metric_a 1 1000\n"), "text/plain", now)
@ -2327,7 +2327,7 @@ func TestScrapeLoopAppendNoStalenessIfTimestamp(t *testing.T) {
func TestScrapeLoopAppendStalenessIfTrackTimestampStaleness(t *testing.T) { func TestScrapeLoopAppendStalenessIfTrackTimestampStaleness(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.trackTimestampsStaleness = true sl.trackTimestampsStaleness = true
now := time.Now() now := time.Now()
@ -2856,7 +2856,7 @@ metric: <
labels: labels.FromStrings(test.discoveryLabels...), labels: labels.FromStrings(test.discoveryLabels...),
} }
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.enableNativeHistogramIngestion = test.enableNativeHistogramsIngestion sl.enableNativeHistogramIngestion = test.enableNativeHistogramsIngestion
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
return mutateSampleLabels(l, discoveryLabels, false, nil) return mutateSampleLabels(l, discoveryLabels, false, nil)
@ -2940,7 +2940,7 @@ func TestScrapeLoopAppendExemplarSeries(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
return mutateSampleLabels(l, discoveryLabels, false, nil) return mutateSampleLabels(l, discoveryLabels, false, nil)
} }
@ -2977,13 +2977,13 @@ func TestScrapeLoopRunReportsTargetDownOnScrapeError(t *testing.T) {
var ( var (
scraper = &testScraper{} scraper = &testScraper{}
appender = &collectResultAppender{} appender = &collectResultAppender{}
app = func(_ context.Context) storage.Appender { return appender } app = func(context.Context) storage.Appender { return appender }
) )
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
sl := newBasicScrapeLoop(t, ctx, scraper, app, 10*time.Millisecond) sl := newBasicScrapeLoop(t, ctx, scraper, app, 10*time.Millisecond)
scraper.scrapeFunc = func(_ context.Context, _ io.Writer) error { scraper.scrapeFunc = func(context.Context, io.Writer) error {
cancel() cancel()
return errors.New("scrape failed") return errors.New("scrape failed")
} }
@ -2996,7 +2996,7 @@ func TestScrapeLoopRunReportsTargetDownOnInvalidUTF8(t *testing.T) {
var ( var (
scraper = &testScraper{} scraper = &testScraper{}
appender = &collectResultAppender{} appender = &collectResultAppender{}
app = func(_ context.Context) storage.Appender { return appender } app = func(context.Context) storage.Appender { return appender }
) )
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
@ -3031,7 +3031,7 @@ func (app *errorAppender) Append(ref storage.SeriesRef, lset labels.Labels, t in
func TestScrapeLoopAppendGracefullyIfAmendOrOutOfOrderOrOutOfBounds(t *testing.T) { func TestScrapeLoopAppendGracefullyIfAmendOrOutOfOrderOrOutOfBounds(t *testing.T) {
app := &errorAppender{} app := &errorAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
now := time.Unix(1, 0) now := time.Unix(1, 0)
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -3055,7 +3055,7 @@ func TestScrapeLoopAppendGracefullyIfAmendOrOutOfOrderOrOutOfBounds(t *testing.T
func TestScrapeLoopOutOfBoundsTimeError(t *testing.T) { func TestScrapeLoopOutOfBoundsTimeError(t *testing.T) {
app := &collectResultAppender{} app := &collectResultAppender{}
sl := newBasicScrapeLoop(t, context.Background(), nil, sl := newBasicScrapeLoop(t, context.Background(), nil,
func(_ context.Context) storage.Appender { func(context.Context) storage.Appender {
return &timeLimitAppender{ return &timeLimitAppender{
Appender: app, Appender: app,
maxTime: timestamp.FromTime(time.Now().Add(10 * time.Minute)), maxTime: timestamp.FromTime(time.Now().Add(10 * time.Minute)),
@ -3290,7 +3290,7 @@ func TestTargetScrapeScrapeCancel(t *testing.T) {
block := make(chan struct{}) block := make(chan struct{})
server := httptest.NewServer( server := httptest.NewServer(
http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) { http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
<-block <-block
}), }),
) )
@ -3472,7 +3472,7 @@ func (ts *testScraper) Report(start time.Time, duration time.Duration, err error
ts.lastError = err ts.lastError = err
} }
func (ts *testScraper) scrape(_ context.Context) (*http.Response, error) { func (ts *testScraper) scrape(context.Context) (*http.Response, error) {
return nil, ts.scrapeErr return nil, ts.scrapeErr
} }
@ -3489,7 +3489,7 @@ func TestScrapeLoop_RespectTimestamps(t *testing.T) {
app := s.Appender(context.Background()) app := s.Appender(context.Background())
capp := &collectResultAppender{next: app} capp := &collectResultAppender{next: app}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return capp }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return capp }, 0)
now := time.Now() now := time.Now()
slApp := sl.appender(context.Background()) slApp := sl.appender(context.Background())
@ -3515,7 +3515,7 @@ func TestScrapeLoop_DiscardTimestamps(t *testing.T) {
capp := &collectResultAppender{next: app} capp := &collectResultAppender{next: app}
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return capp }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return capp }, 0)
sl.honorTimestamps = false sl.honorTimestamps = false
now := time.Now() now := time.Now()
@ -3578,7 +3578,7 @@ func TestScrapeLoopDiscardUnnamedMetrics(t *testing.T) {
app := s.Appender(context.Background()) app := s.Appender(context.Background())
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
sl := newBasicScrapeLoop(t, context.Background(), &testScraper{}, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), &testScraper{}, func(context.Context) storage.Appender { return app }, 0)
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
if l.Has("drop") { if l.Has("drop") {
return labels.FromStrings("no", "name") // This label set will trigger an error. return labels.FromStrings("no", "name") // This label set will trigger an error.
@ -4150,7 +4150,7 @@ func TestScrapeLoopLabelLimit(t *testing.T) {
labels: labels.FromStrings(test.discoveryLabels...), labels: labels.FromStrings(test.discoveryLabels...),
} }
sl := newBasicScrapeLoop(t, context.Background(), nil, func(_ context.Context) storage.Appender { return app }, 0) sl := newBasicScrapeLoop(t, context.Background(), nil, func(context.Context) storage.Appender { return app }, 0)
sl.sampleMutator = func(l labels.Labels) labels.Labels { sl.sampleMutator = func(l labels.Labels) labels.Labels {
return mutateSampleLabels(l, discoveryLabels, false, nil) return mutateSampleLabels(l, discoveryLabels, false, nil)
} }
@ -4944,7 +4944,7 @@ func TestScrapeLoopRunCreatesStaleMarkersOnFailedScrapeForTimestampedMetrics(t *
var ( var (
signal = make(chan struct{}, 1) signal = make(chan struct{}, 1)
scraper = &testScraper{} scraper = &testScraper{}
app = func(_ context.Context) storage.Appender { return appender } app = func(context.Context) storage.Appender { return appender }
) )
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())

View File

@ -175,15 +175,15 @@ func (s fSample) F() float64 {
return s.f return s.f
} }
func (s fSample) H() *histogram.Histogram { func (fSample) H() *histogram.Histogram {
panic("H() called for fSample") panic("H() called for fSample")
} }
func (s fSample) FH() *histogram.FloatHistogram { func (fSample) FH() *histogram.FloatHistogram {
panic("FH() called for fSample") panic("FH() called for fSample")
} }
func (s fSample) Type() chunkenc.ValueType { func (fSample) Type() chunkenc.ValueType {
return chunkenc.ValFloat return chunkenc.ValFloat
} }
@ -200,7 +200,7 @@ func (s hSample) T() int64 {
return s.t return s.t
} }
func (s hSample) F() float64 { func (hSample) F() float64 {
panic("F() called for hSample") panic("F() called for hSample")
} }
@ -212,7 +212,7 @@ func (s hSample) FH() *histogram.FloatHistogram {
return s.h.ToFloat(nil) return s.h.ToFloat(nil)
} }
func (s hSample) Type() chunkenc.ValueType { func (hSample) Type() chunkenc.ValueType {
return chunkenc.ValHistogram return chunkenc.ValHistogram
} }
@ -229,11 +229,11 @@ func (s fhSample) T() int64 {
return s.t return s.t
} }
func (s fhSample) F() float64 { func (fhSample) F() float64 {
panic("F() called for fhSample") panic("F() called for fhSample")
} }
func (s fhSample) H() *histogram.Histogram { func (fhSample) H() *histogram.Histogram {
panic("H() called for fhSample") panic("H() called for fhSample")
} }
@ -241,7 +241,7 @@ func (s fhSample) FH() *histogram.FloatHistogram {
return s.fh return s.fh
} }
func (s fhSample) Type() chunkenc.ValueType { func (fhSample) Type() chunkenc.ValueType {
return chunkenc.ValFloatHistogram return chunkenc.ValFloatHistogram
} }

View File

@ -390,15 +390,15 @@ func (m *mockSeriesIterator) At() (int64, float64) { return m.at() }
func (m *mockSeriesIterator) Next() chunkenc.ValueType { return m.next() } func (m *mockSeriesIterator) Next() chunkenc.ValueType { return m.next() }
func (m *mockSeriesIterator) Err() error { return m.err() } func (m *mockSeriesIterator) Err() error { return m.err() }
func (m *mockSeriesIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) { func (*mockSeriesIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) {
return 0, nil // Not really mocked. return 0, nil // Not really mocked.
} }
func (m *mockSeriesIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) { func (*mockSeriesIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) {
return 0, nil // Not really mocked. return 0, nil // Not really mocked.
} }
func (m *mockSeriesIterator) AtT() int64 { func (*mockSeriesIterator) AtT() int64 {
return 0 // Not really mocked. return 0 // Not really mocked.
} }
@ -444,4 +444,4 @@ func (it *fakeSeriesIterator) Seek(t int64) chunkenc.ValueType {
return chunkenc.ValFloat return chunkenc.ValFloat
} }
func (it *fakeSeriesIterator) Err() error { return nil } func (*fakeSeriesIterator) Err() error { return nil }

View File

@ -224,7 +224,7 @@ type errChunkQuerier struct{ errQuerier }
func (errStorage) ChunkQuerier(_, _ int64) (storage.ChunkQuerier, error) { func (errStorage) ChunkQuerier(_, _ int64) (storage.ChunkQuerier, error) {
return errChunkQuerier{}, nil return errChunkQuerier{}, nil
} }
func (errStorage) Appender(_ context.Context) storage.Appender { return nil } func (errStorage) Appender(context.Context) storage.Appender { return nil }
func (errStorage) StartTime() (int64, error) { return 0, nil } func (errStorage) StartTime() (int64, error) { return 0, nil }
func (errStorage) Close() error { return nil } func (errStorage) Close() error { return nil }

View File

@ -125,15 +125,15 @@ type MockQuerier struct {
SelectMockFunction func(sortSeries bool, hints *SelectHints, matchers ...*labels.Matcher) SeriesSet SelectMockFunction func(sortSeries bool, hints *SelectHints, matchers ...*labels.Matcher) SeriesSet
} }
func (q *MockQuerier) LabelValues(context.Context, string, *LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) { func (*MockQuerier) LabelValues(context.Context, string, *LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) {
return nil, nil, nil return nil, nil, nil
} }
func (q *MockQuerier) LabelNames(context.Context, *LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) { func (*MockQuerier) LabelNames(context.Context, *LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) {
return nil, nil, nil return nil, nil, nil
} }
func (q *MockQuerier) Close() error { func (*MockQuerier) Close() error {
return nil return nil
} }
@ -408,10 +408,10 @@ type testSeriesSet struct {
series Series series Series
} }
func (s testSeriesSet) Next() bool { return true } func (testSeriesSet) Next() bool { return true }
func (s testSeriesSet) At() Series { return s.series } func (s testSeriesSet) At() Series { return s.series }
func (s testSeriesSet) Err() error { return nil } func (testSeriesSet) Err() error { return nil }
func (s testSeriesSet) Warnings() annotations.Annotations { return nil } func (testSeriesSet) Warnings() annotations.Annotations { return nil }
// TestSeriesSet returns a mock series set. // TestSeriesSet returns a mock series set.
func TestSeriesSet(series Series) SeriesSet { func TestSeriesSet(series Series) SeriesSet {
@ -422,10 +422,10 @@ type errSeriesSet struct {
err error err error
} }
func (s errSeriesSet) Next() bool { return false } func (errSeriesSet) Next() bool { return false }
func (s errSeriesSet) At() Series { return nil } func (errSeriesSet) At() Series { return nil }
func (s errSeriesSet) Err() error { return s.err } func (s errSeriesSet) Err() error { return s.err }
func (s errSeriesSet) Warnings() annotations.Annotations { return nil } func (errSeriesSet) Warnings() annotations.Annotations { return nil }
// ErrSeriesSet returns a series set that wraps an error. // ErrSeriesSet returns a series set that wraps an error.
func ErrSeriesSet(err error) SeriesSet { func ErrSeriesSet(err error) SeriesSet {
@ -443,10 +443,10 @@ type errChunkSeriesSet struct {
err error err error
} }
func (s errChunkSeriesSet) Next() bool { return false } func (errChunkSeriesSet) Next() bool { return false }
func (s errChunkSeriesSet) At() ChunkSeries { return nil } func (errChunkSeriesSet) At() ChunkSeries { return nil }
func (s errChunkSeriesSet) Err() error { return s.err } func (s errChunkSeriesSet) Err() error { return s.err }
func (s errChunkSeriesSet) Warnings() annotations.Annotations { return nil } func (errChunkSeriesSet) Warnings() annotations.Annotations { return nil }
// ErrChunkSeriesSet returns a chunk series set that wraps an error. // ErrChunkSeriesSet returns a chunk series set that wraps an error.
func ErrChunkSeriesSet(err error) ChunkSeriesSet { func ErrChunkSeriesSet(err error) ChunkSeriesSet {

View File

@ -1053,9 +1053,9 @@ func (m *mockChunkSeriesSet) Next() bool {
func (m *mockChunkSeriesSet) At() ChunkSeries { return m.series[m.idx] } func (m *mockChunkSeriesSet) At() ChunkSeries { return m.series[m.idx] }
func (m *mockChunkSeriesSet) Err() error { return nil } func (*mockChunkSeriesSet) Err() error { return nil }
func (m *mockChunkSeriesSet) Warnings() annotations.Annotations { return nil } func (*mockChunkSeriesSet) Warnings() annotations.Annotations { return nil }
func TestChainSampleIterator(t *testing.T) { func TestChainSampleIterator(t *testing.T) {
for sampleType, sampleFunc := range map[string]func(int64) chunks.Sample{ for sampleType, sampleFunc := range map[string]func(int64) chunks.Sample{
@ -1409,7 +1409,7 @@ func BenchmarkMergeLabelValuesWithLimit(b *testing.B) {
}, },
} }
b.Run("benchmark", func(_ *testing.B) { b.Run("benchmark", func(*testing.B) {
ctx := context.Background() ctx := context.Background()
hints := &LabelHints{ hints := &LabelHints{
Limit: 1000, Limit: 1000,
@ -1692,27 +1692,27 @@ type errIterator struct {
err error err error
} }
func (e errIterator) Next() chunkenc.ValueType { func (errIterator) Next() chunkenc.ValueType {
return chunkenc.ValNone return chunkenc.ValNone
} }
func (e errIterator) Seek(_ int64) chunkenc.ValueType { func (errIterator) Seek(int64) chunkenc.ValueType {
return chunkenc.ValNone return chunkenc.ValNone
} }
func (e errIterator) At() (int64, float64) { func (errIterator) At() (int64, float64) {
return 0, 0 return 0, 0
} }
func (e errIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) { func (errIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) {
return 0, nil return 0, nil
} }
func (e errIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) { func (errIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) {
return 0, nil return 0, nil
} }
func (e errIterator) AtT() int64 { func (errIterator) AtT() int64 {
return 0 return 0
} }

View File

@ -418,7 +418,7 @@ func (c *Client) Read(ctx context.Context, query *prompb.Query, sortSeries bool)
} }
} }
func (c *Client) handleSampledResponse(req *prompb.ReadRequest, httpResp *http.Response, sortSeries bool) (storage.SeriesSet, error) { func (*Client) handleSampledResponse(req *prompb.ReadRequest, httpResp *http.Response, sortSeries bool) (storage.SeriesSet, error) {
compressed, err := io.ReadAll(httpResp.Body) compressed, err := io.ReadAll(httpResp.Body)
if err != nil { if err != nil {
return nil, fmt.Errorf("error reading response. HTTP status code: %s: %w", httpResp.Status, err) return nil, fmt.Errorf("error reading response. HTTP status code: %s: %w", httpResp.Status, err)

View File

@ -340,7 +340,7 @@ func (e errSeriesSet) Err() error {
return e.err return e.err
} }
func (e errSeriesSet) Warnings() annotations.Annotations { return nil } func (errSeriesSet) Warnings() annotations.Annotations { return nil }
// concreteSeriesSet implements storage.SeriesSet. // concreteSeriesSet implements storage.SeriesSet.
type concreteSeriesSet struct { type concreteSeriesSet struct {
@ -357,11 +357,11 @@ func (c *concreteSeriesSet) At() storage.Series {
return c.series[c.cur-1] return c.series[c.cur-1]
} }
func (c *concreteSeriesSet) Err() error { func (*concreteSeriesSet) Err() error {
return nil return nil
} }
func (c *concreteSeriesSet) Warnings() annotations.Annotations { return nil } func (*concreteSeriesSet) Warnings() annotations.Annotations { return nil }
// concreteSeries implements storage.Series. // concreteSeries implements storage.Series.
type concreteSeries struct { type concreteSeries struct {
@ -536,7 +536,7 @@ func (c *concreteSeriesIterator) Next() chunkenc.ValueType {
} }
// Err implements chunkenc.Iterator. // Err implements chunkenc.Iterator.
func (c *concreteSeriesIterator) Err() error { func (*concreteSeriesIterator) Err() error {
return nil return nil
} }
@ -607,7 +607,7 @@ func (s *chunkedSeriesSet) Err() error {
return s.err return s.err
} }
func (s *chunkedSeriesSet) Warnings() annotations.Annotations { func (*chunkedSeriesSet) Warnings() annotations.Annotations {
return nil return nil
} }

View File

@ -719,9 +719,9 @@ func (c *mockChunkSeriesSet) At() storage.ChunkSeries {
} }
} }
func (c *mockChunkSeriesSet) Warnings() annotations.Annotations { return nil } func (*mockChunkSeriesSet) Warnings() annotations.Annotations { return nil }
func (c *mockChunkSeriesSet) Err() error { func (*mockChunkSeriesSet) Err() error {
return nil return nil
} }
@ -748,7 +748,7 @@ func (c *mockChunkIterator) Next() bool {
return c.index < len(c.chunks) return c.index < len(c.chunks)
} }
func (c *mockChunkIterator) Err() error { func (*mockChunkIterator) Err() error {
return nil return nil
} }
@ -986,7 +986,7 @@ func TestChunkedSeriesSet(t *testing.T) {
// mockFlusher implements http.Flusher. // mockFlusher implements http.Flusher.
type mockFlusher struct{} type mockFlusher struct{}
func (f *mockFlusher) Flush() {} func (*mockFlusher) Flush() {}
type oneShotCloser struct { type oneShotCloser struct {
r io.Reader r io.Reader

View File

@ -37,7 +37,7 @@ type Watchable interface {
type noopScrapeManager struct{} type noopScrapeManager struct{}
func (noop *noopScrapeManager) Get() (*scrape.Manager, error) { func (*noopScrapeManager) Get() (*scrape.Manager, error) {
return nil, errors.New("scrape manager not ready") return nil, errors.New("scrape manager not ready")
} }

View File

@ -50,8 +50,8 @@ func (s *TestMetaStore) GetMetadata(mfName string) (scrape.MetricMetadata, bool)
return scrape.MetricMetadata{}, false return scrape.MetricMetadata{}, false
} }
func (s *TestMetaStore) SizeMetadata() int { return 0 } func (*TestMetaStore) SizeMetadata() int { return 0 }
func (s *TestMetaStore) LengthMetadata() int { return 0 } func (*TestMetaStore) LengthMetadata() int { return 0 }
type writeMetadataToMock struct { type writeMetadataToMock struct {
metadataAppended int metadataAppended int

View File

@ -764,7 +764,7 @@ func TestDisableReshardOnRetry(t *testing.T) {
metrics = newQueueManagerMetrics(nil, "", "") metrics = newQueueManagerMetrics(nil, "", "")
client = &MockWriteClient{ client = &MockWriteClient{
StoreFunc: func(_ context.Context, _ []byte, _ int) (WriteResponseStats, error) { StoreFunc: func(context.Context, []byte, int) (WriteResponseStats, error) {
onStoreCalled() onStoreCalled()
return WriteResponseStats{}, RecoverableError{ return WriteResponseStats{}, RecoverableError{
@ -1235,11 +1235,11 @@ func (c *TestWriteClient) Store(_ context.Context, req []byte, _ int) (WriteResp
return rs, nil return rs, nil
} }
func (c *TestWriteClient) Name() string { func (*TestWriteClient) Name() string {
return "testwriteclient" return "testwriteclient"
} }
func (c *TestWriteClient) Endpoint() string { func (*TestWriteClient) Endpoint() string {
return "http://test-remote.com/1234" return "http://test-remote.com/1234"
} }
@ -1325,11 +1325,11 @@ func (c *TestBlockingWriteClient) NumCalls() uint64 {
return c.numCalls.Load() return c.numCalls.Load()
} }
func (c *TestBlockingWriteClient) Name() string { func (*TestBlockingWriteClient) Name() string {
return "testblockingwriteclient" return "testblockingwriteclient"
} }
func (c *TestBlockingWriteClient) Endpoint() string { func (*TestBlockingWriteClient) Endpoint() string {
return "http://test-remote-blocking.com/1234" return "http://test-remote-blocking.com/1234"
} }
@ -1337,11 +1337,11 @@ func (c *TestBlockingWriteClient) Endpoint() string {
type NopWriteClient struct{} type NopWriteClient struct{}
func NewNopWriteClient() *NopWriteClient { return &NopWriteClient{} } func NewNopWriteClient() *NopWriteClient { return &NopWriteClient{} }
func (c *NopWriteClient) Store(context.Context, []byte, int) (WriteResponseStats, error) { func (*NopWriteClient) Store(context.Context, []byte, int) (WriteResponseStats, error) {
return WriteResponseStats{}, nil return WriteResponseStats{}, nil
} }
func (c *NopWriteClient) Name() string { return "nopwriteclient" } func (*NopWriteClient) Name() string { return "nopwriteclient" }
func (c *NopWriteClient) Endpoint() string { return "http://test-remote.com/1234" } func (*NopWriteClient) Endpoint() string { return "http://test-remote.com/1234" }
type MockWriteClient struct { type MockWriteClient struct {
StoreFunc func(context.Context, []byte, int) (WriteResponseStats, error) StoreFunc func(context.Context, []byte, int) (WriteResponseStats, error)

View File

@ -210,19 +210,19 @@ func (q querier) addExternalLabels(ms []*labels.Matcher) ([]*labels.Matcher, []s
} }
// LabelValues implements storage.Querier and is a noop. // LabelValues implements storage.Querier and is a noop.
func (q *querier) LabelValues(context.Context, string, *storage.LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) { func (*querier) LabelValues(context.Context, string, *storage.LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) {
// TODO: Implement: https://github.com/prometheus/prometheus/issues/3351 // TODO: Implement: https://github.com/prometheus/prometheus/issues/3351
return nil, nil, errors.New("not implemented") return nil, nil, errors.New("not implemented")
} }
// LabelNames implements storage.Querier and is a noop. // LabelNames implements storage.Querier and is a noop.
func (q *querier) LabelNames(context.Context, *storage.LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) { func (*querier) LabelNames(context.Context, *storage.LabelHints, ...*labels.Matcher) ([]string, annotations.Annotations, error) {
// TODO: Implement: https://github.com/prometheus/prometheus/issues/3351 // TODO: Implement: https://github.com/prometheus/prometheus/issues/3351
return nil, nil, errors.New("not implemented") return nil, nil, errors.New("not implemented")
} }
// Close implements storage.Querier and is a noop. // Close implements storage.Querier and is a noop.
func (q *querier) Close() error { func (*querier) Close() error {
return nil return nil
} }

View File

@ -145,7 +145,7 @@ func (s *Storage) ApplyConfig(conf *config.Config) error {
} }
// StartTime implements the Storage interface. // StartTime implements the Storage interface.
func (s *Storage) StartTime() (int64, error) { func (*Storage) StartTime() (int64, error) {
return int64(model.Latest), nil return int64(model.Latest), nil
} }

View File

@ -233,7 +233,7 @@ func (rws *WriteStorage) ApplyConfig(conf *config.Config) error {
} }
// Appender implements storage.Storage. // Appender implements storage.Storage.
func (rws *WriteStorage) Appender(_ context.Context) storage.Appender { func (rws *WriteStorage) Appender(context.Context) storage.Appender {
return &timestampTracker{ return &timestampTracker{
writeStorage: rws, writeStorage: rws,
highestRecvTimestamp: rws.highestTimestamp, highestRecvTimestamp: rws.highestTimestamp,
@ -302,7 +302,7 @@ func (t *timestampTracker) Append(_ storage.SeriesRef, _ labels.Labels, ts int64
return 0, nil return 0, nil
} }
func (t *timestampTracker) AppendExemplar(_ storage.SeriesRef, _ labels.Labels, _ exemplar.Exemplar) (storage.SeriesRef, error) { func (t *timestampTracker) AppendExemplar(storage.SeriesRef, labels.Labels, exemplar.Exemplar) (storage.SeriesRef, error) {
t.exemplars++ t.exemplars++
return 0, nil return 0, nil
} }
@ -335,7 +335,7 @@ func (t *timestampTracker) AppendHistogramCTZeroSample(_ storage.SeriesRef, _ la
return 0, nil return 0, nil
} }
func (t *timestampTracker) UpdateMetadata(_ storage.SeriesRef, _ labels.Labels, _ metadata.Metadata) (storage.SeriesRef, error) { func (*timestampTracker) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error) {
// TODO: Add and increment a `metadata` field when we get around to wiring metadata in remote_write. // TODO: Add and increment a `metadata` field when we get around to wiring metadata in remote_write.
// UpdateMetadata is no-op for remote write (where timestampTracker is being used) for now. // UpdateMetadata is no-op for remote write (where timestampTracker is being used) for now.
return 0, nil return 0, nil

View File

@ -92,7 +92,7 @@ func NewWriteHandler(logger *slog.Logger, reg prometheus.Registerer, appendable
return h return h
} }
func (h *writeHandler) parseProtoMsg(contentType string) (config.RemoteWriteProtoMsg, error) { func (*writeHandler) parseProtoMsg(contentType string) (config.RemoteWriteProtoMsg, error) {
contentType = strings.TrimSpace(contentType) contentType = strings.TrimSpace(contentType)
parts := strings.Split(contentType, ";") parts := strings.Split(contentType, ";")
@ -513,7 +513,7 @@ func (h *writeHandler) appendV2(app storage.Appender, req *writev2.Request, rs *
// handleHistogramZeroSample appends CT as a zero-value sample with CT value as the sample timestamp. // handleHistogramZeroSample appends CT as a zero-value sample with CT value as the sample timestamp.
// It doesn't return errors in case of out of order CT. // It doesn't return errors in case of out of order CT.
func (h *writeHandler) handleHistogramZeroSample(app storage.Appender, ref storage.SeriesRef, l labels.Labels, hist writev2.Histogram, ct int64) (storage.SeriesRef, error) { func (*writeHandler) handleHistogramZeroSample(app storage.Appender, ref storage.SeriesRef, l labels.Labels, hist writev2.Histogram, ct int64) (storage.SeriesRef, error) {
var err error var err error
if hist.IsFloatHistogram() { if hist.IsFloatHistogram() {
ref, err = app.AppendHistogramCTZeroSample(ref, l, hist.Timestamp, ct, nil, hist.ToFloatHistogram()) ref, err = app.AppendHistogramCTZeroSample(ref, l, hist.Timestamp, ct, nil, hist.ToFloatHistogram())
@ -625,7 +625,7 @@ func (rw *rwExporter) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) er
return err return err
} }
func (rw *rwExporter) Capabilities() consumer.Capabilities { func (*rwExporter) Capabilities() consumer.Capabilities {
return consumer.Capabilities{MutatesData: false} return consumer.Capabilities{MutatesData: false}
} }

View File

@ -878,7 +878,7 @@ func requireEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...inte
msgAndArgs...) msgAndArgs...)
} }
func (m *mockAppendable) Appender(_ context.Context) storage.Appender { func (m *mockAppendable) Appender(context.Context) storage.Appender {
if m.latestSample == nil { if m.latestSample == nil {
m.latestSample = map[uint64]int64{} m.latestSample = map[uint64]int64{}
} }
@ -894,7 +894,7 @@ func (m *mockAppendable) Appender(_ context.Context) storage.Appender {
return m return m
} }
func (m *mockAppendable) SetOptions(_ *storage.AppendOptions) { func (*mockAppendable) SetOptions(*storage.AppendOptions) {
panic("unimplemented") panic("unimplemented")
} }

View File

@ -757,7 +757,7 @@ func TestOTLPDelta(t *testing.T) {
{t: milli(1), l: ls, v: 1}, // +1 {t: milli(1), l: ls, v: 1}, // +1
{t: milli(2), l: ls, v: 3}, // +2 {t: milli(2), l: ls, v: 3}, // +2
} }
if diff := cmp.Diff(want, appendable.samples, cmp.Exporter(func(_ reflect.Type) bool { return true })); diff != "" { if diff := cmp.Diff(want, appendable.samples, cmp.Exporter(func(reflect.Type) bool { return true })); diff != "" {
t.Fatal(diff) t.Fatal(diff)
} }
} }

View File

@ -65,7 +65,7 @@ func NewListChunkSeriesFromSamples(lset labels.Labels, samples ...[]chunks.Sampl
if err != nil { if err != nil {
return &ChunkSeriesEntry{ return &ChunkSeriesEntry{
Lset: lset, Lset: lset,
ChunkIteratorFn: func(_ chunks.Iterator) chunks.Iterator { ChunkIteratorFn: func(chunks.Iterator) chunks.Iterator {
return errChunksIterator{err: err} return errChunksIterator{err: err}
}, },
} }
@ -169,7 +169,7 @@ func (it *listSeriesIterator) Seek(t int64) chunkenc.ValueType {
return it.samples.Get(it.idx).Type() return it.samples.Get(it.idx).Type()
} }
func (it *listSeriesIterator) Err() error { return nil } func (*listSeriesIterator) Err() error { return nil }
type listSeriesIteratorWithCopy struct { type listSeriesIteratorWithCopy struct {
*listSeriesIterator *listSeriesIterator
@ -223,7 +223,7 @@ func (it *listChunkSeriesIterator) Next() bool {
return it.idx < len(it.chks) return it.idx < len(it.chks)
} }
func (it *listChunkSeriesIterator) Err() error { return nil } func (*listChunkSeriesIterator) Err() error { return nil }
type chunkSetToSeriesSet struct { type chunkSetToSeriesSet struct {
ChunkSeriesSet ChunkSeriesSet
@ -432,8 +432,8 @@ type errChunksIterator struct {
err error err error
} }
func (e errChunksIterator) At() chunks.Meta { return chunks.Meta{} } func (errChunksIterator) At() chunks.Meta { return chunks.Meta{} }
func (e errChunksIterator) Next() bool { return false } func (errChunksIterator) Next() bool { return false }
func (e errChunksIterator) Err() error { return e.err } func (e errChunksIterator) Err() error { return e.err }
// ExpandSamples iterates over all samples in the iterator, buffering all in slice. // ExpandSamples iterates over all samples in the iterator, buffering all in slice.

View File

@ -605,7 +605,7 @@ func testTemplateExpansion(t *testing.T, scenarios []scenario) {
} }
for _, s := range scenarios { for _, s := range scenarios {
queryFunc := func(_ context.Context, _ string, _ time.Time) (promql.Vector, error) { queryFunc := func(context.Context, string, time.Time) (promql.Vector, error) {
return s.queryResult, nil return s.queryResult, nil
} }
var result string var result string

View File

@ -736,22 +736,22 @@ func (db *DB) gc(mint int64) {
} }
// StartTime implements the Storage interface. // StartTime implements the Storage interface.
func (db *DB) StartTime() (int64, error) { func (*DB) StartTime() (int64, error) {
return int64(model.Latest), nil return int64(model.Latest), nil
} }
// Querier implements the Storage interface. // Querier implements the Storage interface.
func (db *DB) Querier(int64, int64) (storage.Querier, error) { func (*DB) Querier(int64, int64) (storage.Querier, error) {
return nil, ErrUnsupported return nil, ErrUnsupported
} }
// ChunkQuerier implements the Storage interface. // ChunkQuerier implements the Storage interface.
func (db *DB) ChunkQuerier(int64, int64) (storage.ChunkQuerier, error) { func (*DB) ChunkQuerier(int64, int64) (storage.ChunkQuerier, error) {
return nil, ErrUnsupported return nil, ErrUnsupported
} }
// ExemplarQuerier implements the Storage interface. // ExemplarQuerier implements the Storage interface.
func (db *DB) ExemplarQuerier(context.Context) (storage.ExemplarQuerier, error) { func (*DB) ExemplarQuerier(context.Context) (storage.ExemplarQuerier, error) {
return nil, ErrUnsupported return nil, ErrUnsupported
} }
@ -988,7 +988,7 @@ func (a *appender) AppendHistogram(ref storage.SeriesRef, l labels.Labels, t int
return storage.SeriesRef(series.ref), nil return storage.SeriesRef(series.ref), nil
} }
func (a *appender) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error) { func (*appender) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error) {
// TODO: Wire metadata in the Agent's appender. // TODO: Wire metadata in the Agent's appender.
return 0, nil return 0, nil
} }

View File

@ -94,7 +94,7 @@ func labelsWithHashCollision() (labels.Labels, labels.Labels) {
} }
// stripeSeriesWithCollidingSeries returns a stripeSeries with two memSeries having the same, colliding, hash. // stripeSeriesWithCollidingSeries returns a stripeSeries with two memSeries having the same, colliding, hash.
func stripeSeriesWithCollidingSeries(_ *testing.T) (*stripeSeries, *memSeries, *memSeries) { func stripeSeriesWithCollidingSeries(*testing.T) (*stripeSeries, *memSeries, *memSeries) {
lbls1, lbls2 := labelsWithHashCollision() lbls1, lbls2 := labelsWithHashCollision()
ms1 := memSeries{ ms1 := memSeries{
lset: lbls1, lset: lbls1,

View File

@ -602,7 +602,7 @@ func testPostingsForLabelMatching(t *testing.T, offset storage.SeriesRef, setUp
{ {
name: "missing label", name: "missing label",
labelName: "missing", labelName: "missing",
match: func(_ string) bool { match: func(string) bool {
return true return true
}, },
exp: nil, exp: nil,

View File

@ -223,17 +223,17 @@ type mockSeriesIterator struct {
currIndex int currIndex int
} }
func (it *mockSeriesIterator) Seek(int64) ValueType { return ValNone } func (*mockSeriesIterator) Seek(int64) ValueType { return ValNone }
func (it *mockSeriesIterator) At() (int64, float64) { func (it *mockSeriesIterator) At() (int64, float64) {
return it.timeStamps[it.currIndex], it.values[it.currIndex] return it.timeStamps[it.currIndex], it.values[it.currIndex]
} }
func (it *mockSeriesIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) { func (*mockSeriesIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) {
return math.MinInt64, nil return math.MinInt64, nil
} }
func (it *mockSeriesIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) { func (*mockSeriesIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) {
return math.MinInt64, nil return math.MinInt64, nil
} }
@ -249,7 +249,7 @@ func (it *mockSeriesIterator) Next() ValueType {
return ValNone return ValNone
} }
func (it *mockSeriesIterator) Err() error { return nil } func (*mockSeriesIterator) Err() error { return nil }
// NewNopIterator returns a new chunk iterator that does not hold any data. // NewNopIterator returns a new chunk iterator that does not hold any data.
func NewNopIterator() Iterator { func NewNopIterator() Iterator {

View File

@ -58,7 +58,7 @@ type xorValue struct {
} }
// Encoding returns the encoding type. // Encoding returns the encoding type.
func (c *FloatHistogramChunk) Encoding() Encoding { func (*FloatHistogramChunk) Encoding() Encoding {
return EncFloatHistogram return EncFloatHistogram
} }
@ -215,7 +215,7 @@ func (a *FloatHistogramAppender) NumSamples() int {
// Append implements Appender. This implementation panics because normal float // Append implements Appender. This implementation panics because normal float
// samples must never be appended to a histogram chunk. // samples must never be appended to a histogram chunk.
func (a *FloatHistogramAppender) Append(int64, float64) { func (*FloatHistogramAppender) Append(int64, float64) {
panic("appended a float sample to a histogram chunk") panic("appended a float sample to a histogram chunk")
} }
@ -688,7 +688,7 @@ func (a *FloatHistogramAppender) recode(
// recodeHistogram converts the current histogram (in-place) to accommodate an expansion of the set of // recodeHistogram converts the current histogram (in-place) to accommodate an expansion of the set of
// (positive and/or negative) buckets used. // (positive and/or negative) buckets used.
func (a *FloatHistogramAppender) recodeHistogram( func (*FloatHistogramAppender) recodeHistogram(
fh *histogram.FloatHistogram, fh *histogram.FloatHistogram,
pBackwardInter, nBackwardInter []Insert, pBackwardInter, nBackwardInter []Insert,
) { ) {
@ -702,7 +702,7 @@ func (a *FloatHistogramAppender) recodeHistogram(
} }
} }
func (a *FloatHistogramAppender) AppendHistogram(*HistogramAppender, int64, *histogram.Histogram, bool) (Chunk, bool, Appender, error) { func (*FloatHistogramAppender) AppendHistogram(*HistogramAppender, int64, *histogram.Histogram, bool) (Chunk, bool, Appender, error) {
panic("appended a histogram sample to a float histogram chunk") panic("appended a histogram sample to a float histogram chunk")
} }
@ -872,11 +872,11 @@ func (it *floatHistogramIterator) Seek(t int64) ValueType {
return ValFloatHistogram return ValFloatHistogram
} }
func (it *floatHistogramIterator) At() (int64, float64) { func (*floatHistogramIterator) At() (int64, float64) {
panic("cannot call floatHistogramIterator.At") panic("cannot call floatHistogramIterator.At")
} }
func (it *floatHistogramIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) { func (*floatHistogramIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) {
panic("cannot call floatHistogramIterator.AtHistogram") panic("cannot call floatHistogramIterator.AtHistogram")
} }

View File

@ -51,7 +51,7 @@ func (c *HistogramChunk) Reset(stream []byte) {
} }
// Encoding returns the encoding type. // Encoding returns the encoding type.
func (c *HistogramChunk) Encoding() Encoding { func (*HistogramChunk) Encoding() Encoding {
return EncHistogram return EncHistogram
} }
@ -234,7 +234,7 @@ func (a *HistogramAppender) NumSamples() int {
// Append implements Appender. This implementation panics because normal float // Append implements Appender. This implementation panics because normal float
// samples must never be appended to a histogram chunk. // samples must never be appended to a histogram chunk.
func (a *HistogramAppender) Append(int64, float64) { func (*HistogramAppender) Append(int64, float64) {
panic("appended a float sample to a histogram chunk") panic("appended a float sample to a histogram chunk")
} }
@ -731,7 +731,7 @@ func (a *HistogramAppender) recode(
// recodeHistogram converts the current histogram (in-place) to accommodate an // recodeHistogram converts the current histogram (in-place) to accommodate an
// expansion of the set of (positive and/or negative) buckets used. // expansion of the set of (positive and/or negative) buckets used.
func (a *HistogramAppender) recodeHistogram( func (*HistogramAppender) recodeHistogram(
h *histogram.Histogram, h *histogram.Histogram,
pBackwardInserts, nBackwardInserts []Insert, pBackwardInserts, nBackwardInserts []Insert,
) { ) {
@ -749,7 +749,7 @@ func (a *HistogramAppender) writeSumDelta(v float64) {
xorWrite(a.b, v, a.sum, &a.leading, &a.trailing) xorWrite(a.b, v, a.sum, &a.leading, &a.trailing)
} }
func (a *HistogramAppender) AppendFloatHistogram(*FloatHistogramAppender, int64, *histogram.FloatHistogram, bool) (Chunk, bool, Appender, error) { func (*HistogramAppender) AppendFloatHistogram(*FloatHistogramAppender, int64, *histogram.FloatHistogram, bool) (Chunk, bool, Appender, error) {
panic("appended a float histogram sample to a histogram chunk") panic("appended a float histogram sample to a histogram chunk")
} }
@ -926,7 +926,7 @@ func (it *histogramIterator) Seek(t int64) ValueType {
return ValHistogram return ValHistogram
} }
func (it *histogramIterator) At() (int64, float64) { func (*histogramIterator) At() (int64, float64) {
panic("cannot call histogramIterator.At") panic("cannot call histogramIterator.At")
} }

View File

@ -71,7 +71,7 @@ func (c *XORChunk) Reset(stream []byte) {
} }
// Encoding returns the encoding type. // Encoding returns the encoding type.
func (c *XORChunk) Encoding() Encoding { func (*XORChunk) Encoding() Encoding {
return EncXOR return EncXOR
} }
@ -223,11 +223,11 @@ func (a *xorAppender) writeVDelta(v float64) {
xorWrite(a.b, v, a.v, &a.leading, &a.trailing) xorWrite(a.b, v, a.v, &a.leading, &a.trailing)
} }
func (a *xorAppender) AppendHistogram(*HistogramAppender, int64, *histogram.Histogram, bool) (Chunk, bool, Appender, error) { func (*xorAppender) AppendHistogram(*HistogramAppender, int64, *histogram.Histogram, bool) (Chunk, bool, Appender, error) {
panic("appended a histogram sample to a float chunk") panic("appended a histogram sample to a float chunk")
} }
func (a *xorAppender) AppendFloatHistogram(*FloatHistogramAppender, int64, *histogram.FloatHistogram, bool) (Chunk, bool, Appender, error) { func (*xorAppender) AppendFloatHistogram(*FloatHistogramAppender, int64, *histogram.FloatHistogram, bool) (Chunk, bool, Appender, error) {
panic("appended a float histogram sample to a float chunk") panic("appended a float histogram sample to a float chunk")
} }
@ -263,11 +263,11 @@ func (it *xorIterator) At() (int64, float64) {
return it.t, it.val return it.t, it.val
} }
func (it *xorIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) { func (*xorIterator) AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram) {
panic("cannot call xorIterator.AtHistogram") panic("cannot call xorIterator.AtHistogram")
} }
func (it *xorIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) { func (*xorIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram) {
panic("cannot call xorIterator.AtFloatHistogram") panic("cannot call xorIterator.AtFloatHistogram")
} }

View File

@ -31,7 +31,7 @@ func TestChunkWriteQueue_GettingChunkFromQueue(t *testing.T) {
blockWriterWg.Add(1) blockWriterWg.Add(1)
// blockingChunkWriter blocks until blockWriterWg is done. // blockingChunkWriter blocks until blockWriterWg is done.
blockingChunkWriter := func(_ HeadSeriesRef, _, _ int64, _ chunkenc.Chunk, _ ChunkDiskMapperRef, _, _ bool) error { blockingChunkWriter := func(HeadSeriesRef, int64, int64, chunkenc.Chunk, ChunkDiskMapperRef, bool, bool) error {
blockWriterWg.Wait() blockWriterWg.Wait()
return nil return nil
} }
@ -82,7 +82,7 @@ func TestChunkWriteQueue_WritingThroughQueue(t *testing.T) {
ref := newChunkDiskMapperRef(321, 123) ref := newChunkDiskMapperRef(321, 123)
cutFile := true cutFile := true
awaitCb := make(chan struct{}) awaitCb := make(chan struct{})
require.NoError(t, q.addJob(chunkWriteJob{seriesRef: seriesRef, mint: mint, maxt: maxt, chk: chunk, ref: ref, cutFile: cutFile, callback: func(_ error) { require.NoError(t, q.addJob(chunkWriteJob{seriesRef: seriesRef, mint: mint, maxt: maxt, chk: chunk, ref: ref, cutFile: cutFile, callback: func(error) {
close(awaitCb) close(awaitCb)
}})) }}))
<-awaitCb <-awaitCb
@ -101,7 +101,7 @@ func TestChunkWriteQueue_WrappingAroundSizeLimit(t *testing.T) {
unblockChunkWriterCh := make(chan struct{}, sizeLimit) unblockChunkWriterCh := make(chan struct{}, sizeLimit)
// blockingChunkWriter blocks until the unblockChunkWriterCh channel returns a value. // blockingChunkWriter blocks until the unblockChunkWriterCh channel returns a value.
blockingChunkWriter := func(_ HeadSeriesRef, _, _ int64, _ chunkenc.Chunk, _ ChunkDiskMapperRef, _, _ bool) error { blockingChunkWriter := func(HeadSeriesRef, int64, int64, chunkenc.Chunk, ChunkDiskMapperRef, bool, bool) error {
<-unblockChunkWriterCh <-unblockChunkWriterCh
return nil return nil
} }
@ -117,7 +117,7 @@ func TestChunkWriteQueue_WrappingAroundSizeLimit(t *testing.T) {
callbackWg.Add(1) callbackWg.Add(1)
require.NoError(t, q.addJob(chunkWriteJob{ require.NoError(t, q.addJob(chunkWriteJob{
ref: chunkRef, ref: chunkRef,
callback: func(_ error) { callback: func(error) {
callbackWg.Done() callbackWg.Done()
}, },
})) }))
@ -184,7 +184,7 @@ func TestChunkWriteQueue_WrappingAroundSizeLimit(t *testing.T) {
func TestChunkWriteQueue_HandlerErrorViaCallback(t *testing.T) { func TestChunkWriteQueue_HandlerErrorViaCallback(t *testing.T) {
testError := errors.New("test error") testError := errors.New("test error")
chunkWriter := func(_ HeadSeriesRef, _, _ int64, _ chunkenc.Chunk, _ ChunkDiskMapperRef, _, _ bool) error { chunkWriter := func(HeadSeriesRef, int64, int64, chunkenc.Chunk, ChunkDiskMapperRef, bool, bool) error {
return testError return testError
} }
@ -212,7 +212,7 @@ func BenchmarkChunkWriteQueue_addJob(b *testing.B) {
for _, concurrentWrites := range []int{1, 10, 100, 1000} { for _, concurrentWrites := range []int{1, 10, 100, 1000} {
b.Run(fmt.Sprintf("%d concurrent writes", concurrentWrites), func(b *testing.B) { b.Run(fmt.Sprintf("%d concurrent writes", concurrentWrites), func(b *testing.B) {
issueReadSignal := make(chan struct{}) issueReadSignal := make(chan struct{})
q := newChunkWriteQueue(nil, 1000, func(_ HeadSeriesRef, _, _ int64, _ chunkenc.Chunk, _ ChunkDiskMapperRef, _, _ bool) error { q := newChunkWriteQueue(nil, 1000, func(HeadSeriesRef, int64, int64, chunkenc.Chunk, ChunkDiskMapperRef, bool, bool) error {
if withReads { if withReads {
select { select {
case issueReadSignal <- struct{}{}: case issueReadSignal <- struct{}{}:

Some files were not shown because too many files have changed in this diff Show More