mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 04:04:00 -06:00
Prometheus: (Chore/Instrumentation) add trace spans for result proces… (#67858)
Prometheus: (Chore/Instrumentation) add trace spans for result processing
This commit is contained in:
parent
a340d102a6
commit
4abc56c583
@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/models"
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/querydata/exemplar"
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/utils"
|
||||
"github.com/grafana/grafana/pkg/util/converter"
|
||||
)
|
||||
|
||||
@ -24,6 +25,9 @@ func (s *QueryData) parseResponse(ctx context.Context, q *models.Query, res *htt
|
||||
}
|
||||
}()
|
||||
|
||||
ctx, endSpan := utils.StartTrace(ctx, s.tracer, "datasource.prometheus.parseResponse", []utils.Attribute{})
|
||||
defer endSpan()
|
||||
|
||||
iter := jsoniter.Parse(jsoniter.ConfigDefault, res.Body, 1024)
|
||||
r := converter.ReadPrometheusStyleResult(iter, converter.Options{
|
||||
MatrixWideSeries: s.enableWideSeries,
|
||||
@ -46,13 +50,15 @@ func (s *QueryData) parseResponse(ctx context.Context, q *models.Query, res *htt
|
||||
}
|
||||
|
||||
if r.Error == nil {
|
||||
r = s.processExemplars(q, r)
|
||||
r = s.processExemplars(ctx, q, r)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (s *QueryData) processExemplars(q *models.Query, dr backend.DataResponse) backend.DataResponse {
|
||||
func (s *QueryData) processExemplars(ctx context.Context, q *models.Query, dr backend.DataResponse) backend.DataResponse {
|
||||
_, endSpan := utils.StartTrace(ctx, s.tracer, "datasource.prometheus.processExemplars", []utils.Attribute{})
|
||||
defer endSpan()
|
||||
sampler := s.exemplarSampler()
|
||||
labelTracker := exemplar.NewLabelTracker()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user