From e8e59628d2885b56a22d31a0ece4ae7ca77e6942 Mon Sep 17 00:00:00 2001 From: Gary Brown Date: Thu, 20 Sep 2018 17:59:05 +0100 Subject: [PATCH] Make the metrics produced by jaeger query scoped to the query component, and generated for all span readers (not just ES) (#1074) Signed-off-by: Gary Brown --- cmd/all-in-one/main.go | 3 +++ cmd/query/main.go | 2 ++ plugin/storage/es/spanstore/reader.go | 3 +-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go index 1b3a1ecec47..155ee7a47e6 100644 --- a/cmd/all-in-one/main.go +++ b/cmd/all-in-one/main.go @@ -55,6 +55,7 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" + storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" jc "github.com/jaegertracing/jaeger/thrift-gen/jaeger" sc "github.com/jaegertracing/jaeger/thrift-gen/sampling" zc "github.com/jaegertracing/jaeger/thrift-gen/zipkincore" @@ -286,6 +287,8 @@ func startQuery( } opentracing.SetGlobalTracer(tracer) + spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, baseFactory.Namespace("query", nil)) + apiHandler := queryApp.NewAPIHandler( spanReader, depReader, diff --git a/cmd/query/main.go b/cmd/query/main.go index ef814f8b83f..46bb18caedb 100644 --- a/cmd/query/main.go +++ b/cmd/query/main.go @@ -41,6 +41,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/version" "github.com/jaegertracing/jaeger/plugin/storage" istorage "github.com/jaegertracing/jaeger/storage" + storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" ) func main() { @@ -107,6 +108,7 @@ func main() { if err != nil { logger.Fatal("Failed to create span reader", zap.Error(err)) } + spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, baseFactory.Namespace("query", nil)) dependencyReader, err := storageFactory.CreateDependencyReader() if err != nil { logger.Fatal("Failed to create dependency reader", zap.Error(err)) diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go index a8a9b2daa03..eeea231367e 100644 --- a/plugin/storage/es/spanstore/reader.go +++ b/plugin/storage/es/spanstore/reader.go @@ -29,7 +29,6 @@ import ( "github.com/jaegertracing/jaeger/pkg/es" "github.com/jaegertracing/jaeger/plugin/storage/es/spanstore/dbmodel" "github.com/jaegertracing/jaeger/storage/spanstore" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" ) const ( @@ -109,7 +108,7 @@ type SpanReaderParams struct { // NewSpanReader returns a new SpanReader with a metrics. func NewSpanReader(p SpanReaderParams) spanstore.Reader { - return storageMetrics.NewReadMetricsDecorator(newSpanReader(p), p.MetricsFactory) + return newSpanReader(p) } func newSpanReader(p SpanReaderParams) *SpanReader {