mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prometheus: Add ExecutedQueryString to first frame only (#73678)
This commit is contained in:
parent
a01a903492
commit
fe774415b5
@ -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
|
// The ExecutedQueryString can be viewed in QueryInspector in UI
|
||||||
for _, frame := range r.Frames {
|
for i, frame := range r.Frames {
|
||||||
if s.enableWideSeries {
|
if s.enableWideSeries {
|
||||||
addMetadataToWideFrame(q, frame)
|
addMetadataToWideFrame(q, frame)
|
||||||
} else {
|
} else {
|
||||||
addMetadataToMultiFrame(q, frame, s.enableDataplane)
|
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 {
|
if frame.Meta == nil {
|
||||||
frame.Meta = &data.FrameMeta{}
|
frame.Meta = &data.FrameMeta{}
|
||||||
}
|
}
|
||||||
frame.Meta.ExecutedQueryString = executedQueryString(q)
|
|
||||||
if len(frame.Fields) < 2 {
|
if len(frame.Fields) < 2 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
// ],
|
// ],
|
||||||
// "custom": {
|
// "custom": {
|
||||||
// "resultType": "exemplar"
|
// "resultType": "exemplar"
|
||||||
// },
|
// }
|
||||||
// "executedQueryString": "Expr: histogram_quantile(0.99, sum(rate(traces_spanmetrics_duration_seconds_bucket[15s])) by (le))\nStep: 15s"
|
|
||||||
// }
|
// }
|
||||||
// Name: exemplar
|
// Name: exemplar
|
||||||
// Dimensions: 14 Fields by 62 Rows
|
// Dimensions: 14 Fields by 62 Rows
|
||||||
@ -44,8 +43,7 @@
|
|||||||
],
|
],
|
||||||
"custom": {
|
"custom": {
|
||||||
"resultType": "exemplar"
|
"resultType": "exemplar"
|
||||||
},
|
}
|
||||||
"executedQueryString": "Expr: histogram_quantile(0.99, sum(rate(traces_spanmetrics_duration_seconds_bucket[15s])) by (le))\nStep: 15s"
|
|
||||||
},
|
},
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
// ],
|
// ],
|
||||||
// "custom": {
|
// "custom": {
|
||||||
// "resultType": "matrix"
|
// "resultType": "matrix"
|
||||||
// },
|
// }
|
||||||
// "executedQueryString": "Expr: \nStep: 1s"
|
|
||||||
// }
|
// }
|
||||||
// Name: prometheus_http_requests_total{code="400", handler="/api/v1/query_range", job="prometheus"}
|
// Name: prometheus_http_requests_total{code="400", handler="/api/v1/query_range", job="prometheus"}
|
||||||
// Dimensions: 2 Fields by 2 Rows
|
// Dimensions: 2 Fields by 2 Rows
|
||||||
@ -121,8 +120,7 @@
|
|||||||
],
|
],
|
||||||
"custom": {
|
"custom": {
|
||||||
"resultType": "matrix"
|
"resultType": "matrix"
|
||||||
},
|
}
|
||||||
"executedQueryString": "Expr: \nStep: 1s"
|
|
||||||
},
|
},
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user