diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go index f7d650ffdee..a23f7367026 100644 --- a/cmd/all-in-one/main.go +++ b/cmd/all-in-one/main.go @@ -43,7 +43,7 @@ import ( "github.com/jaegertracing/jaeger/storage/dependencystore" metricsstoreMetrics "github.com/jaegertracing/jaeger/storage/metricsstore/metrics" "github.com/jaegertracing/jaeger/storage/spanstore" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) // all-in-one/main is a standalone full-stack jaeger backend, backed by a memory store @@ -224,7 +224,7 @@ func startQuery( tm *tenancy.Manager, telset telemetery.Setting, ) *queryApp.Server { - spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, telset.Metrics) + spanReader = spanstoremetrics.NewReaderDecorator(spanReader, telset.Metrics) qs := querysvc.NewQueryService(spanReader, depReader, *queryOpts) server, err := queryApp.NewServer(context.Background(), qs, metricsQueryService, qOpts, tm, telset) diff --git a/cmd/jaeger/internal/extension/jaegerquery/server.go b/cmd/jaeger/internal/extension/jaegerquery/server.go index 7966cb6f110..42269eb55b0 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server.go @@ -23,7 +23,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/metrics/disabled" "github.com/jaegertracing/jaeger/storage/metricsstore" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) var ( @@ -65,7 +65,7 @@ func (s *server) Start(ctx context.Context, host component.Host) error { return fmt.Errorf("cannot create span reader: %w", err) } - spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, queryMetricsFactory) + spanReader = spanstoremetrics.NewReaderDecorator(spanReader, queryMetricsFactory) depReader, err := f.CreateDependencyReader() if err != nil { diff --git a/cmd/query/main.go b/cmd/query/main.go index 61b5975cb05..bd5cf076262 100644 --- a/cmd/query/main.go +++ b/cmd/query/main.go @@ -36,7 +36,7 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" metricsstoreMetrics "github.com/jaegertracing/jaeger/storage/metricsstore/metrics" - spanstoreMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) func main() { @@ -91,7 +91,7 @@ func main() { if err != nil { logger.Fatal("Failed to create span reader", zap.Error(err)) } - spanReader = spanstoreMetrics.NewReadMetricsDecorator(spanReader, metricsFactory) + spanReader = spanstoremetrics.NewReaderDecorator(spanReader, metricsFactory) dependencyReader, err := storageFactory.CreateDependencyReader() if err != nil { logger.Fatal("Failed to create dependency reader", zap.Error(err)) diff --git a/pkg/cassandra/metrics/table.go b/pkg/cassandra/metrics/table.go index 8b6132f690d..c31787d0b28 100644 --- a/pkg/cassandra/metrics/table.go +++ b/pkg/cassandra/metrics/table.go @@ -12,17 +12,17 @@ import ( "github.com/jaegertracing/jaeger/pkg/cassandra" "github.com/jaegertracing/jaeger/pkg/metrics" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) // Table is a collection of metrics about Cassandra write operations. type Table struct { - storageMetrics.WriteMetrics + spanstoremetrics.WriteMetrics } // NewTable takes a metrics scope and creates a table metrics struct func NewTable(factory metrics.Factory, tableName string) *Table { - t := storageMetrics.WriteMetrics{} + t := spanstoremetrics.WriteMetrics{} metrics.Init(&t, factory.Namespace(metrics.NSOptions{Name: "", Tags: map[string]string{"table": tableName}}), nil) return &Table{t} } diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index f5104a4691b..298caad57fb 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -30,7 +30,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/es" eswrapper "github.com/jaegertracing/jaeger/pkg/es/wrapper" "github.com/jaegertracing/jaeger/pkg/metrics" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) const ( @@ -217,7 +217,7 @@ func NewClient(c *Configuration, logger *zap.Logger, metricsFactory metrics.Fact return nil, err } - sm := storageMetrics.NewWriteMetrics(metricsFactory, "bulk_index") + sm := spanstoremetrics.NewWriterDecorator(metricsFactory, "bulk_index") m := sync.Map{} bulkProc, err := rawClient.BulkProcessor(). diff --git a/plugin/storage/es/spanstore/writer.go b/plugin/storage/es/spanstore/writer.go index 77e781d8aaf..42120fe704b 100644 --- a/plugin/storage/es/spanstore/writer.go +++ b/plugin/storage/es/spanstore/writer.go @@ -17,7 +17,7 @@ import ( cfg "github.com/jaegertracing/jaeger/pkg/es/config" "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/plugin/storage/es/spanstore/dbmodel" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) const ( @@ -28,7 +28,7 @@ const ( ) type spanWriterMetrics struct { - indexCreate *storageMetrics.WriteMetrics + indexCreate *spanstoremetrics.WriteMetrics } type serviceWriter func(string, *dbmodel.Span) @@ -72,7 +72,7 @@ func NewSpanWriter(p SpanWriterParams) *SpanWriter { client: p.Client, logger: p.Logger, writerMetrics: spanWriterMetrics{ - indexCreate: storageMetrics.NewWriteMetrics(p.MetricsFactory, "index_create"), + indexCreate: spanstoremetrics.NewWriterDecorator(p.MetricsFactory, "index_create"), }, serviceWriter: serviceOperationStorage.Write, spanConverter: dbmodel.NewFromDomain(p.AllTagsAsFields, p.TagKeysAsFields, p.TagDotReplacement), diff --git a/storage/spanstore/metrics/decorator_test.go b/storage/spanstore/spanstoremetrics/decorator_test.go similarity index 95% rename from storage/spanstore/metrics/decorator_test.go rename to storage/spanstore/spanstoremetrics/decorator_test.go index 5fef39cd9ec..8f9c40863b5 100644 --- a/storage/spanstore/metrics/decorator_test.go +++ b/storage/spanstore/spanstoremetrics/decorator_test.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics_test +package spanstoremetrics_test import ( "context" @@ -14,15 +14,15 @@ import ( "github.com/jaegertracing/jaeger/internal/metricstest" "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/storage/spanstore" - "github.com/jaegertracing/jaeger/storage/spanstore/metrics" "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) func TestSuccessfulUnderlyingCalls(t *testing.T) { mf := metricstest.NewFactory(0) mockReader := mocks.Reader{} - mrs := metrics.NewReadMetricsDecorator(&mockReader, mf) + mrs := spanstoremetrics.NewReaderDecorator(&mockReader, mf) mockReader.On("GetServices", context.Background()).Return([]string{}, nil) mrs.GetServices(context.Background()) operationQuery := spanstore.OperationQueryParameters{ServiceName: "something"} @@ -89,7 +89,7 @@ func TestFailingUnderlyingCalls(t *testing.T) { mf := metricstest.NewFactory(0) mockReader := mocks.Reader{} - mrs := metrics.NewReadMetricsDecorator(&mockReader, mf) + mrs := spanstoremetrics.NewReaderDecorator(&mockReader, mf) mockReader.On("GetServices", context.Background()). Return(nil, errors.New("Failure")) mrs.GetServices(context.Background()) diff --git a/storage/spanstore/metrics/package_test.go b/storage/spanstore/spanstoremetrics/package_test.go similarity index 89% rename from storage/spanstore/metrics/package_test.go rename to storage/spanstore/spanstoremetrics/package_test.go index 81295a3e78d..df29173d75d 100644 --- a/storage/spanstore/metrics/package_test.go +++ b/storage/spanstore/spanstoremetrics/package_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2023 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "testing" diff --git a/storage/spanstore/metrics/decorator.go b/storage/spanstore/spanstoremetrics/read_metrics.go similarity index 95% rename from storage/spanstore/metrics/decorator.go rename to storage/spanstore/spanstoremetrics/read_metrics.go index 7b1fdd222bc..0f4ca13d0c0 100644 --- a/storage/spanstore/metrics/decorator.go +++ b/storage/spanstore/spanstoremetrics/read_metrics.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "context" @@ -42,8 +42,8 @@ func (q *queryMetrics) emit(err error, latency time.Duration, responses int) { } } -// NewReadMetricsDecorator returns a new ReadMetricsDecorator. -func NewReadMetricsDecorator(spanReader spanstore.Reader, metricsFactory metrics.Factory) *ReadMetricsDecorator { +// NewReaderDecorator returns a new ReadMetricsDecorator. +func NewReaderDecorator(spanReader spanstore.Reader, metricsFactory metrics.Factory) *ReadMetricsDecorator { return &ReadMetricsDecorator{ spanReader: spanReader, findTracesMetrics: buildQueryMetrics("find_traces", metricsFactory), diff --git a/storage/spanstore/metrics/write_metrics.go b/storage/spanstore/spanstoremetrics/write_metrics.go similarity index 84% rename from storage/spanstore/metrics/write_metrics.go rename to storage/spanstore/spanstoremetrics/write_metrics.go index 4a83a2d7759..b3c9ecbf280 100644 --- a/storage/spanstore/metrics/write_metrics.go +++ b/storage/spanstore/spanstoremetrics/write_metrics.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "time" @@ -19,8 +19,8 @@ type WriteMetrics struct { LatencyErr metrics.Timer `metric:"latency-err"` } -// NewWriteMetrics takes a metrics scope and creates a metrics struct -func NewWriteMetrics(factory metrics.Factory, tableName string) *WriteMetrics { +// NewWriterDecorator takes a metrics scope and creates a metrics struct +func NewWriterDecorator(factory metrics.Factory, tableName string) *WriteMetrics { t := &WriteMetrics{} metrics.Init(t, factory.Namespace(metrics.NSOptions{Name: tableName, Tags: nil}), nil) return t diff --git a/storage/spanstore/metrics/write_metrics_test.go b/storage/spanstore/spanstoremetrics/write_metrics_test.go similarity index 95% rename from storage/spanstore/metrics/write_metrics_test.go rename to storage/spanstore/spanstoremetrics/write_metrics_test.go index d84c732a899..aca6f0b4593 100644 --- a/storage/spanstore/metrics/write_metrics_test.go +++ b/storage/spanstore/spanstoremetrics/write_metrics_test.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "errors" @@ -53,7 +53,7 @@ func TestTableEmit(t *testing.T) { } for _, tc := range testCases { mf := metricstest.NewFactory(time.Second) - tm := NewWriteMetrics(mf, "a_table") + tm := NewWriterDecorator(mf, "a_table") tm.Emit(tc.err, 50*time.Millisecond) counts, gauges := mf.Snapshot() assert.Equal(t, tc.counts, counts)