Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add labels to query metrics? #107

Open
alexadmin opened this issue Nov 29, 2022 · 1 comment
Open

How to add labels to query metrics? #107

alexadmin opened this issue Nov 29, 2022 · 1 comment

Comments

@alexadmin
Copy link

Is it possible to add labels to query metrics? I only noticed that function in MySQL exported
https://github.com/braedon/prometheus-mysql-exporter/blob/master/exporter.cfg
"QueryValueColumns = ni,ptang"

thank you.

@ntavares
Copy link

Hi @alexadmin I'll invite you to explain your use case a bit further, in particular where to obtain these labels from...?
@braedon will correct if I'm wrong, but I think the "hits" metric is taken from the results of ES, which is basically a count(*) aggregation on all results which will therefore be absent of any field, by definition - if your intention was to use those as labels, as your reference to mysql's exporter' QueryValueColumns seems to suggest.

I do have a use case for labels, and they could even be static: we run the same query for multiple namespaces and, in order to distinguish between them, we have to use 'agg' (aggregation) which will then produce a metric "by_namespace". The problems with this approach are 1) that we have these multiple queries all running the same query, multiple times and 2) there is an inevitable overlapping with the "hits" metric, obviously.

I just had a look at the code, it's fairly simple to add static labels... @braedon would you be willing to merge a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants