-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
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
Add more prometheus labels #128607
base: dev
Are you sure you want to change the base?
Add more prometheus labels #128607
Conversation
Hey there @knyar, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
@@ -90,6 +92,7 @@ | |||
CONF_FILTER = "filter" | |||
CONF_REQUIRES_AUTH = "requires_auth" | |||
CONF_PROM_NAMESPACE = "namespace" | |||
CONF_INCLUDE_EXTRA_LABELS = "include_extra_labels" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding labels is backwards compatible, so I don't think we need a new configuration parameter for this.
I did a major pass to add test cases for I still need to do another pass to add tests for things like:
Greatly increases the surface area but it will be really nice to sort metrics more easily after this. |
This looks extremely useful, thanks so much! Any likelihood of getting the |
Definitely interested in doing that. My first attempt a year ago included that. I think it's likely at this point I won't be able to include that on this pass though and that will be part of a follow up PR. I really want to ship a basic set of additional labels in January and then start adding a few more after. I'm currently writing something on the order of 500 lines of test changes for every 1 line of app logic change. And that's a little bit de-motivating. So I'm wary of adding too many logic changes to a single PR at this point. But I think that's very reasonable and achievable as an end goal. |
I believe at the moment device class is already used to generate metric names for sensors: core/homeassistant/components/prometheus/__init__.py Lines 701 to 706 in 8b08cb9
Is that not working for your use case? Or do you need device class propagated to Prometheus for entities that are not sensors? |
Hey @jzucker2 let me know how I can help you with the test cases. I really appreciate the work you put in here and I'd like to help you getting this across the finish line :) |
Sorry! I missed this! I'd love help with the test cases. I will clean this up this week and merge in latest |
Breaking change
Proposed change
This is a first pass right now to make the prometheus labels more dynamic (following up from #113849)
This is an example from some updated unit tests:
I've also got my old frankenstein's monster branch from my original attempt here jzucker2#1
Useful recent change: #133219
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: