-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Merge MySQL metrics inside 1 metric with label #5987
Comments
I guess it depends on what query you want to run, with InfluxQL your proposed layout wouldn't be great for math across fields, or Kapacitor alerts that need multiple field values. In the case where you are using Flux you can do your query today. I'll take your word that it can't be done in PromQL, since I don't know it very well, and also I agree it can't work with topk to rank commands. However, I'm quite reluctant to change these metrics right now due to the disruption is causes. We have an idea to provide processors that can do this transformation in general though, so I wrote them up today and opened #5991. Could you take a look and let me know what you think, could this work for you? |
That pivot would do the trick indeed. [[processors.pivot]] For example :) |
Also I don't know how big the customerbase is that uses Prometheus. Anyway, your call :) |
In your case you will want to use the unpivot variation. It will unpivot every field that is added to the processor, I don't think you will need a regex but you can combine this with the metric filtering. Since the line protocol is like this:
You should be able to do: [[processors.unpivot]]
namepass = ["mysql"]
fieldpass = ["com_*"]
tag_key = "command"
value_key = "value" The output will be like this:
Which I believe converts to this prometheus format:
I'll think about this, but I don't think you would want this across the board and I also think we should be careful not to have too many formats. We already have something in motion on the prometheus translation too in #4415. |
Just to bump this a bit, as it seems to now cause issues with Grafana due to the huge amount of queries in 1 graph because of this. Is it still the idea to use unpivot? Or might we want to improve the exporter for Prometheus? |
I know it has been a while, but it appears that the unpivot function helps to resolve the issue you were seeing. We already have two different prometheus formats as well that users can use. If this is still an issue, were these options successful? Thanks |
Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Page. Thank you! |
Feature Request
Proposal:
It might be a good idea to consolidate some MySQL metrics inside 1 metric with labels.
Current behavior:
For example the mysql_com_xxx metric is returned 158 times with different values.
mysql_com_alter_db
mysql_com_alter_db_upgrade
mysql_com_alter_event
mysql_com_alter_function
mysql_com_alter_instance
mysql_com_alter_procedure
mysql_com_alter_server
mysql_com_alter_table
mysql_com_alter_tablespace
mysql_com_alter_user
mysql_com_analyze
mysql_com_assign_to_keycache
....
Desired behavior:
It might be better to change the metric to:
mysql_com{command="alter_db"}
mysql_com{command="analyze"}
etc.
Use case:
If you want to use those metrics inside Grafana with a Prometheus backend, you need to write 158 queries! This is not very flexible.
Also things like topk etc won't work.
I could create a pull request for this if we would like to get this implemented :)
Might be nice to have this optional via config variable? Then people can choose to keep existing output.
The text was updated successfully, but these errors were encountered: