Exemplar Query API query parameter

28 views
Skip to first unread message

Ben Ye

unread,
Apr 28, 2021, 2:55:31 PM4/28/21
to Prometheus Developers
Hi Prometheus developers & maintainers,

I am looking at the Exemplar API and I have one question about the query parameter.

Here query supports any promql expression. But from the code, what we need is just label matchers to select series. Then why do we use query as the parameter instead of using match[]?

Best regards,
Ben Ye

Ben Ye

unread,
Apr 28, 2021, 7:20:53 PM4/28/21
to Prometheus Developers, roidel...@prometheus.io
Hi Julien,

Thanks for the reply. That makes sense to me and it is very natural to implement it this way in Grafana.

I am working on adding a new promtool subcommand for querying exemplars with a query flag. From the UX perspective, it is a little bit weird to let users provide promql queries instead of matchers. It might cause some confusion (at least to me).

Best regards,
Ben Ye

On Wed, Apr 28, 2021 at 6:55 PM Julien Pivotto <roidel...@prometheus.io> wrote:
On 28 Apr 11:55, Ben Ye wrote:
> Hi Prometheus developers & maintainers,
>
> I am looking at the Exemplar API
> I have one question about the query parameter.
>
> Here query supports any promql expression. But from the code
> what we need is just label matchers to select series. Then why do we use
> query as the parameter instead of using match[]?
>
> Best regards,
> Ben Ye

It seems that it was chosen so that it was easy to get the exemplars of
a promql query without requiring the requester to analyze the query to
extract the series from the query.

>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/027851f8-93e6-47c0-9ca0-f1923508d837n%40googlegroups.com.


--
Julien Pivotto
@roidelapluie

Bartłomiej Płotka

unread,
Apr 29, 2021, 4:34:07 AM4/29/21
to Ben Ye, Prometheus Developers, Julien Pivotto
Thanks, Ben, this is a very valid point. Is there a way we can improve this? One solution would be:

Update parameter name OR/And docs for exemplars query to (something like `extract-query`). 

  • query=<string>: Prometheus expression query string.

Kind Regards,
Bartek Płotka (@bwplotka)


Tom Wilkie

unread,
Apr 29, 2021, 4:48:53 AM4/29/21
to Bartłomiej Płotka, Ben Ye, Prometheus Developers, Julien Pivotto
I'd note a label selector (eg {foo="bar"}) _is_ a valid PromQL query, and can be passed to this API...

Cheers

Tom

Reply all
Reply to author
Forward
0 new messages