From 2adc60a2ffbb9d404557bc5c884c6181b02df1eb Mon Sep 17 00:00:00 2001 From: Mahad Zaryab Date: Sun, 1 Dec 2024 21:10:08 -0500 Subject: [PATCH] Rename MetricsFactory To MetricStoreFactory Signed-off-by: Mahad Zaryab --- .../exporters/storageexporter/exporter_test.go | 2 +- .../internal/extension/jaegerquery/server_test.go | 2 +- .../internal/extension/jaegerstorage/extension.go | 12 ++++++------ .../integration/storagecleaner/extension_test.go | 4 ++-- plugin/metricstore/disabled/factory_test.go | 2 +- plugin/metricstore/factory.go | 6 +++--- plugin/metricstore/factory_test.go | 2 +- plugin/metricstore/prometheus/factory_test.go | 2 +- storage/factory.go | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go b/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go index c7ff1f9208a..d28131284cc 100644 --- a/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go +++ b/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go @@ -52,7 +52,7 @@ func (m *mockStorageExt) TraceStorageFactory(name string) (storage.Factory, bool return nil, false } -func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) { +func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) { if m.name == name { return m.metricsFactory, true } diff --git a/cmd/jaeger/internal/extension/jaegerquery/server_test.go b/cmd/jaeger/internal/extension/jaegerquery/server_test.go index 41d5627b997..4468fa7aa5e 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server_test.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server_test.go @@ -99,7 +99,7 @@ func (fakeStorageExt) TraceStorageFactory(name string) (storage.Factory, bool) { return fakeFactory{name: name}, true } -func (fakeStorageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) { +func (fakeStorageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) { if name == "need-factory-error" { return nil, false } diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index a389abc965c..a06d37c1a6d 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -30,14 +30,14 @@ var _ Extension = (*storageExt)(nil) type Extension interface { extension.Extension TraceStorageFactory(name string) (storage.Factory, bool) - MetricStorageFactory(name string) (storage.MetricsFactory, bool) + MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) } type storageExt struct { config *Config telset component.TelemetrySettings factories map[string]storage.Factory - metricsFactories map[string]storage.MetricsFactory + metricsFactories map[string]storage.MetricStoreFactory } // GetStorageFactory locates the extension in Host and retrieves @@ -59,7 +59,7 @@ func GetStorageFactory(name string, host component.Host) (storage.Factory, error // GetMetricStorageFactory locates the extension in Host and retrieves // a metric storage factory from it with the given name. -func GetMetricStorageFactory(name string, host component.Host) (storage.MetricsFactory, error) { +func GetMetricStorageFactory(name string, host component.Host) (storage.MetricStoreFactory, error) { ext, err := findExtension(host) if err != nil { return nil, err @@ -110,7 +110,7 @@ func newStorageExt(config *Config, telset component.TelemetrySettings) *storageE config: config, telset: telset, factories: make(map[string]storage.Factory), - metricsFactories: make(map[string]storage.MetricsFactory), + metricsFactories: make(map[string]storage.MetricStoreFactory), } } @@ -175,7 +175,7 @@ func (s *storageExt) Start(_ context.Context, host component.Host) error { for metricStorageName, cfg := range s.config.MetricBackends { s.telset.Logger.Sugar().Infof("Initializing metrics storage '%s'", metricStorageName) - var metricsFactory storage.MetricsFactory + var metricsFactory storage.MetricStoreFactory var err error if cfg.Prometheus != nil { promTelset := telset @@ -211,7 +211,7 @@ func (s *storageExt) TraceStorageFactory(name string) (storage.Factory, bool) { return f, ok } -func (s *storageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) { +func (s *storageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) { mf, ok := s.metricsFactories[name] return mf, ok } diff --git a/cmd/jaeger/internal/integration/storagecleaner/extension_test.go b/cmd/jaeger/internal/integration/storagecleaner/extension_test.go index 81191ff48ef..b373f910f45 100644 --- a/cmd/jaeger/internal/integration/storagecleaner/extension_test.go +++ b/cmd/jaeger/internal/integration/storagecleaner/extension_test.go @@ -41,7 +41,7 @@ func (f *PurgerFactory) Purge(_ context.Context) error { type mockStorageExt struct { name string factory storage.Factory - metricsFactory storage.MetricsFactory + metricsFactory storage.MetricStoreFactory } func (*mockStorageExt) Start(context.Context, component.Host) error { @@ -59,7 +59,7 @@ func (m *mockStorageExt) TraceStorageFactory(name string) (storage.Factory, bool return nil, false } -func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricsFactory, bool) { +func (m *mockStorageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, bool) { if m.name == name { return m.metricsFactory, true } diff --git a/plugin/metricstore/disabled/factory_test.go b/plugin/metricstore/disabled/factory_test.go index d26d97b1010..75738ad932b 100644 --- a/plugin/metricstore/disabled/factory_test.go +++ b/plugin/metricstore/disabled/factory_test.go @@ -14,7 +14,7 @@ import ( "github.com/jaegertracing/jaeger/storage" ) -var _ storage.MetricsFactory = new(Factory) +var _ storage.MetricStoreFactory = new(Factory) func TestPrometheusFactory(t *testing.T) { f := NewFactory() diff --git a/plugin/metricstore/factory.go b/plugin/metricstore/factory.go index 6c6ad3151ed..fbba6c03977 100644 --- a/plugin/metricstore/factory.go +++ b/plugin/metricstore/factory.go @@ -34,7 +34,7 @@ var _ plugin.Configurable = (*Factory)(nil) // Factory implements storage.Factory interface as a meta-factory for storage components. type Factory struct { FactoryConfig - factories map[string]storage.MetricsFactory + factories map[string]storage.MetricStoreFactory } // NewFactory creates the meta-factory. @@ -43,7 +43,7 @@ func NewFactory(config FactoryConfig) (*Factory, error) { uniqueTypes := map[string]struct{}{ f.MetricsStorageType: {}, } - f.factories = make(map[string]storage.MetricsFactory) + f.factories = make(map[string]storage.MetricStoreFactory) for t := range uniqueTypes { ff, err := f.getFactoryOfType(t) if err != nil { @@ -54,7 +54,7 @@ func NewFactory(config FactoryConfig) (*Factory, error) { return f, nil } -func (*Factory) getFactoryOfType(factoryType string) (storage.MetricsFactory, error) { +func (*Factory) getFactoryOfType(factoryType string) (storage.MetricStoreFactory, error) { switch factoryType { case prometheusStorageType: return prometheus.NewFactory(), nil diff --git a/plugin/metricstore/factory_test.go b/plugin/metricstore/factory_test.go index 65ded206caa..c3364d2a184 100644 --- a/plugin/metricstore/factory_test.go +++ b/plugin/metricstore/factory_test.go @@ -18,7 +18,7 @@ import ( "github.com/jaegertracing/jaeger/storage/mocks" ) -var _ storage.MetricsFactory = new(Factory) +var _ storage.MetricStoreFactory = new(Factory) func withConfig(storageType string) FactoryConfig { return FactoryConfig{ diff --git a/plugin/metricstore/prometheus/factory_test.go b/plugin/metricstore/prometheus/factory_test.go index c14778928d5..6279bf80803 100644 --- a/plugin/metricstore/prometheus/factory_test.go +++ b/plugin/metricstore/prometheus/factory_test.go @@ -19,7 +19,7 @@ import ( "github.com/jaegertracing/jaeger/storage" ) -var _ storage.MetricsFactory = new(Factory) +var _ storage.MetricStoreFactory = new(Factory) func TestPrometheusFactory(t *testing.T) { f := NewFactory() diff --git a/storage/factory.go b/storage/factory.go index d01a5edf86a..fdac5e9d17b 100644 --- a/storage/factory.go +++ b/storage/factory.go @@ -78,13 +78,13 @@ type ArchiveFactory interface { CreateArchiveSpanWriter() (spanstore.Writer, error) } -// MetricsFactory defines an interface for a factory that can create implementations of different metrics storage components. +// MetricStoreFactory defines an interface for a factory that can create implementations of different metrics storage components. // Implementations are also encouraged to implement plugin.Configurable interface. // // # See also // // plugin.Configurable -type MetricsFactory interface { +type MetricStoreFactory interface { // Initialize performs internal initialization of the factory, such as opening connections to the backend store. // It is called after all configuration of the factory itself has been done. Initialize(telset telemetry.Settings) error