Skip to content

Commit

Permalink
creates tracer in the parent method
Browse files Browse the repository at this point in the history
Signed-off-by: Afzal Ansari <[email protected]>
  • Loading branch information
afzal442 committed Jul 9, 2023
1 parent 642d772 commit 8425410
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugin/metrics/prometheus/metricsstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type (
latencyMetricName string
callsMetricName string
operationLabel string
tracer jtracer.JTracer
}

promQueryParams struct {
Expand Down Expand Up @@ -102,6 +103,7 @@ func NewMetricsReader(logger *zap.Logger, cfg config.Configuration) (*MetricsRea
callsMetricName: buildFullCallsMetricName(cfg),
latencyMetricName: buildFullLatencyMetricName(cfg),
operationLabel: operationLabel,
tracer: jtracer.New(),
}

logger.Info("Prometheus reader initialized", zap.String("addr", cfg.ServerURL))
Expand Down Expand Up @@ -225,8 +227,7 @@ func (m MetricsReader) executeQuery(ctx context.Context, p metricsQueryParams) (
}
promQuery := m.buildPromQuery(p)

tp := jtracer.New().OTEL
ctx, span := startSpanForQuery(ctx, p.metricName, promQuery, tp)
ctx, span := startSpanForQuery(ctx, p.metricName, promQuery, m.tracer.OTEL)
defer span.End()

queryRange := promapi.Range{
Expand Down

0 comments on commit 8425410

Please sign in to comment.