From 4c5ae43262c7bc0dd3acd19a76f160e7392d4566 Mon Sep 17 00:00:00 2001 From: mattdurham Date: Tue, 24 Oct 2023 12:00:10 -0700 Subject: [PATCH] Adding labelstore request to module loaders. (#5589) * commit changes * Initial commit for converting global ref id to a service. * Fix lint * Fix new tests. * fix lint * make globalrefmap a service * Update service/labelstore/service.go Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> * pr feedback * fix issue with *monitors not specifying their needs * fix for modules services * fix order --------- Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> --- component/module/file/file.go | 3 ++- component/module/git/git.go | 3 ++- component/module/http/http.go | 3 ++- component/module/string/string.go | 3 ++- pkg/flow/module_caching_test.go | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/component/module/file/file.go b/component/module/file/file.go index 0f0aa6c59876..68b20760d5f4 100644 --- a/component/module/file/file.go +++ b/component/module/file/file.go @@ -11,6 +11,7 @@ import ( "github.com/grafana/agent/component/module" "github.com/grafana/agent/service/cluster" "github.com/grafana/agent/service/http" + "github.com/grafana/agent/service/labelstore" otel_service "github.com/grafana/agent/service/otel" "github.com/grafana/river/rivertypes" ) @@ -20,7 +21,7 @@ func init() { Name: "module.file", Args: Arguments{}, Exports: module.Exports{}, - NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName}, + NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { return New(opts, args.(Arguments)) diff --git a/component/module/git/git.go b/component/module/git/git.go index bd4ec21bdf04..42ac468477de 100644 --- a/component/module/git/git.go +++ b/component/module/git/git.go @@ -15,6 +15,7 @@ import ( "github.com/grafana/agent/pkg/flow/logging/level" "github.com/grafana/agent/service/cluster" "github.com/grafana/agent/service/http" + "github.com/grafana/agent/service/labelstore" otel_service "github.com/grafana/agent/service/otel" ) @@ -23,7 +24,7 @@ func init() { Name: "module.git", Args: Arguments{}, Exports: module.Exports{}, - NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName}, + NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { return New(opts, args.(Arguments)) diff --git a/component/module/http/http.go b/component/module/http/http.go index 8dfbc166dd21..a2d48f6f53b8 100644 --- a/component/module/http/http.go +++ b/component/module/http/http.go @@ -11,6 +11,7 @@ import ( remote_http "github.com/grafana/agent/component/remote/http" "github.com/grafana/agent/service/cluster" http_service "github.com/grafana/agent/service/http" + "github.com/grafana/agent/service/labelstore" otel_service "github.com/grafana/agent/service/otel" "github.com/grafana/river/rivertypes" ) @@ -20,7 +21,7 @@ func init() { Name: "module.http", Args: Arguments{}, Exports: module.Exports{}, - NeedsServices: []string{http_service.ServiceName, cluster.ServiceName, otel_service.ServiceName}, + NeedsServices: []string{http_service.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { return New(opts, args.(Arguments)) diff --git a/component/module/string/string.go b/component/module/string/string.go index bae1e50c6d39..7305abd75073 100644 --- a/component/module/string/string.go +++ b/component/module/string/string.go @@ -7,6 +7,7 @@ import ( "github.com/grafana/agent/component/module" "github.com/grafana/agent/service/cluster" "github.com/grafana/agent/service/http" + "github.com/grafana/agent/service/labelstore" otel_service "github.com/grafana/agent/service/otel" "github.com/grafana/river/rivertypes" ) @@ -16,7 +17,7 @@ func init() { Name: "module.string", Args: Arguments{}, Exports: module.Exports{}, - NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName}, + NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { return New(opts, args.(Arguments)) diff --git a/pkg/flow/module_caching_test.go b/pkg/flow/module_caching_test.go index 3d7eb6f3448d..d1746bbf4c75 100644 --- a/pkg/flow/module_caching_test.go +++ b/pkg/flow/module_caching_test.go @@ -17,6 +17,7 @@ import ( "github.com/grafana/agent/service" cluster_service "github.com/grafana/agent/service/cluster" http_service "github.com/grafana/agent/service/http" + "github.com/grafana/agent/service/labelstore" otel_service "github.com/grafana/agent/service/otel" "github.com/stretchr/testify/require" "go.uber.org/goleak" @@ -163,6 +164,7 @@ func testOptions(t *testing.T) flow.Options { http_service.New(http_service.Options{}), clusterService, otelService, + labelstore.New(nil), }, } }