Hi @outofrange, I have the same requirement. I found a way to do this:
- Query with “Both” type
- Use two transforms
2.1Series to rows
: merge Range series and Instant series.
2.2Sort by
: sort combined series by theTime
field to ensure the series’s last value is the latest data.
Following is my use case, a metric to record the request total:
Query with the
Both
type
Use
Series to rows
and Sort by
by the Time
field
Following is explain how it works:
Disable the tho transforms to check details. When querying with the
Both
type, Grafana actually gets two series. The first is the range series.
The second is the instant series.
Enable
Series to rows
transform. The range series and the instant series will be merged into one series. But the order is descending by time filed, which will cause the last value is not the latest value.
Enable
Sort by
transform and by the Time
field to ensure the last value is the latest value.