Skip to content

Commit

Permalink
Rename MetricsFactory To MetricStoreFactory
Browse files Browse the repository at this point in the history
Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 committed Dec 2, 2024
1 parent a764ebb commit 2adc60a
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/jaegerquery/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/jaeger/internal/extension/jaegerstorage/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/metricstore/disabled/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions plugin/metricstore/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/metricstore/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion plugin/metricstore/prometheus/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2adc60a

Please sign in to comment.