Fix: correctly close trace span in Prometheus and Loki data sources (#57774)
* rename span for loki
This commit is contained in:
@@ -184,17 +184,17 @@ func queryData(ctx context.Context, req *backend.QueryDataRequest, dsInfo *datas
|
||||
}
|
||||
|
||||
for _, query := range queries {
|
||||
_, span := tracer.Start(ctx, "alerting.loki")
|
||||
_, span := tracer.Start(ctx, "datasource.loki")
|
||||
span.SetAttributes("expr", query.Expr, attribute.Key("expr").String(query.Expr))
|
||||
span.SetAttributes("start_unixnano", query.Start, attribute.Key("start_unixnano").Int64(query.Start.UnixNano()))
|
||||
span.SetAttributes("stop_unixnano", query.End, attribute.Key("stop_unixnano").Int64(query.End.UnixNano()))
|
||||
defer span.End()
|
||||
|
||||
logger := logger.FromContext(ctx) // get logger with trace-id and other contextual info
|
||||
logger.Debug("Sending query", "start", query.Start, "end", query.End, "step", query.Step, "query", query.Expr)
|
||||
|
||||
frames, err := runQuery(ctx, api, query)
|
||||
|
||||
span.End()
|
||||
queryRes := backend.DataResponse{}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user