Prometheus: Add ExecutedQueryString to first frame only (#73678)

This commit is contained in:
Kyle Brandt 2023-08-23 11:56:19 -04:00 committed by GitHub
parent a01a903492
commit fe774415b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View File

@ -41,11 +41,14 @@ func (s *QueryData) parseResponse(ctx context.Context, q *models.Query, res *htt
}
// The ExecutedQueryString can be viewed in QueryInspector in UI
for _, frame := range r.Frames {
for i, frame := range r.Frames {
if s.enableWideSeries {
addMetadataToWideFrame(q, frame)
} else {
addMetadataToMultiFrame(q, frame, s.enableDataplane)
if i == 0 {
frame.Meta.ExecutedQueryString = executedQueryString(q)
}
}
}
@ -112,7 +115,6 @@ func addMetadataToMultiFrame(q *models.Query, frame *data.Frame, enableDataplane
if frame.Meta == nil {
frame.Meta = &data.FrameMeta{}
}
frame.Meta.ExecutedQueryString = executedQueryString(q)
if len(frame.Fields) < 2 {
return
}

View File

@ -7,8 +7,7 @@
// ],
// "custom": {
// "resultType": "exemplar"
// },
// "executedQueryString": "Expr: histogram_quantile(0.99, sum(rate(traces_spanmetrics_duration_seconds_bucket[15s])) by (le))\nStep: 15s"
// }
// }
// Name: exemplar
// Dimensions: 14 Fields by 62 Rows
@ -44,8 +43,7 @@
],
"custom": {
"resultType": "exemplar"
},
"executedQueryString": "Expr: histogram_quantile(0.99, sum(rate(traces_spanmetrics_duration_seconds_bucket[15s])) by (le))\nStep: 15s"
}
},
"fields": [
{

View File

@ -33,8 +33,7 @@
// ],
// "custom": {
// "resultType": "matrix"
// },
// "executedQueryString": "Expr: \nStep: 1s"
// }
// }
// Name: prometheus_http_requests_total{code="400", handler="/api/v1/query_range", job="prometheus"}
// Dimensions: 2 Fields by 2 Rows
@ -121,8 +120,7 @@
],
"custom": {
"resultType": "matrix"
},
"executedQueryString": "Expr: \nStep: 1s"
}
},
"fields": [
{