[ENHANCEMENT] prometheus: add instant mode to queries#752
Conversation
|
I think your approach is the better one, and it addresses exactly the objection @tgitelman raised on #746. My PR was constrained by A per-query instant flag on So I'd rather back #752 than push mine. I'll close #746 in favour of it. Two small things from my side that might be worth carrying over:
Nice work — this is the cleaner design. |
Nexucis
left a comment
There was a problem hiding this comment.
Thank you for your time working on this topic @SoWieMarkus and @s3onghyun ! It is really cool to see the community working together to reach a consensus and bring a good solution to a broader problem.
regarding the go-sdk and the schema it looks good to me.
Over to the frontend maintainers to finish the review even if the changes look reasonable to me :)
Signed-off-by: Markus Wieland <markus.wieland@sap.com>
b8db552 to
be5164f
Compare
|
@celian-garcia Implemented your feedback and updated the PR description / screenshots. |
|
Some thought about the PR, I did not review it for now. But for sure, it will needs option "auto", for setting the value to undefined
The disappears behavior, should be handled by the panel, to me. But maybe I miss something. |
|
Thanks @Nexucis 🙌 One concrete data point for @Gladorme's "the disappearing-series behaviour should be handled by the panel" — for StatChart at least, it already is: I can't speak to whether every panel + the explorer degrade as gracefully — that's the broader question you're raising and it's yours and @SoWieMarkus's call. Just wanted to confirm the StatChart corner, since that's the one I dug into. On |
Signed-off-by: Markus Wieland <markus.wieland@sap.com>
Signed-off-by: Markus Wieland <markus.wieland@sap.com>
Signed-off-by: Markus Wieland <markus.wieland@sap.com>
|
Thanks for your feedback @Gladorme.
Added it to the ButtonGroup and adjusted the code to support undefined as well and use that as the default. I also updated the screenshots in the PR description.
I just started contributing so I am not that familiar with the codebase. I hope I understand you correctly. I do not want to replace the sparkline option - that should definitely remain controllable via panel settings. It is just a "side effect" that the sparkline is disabled when the query is set to However, since instant and range queries can return different data, I think giving users a per-query override makes sense. Consider a Kubernetes pod lifecycle as an example: a pod can go down and be replaced by a new one spun up by the orchestrator. A range query would return all pods that were alive in the configured time frame. An instant query would only return the pods that are available at the moment. And this how I stumbled across this issue. I wanted to build a perses dashboard where I am only interested in the state of the pods that are available right now. And I couldn't find a way to build that with perses, since the stat panel is always using So my thinking is that But ofc there might be / are panels where an instant query would never makes sense. |

Description
This enhancement adds an instant query mode to the Prometheus time series query plugin, allowing individual queries to be executed as instant queries rather than range queries, independent of the panel-level query mode.
Previously, instant queries were only triggered by the panel context's mode field. With this change, a query-level instant flag can be set directly on the PrometheusTimeSeriesQuerySpec, giving users per-query control - similar to how Grafana handles this.
A prior attempt at instant query support (#738) was reverted because it broke the sparkline feature. A follow-up approach (#746) proposed coupling the query mode to the sparkline (instant for the stat value, range for the sparkline), but that approach has a drawback: instant and range queries can e.g. return a different number of time series if a series disappears within the configured time frame, leading to mismatches. This PR sidesteps that problem by attaching the instant flag to the individual query rather than the panel, decoupling it from sparkline behavior entirely. This way, the instant flag gives users explicit, unambiguous control over the query behavior.
Screenshots
Adds an query mode selection to the query:

instantalso disables the sparkline:Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes