-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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 possibility to change text case #1548
Comments
To be clear, you are taking about PromQL here, not relabel configs? |
Yes. Maybe in the form of The problem with "use configuration mangement" is that a static list of all label values would need to be known upfront. |
Any other comments or concerns? I've been thinking about the function name for a bit now, maybe |
I think offering a tr variant would get too complicated, as we can't sanely do all the options in one function. Keeping it simple with upper/lowercase would be best.
|
I'll add |
I'm not sure how that would work, can you give an example? How can I apply a function with such signature to a specific label value? For example to allow label matching with other metrics? The reason I suggested a more generic translate function is that it'd cover another issue we have with a system which removes all dashes from a name. Though, the cardinality of values is way lower, so we might be able to solve that with rules. I agree that |
Whoops, you're right, that wouldn't actually help for your use case. The question then is whether we want upper/lower methods at all or something more complex, or nothing. |
How about adding something to the syntax of the So
If needed one day, we could implement the full Bash-style |
We're using Go's standard If we were to allow something this powerful, the sanest way would be to give direct access to console templates from promql. |
That would be way more consistent. Do you have an idea how to do this concretely? |
Something like It's already possible to access console templates via Console templates don't currently have case functions, but they're easy to add. |
That makes sense to me. |
Currently that'd introduce a circular dependency between the |
I like the proposal, it's basically a more flexible |
I was hoping to be able to use a |
I was looking for this today +1 |
Can you expand on why you were looking for it? Label values are meant to be opaque in Prometheus. |
I ran into a need for this today and wanted to raise my thoughts. While I would agree with the theory of fixing at source instead of midstream, when you have over 100 prometheus instances in production, pushing label fixes brings time, risk and even assumes that you have control of the source when you may not, like in the case of federating other teams metrics. Being able to quickly address label changes so that evaluations will fire as expected is really essential. My use case is mainly the severity labels i find in my infrastructure, where I have some teams using [pP0-9] (eg p1 or P1) or other variants on things |
That sounds like something already supported.
|
hmm thats actually a super slick solution, thank you. Though i wonder what other edge cases ill run into hah |
Some use case: You want to join two metrics from two exporters (a virtual machine name, and the guest operating system hostname), one of them is uppercase the other one is lowercase. Same with mac address, uuid, etc . You have multiple metrics with a label that is sometime uppercase, and sometime it's lowercase ( like an URL which are user input), you want to sum them and normalize the timeserie label. Or you just want to normalize a label to lowecase. |
Machine names should have fixed case.
mac addresses and uuids should be lowercase.
User input should NEVER be in labels at it creates too much cardinality. |
Sometimes you do not have control over this and need to normalize with lower(). |
can we use upper/lowercase function in relabel_configs now? like
|
Example: You use AWS MSK and their JMX exporter feature. You don't have any access to their config and unfortunately the do not normalize the label names, so I get I see your point in this not being your problem at all... still, I would like Prometheus to be a tool that I can also use for non-perfect world environments. |
It seems there is no consensus for a PromQL solution. I wonder if we could start with action: lower and action: upper in relabel configs. It would only change the label values, I feel like labels names should not require this. |
#10641 introduces the relabel actions. |
We have unfortunately two systems which expose labels in both upper case and lower case. While we're about to consolidate these, this takes time. It'd be helpful if prometheus would allow to transform such labels, so that the issue can be mitigated by creating an evaluation rule.
I'm not sure if
lowercase()
anduppercase()
make sense, or if we could come up with a more generic variant to replace any kind of characters (liketr
). Or is there some trick to achieve that withlabel_replace
already?The text was updated successfully, but these errors were encountered: