-
Notifications
You must be signed in to change notification settings - Fork 469
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
Support UTF-8 in metric and label names #623
Comments
The path for pushing metrics into the Pushgateway looks like
Currently, job names and label values can be encoded with base64url, in which case
Some ideas I considered for encoding UTF-8 label names in URLs, using the same base64url approach:
Metric and label names in the request body are validated using functions from the |
is there content negotiation with calls to pushgateway, or do people just hit the endpoint? (What if someone sends either of these formats to an older endpoint that doesn't understand the new grammar?) |
There's no content negotiation while pushing metrics into the Pushgateway. The URL is parsed as is, splitting the labels with |
So yeah, the base64 trick was introduced prior to 1.0.0. So we never had the situation where a PGW of v1+ would be confronted with a newer version of the push protocol it couldn't understand. Content negotiation with push is hard, because you need multiple round trips for it. Ideally, we find a solution that still works for older v1+ PGWs transparently. But I have currently no idea how to do that. Or we do something that newer pushers have to retry with a legacy version of the names if they get an error back… |
Idea: Let's just use the already proposed bespoke text escaping instead of using base64 escaping. A PGW with UTF-8 support enabled will simply unescape. Pros:
Cons:
|
To not introduce a (technically) breaking change, we can make the UTF-8 support opt-in for now (finally feature flags in PGW! ;). |
I think it is fine to look for "U__" and unescape automatically if we see it. We decided in the design that it is unlikely people will name metrics like that, and if they do and the unescaping fails, we just return the name as-is anyway |
Yeah, I think the escaping alternative makes more sense. +1 on the opt-in. I'll start looking into it, thanks for the feedback! |
Implementation merged. I'll try to cut a new release next week or so. |
This seems like a different, though related issue? Is this a UI in the pushgateway? I'd prefer to leave this bug as closed and open a new one in the right place for this. |
Yes, this is the PGW UI (and the PGW has its own UI, no code pulled in from other repos). I do think this is part of the UTF-8 support. A new bug would also be filed in this repo, so I think keeping this open is easier. |
It should also be pretty easy to fix. Essentially just quoting the name, whenever is needed, and then escape quotes within a name. |
As raised in prometheus/client_ruby#306, we will need some way to encode UTF-8 metric and label names in pushgateway URLs. This may be tricky because the current method does allow for encodings of job names and label values, and any solution would have to be backwards compatible with the current syntax. Thoughtful design work is needed.
See: https://github.com/prometheus/pushgateway#url
Feature request
Use case. Why is this important?
UTF-8 Support is coming to prometheus and we need to cover this usecase.
The text was updated successfully, but these errors were encountered: