Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd possibility to change text case #1548
Comments
grobie
added
the
feature-request
label
Apr 12, 2016
grobie
changed the title
[Feature request] Add possibility to change text case
Add possibility to change text case
Apr 12, 2016
This comment has been minimized.
This comment has been minimized.
|
To be clear, you are taking about PromQL here, not relabel configs? |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
Any other comments or concerns? I've been thinking about the function name for a bit now, maybe |
This comment has been minimized.
This comment has been minimized.
|
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.
|
This comment has been minimized.
This comment has been minimized.
|
I'll add |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
How about adding something to the syntax of the So
If needed one day, we could implement the full Bash-style |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
That would be way more consistent. Do you have an idea how to do this concretely? |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
That makes sense to me. |
This comment has been minimized.
This comment has been minimized.
|
Currently that'd introduce a circular dependency between the |
This comment has been minimized.
This comment has been minimized.
|
I like the proposal, it's basically a more flexible |
grobie commentedApr 12, 2016
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_replacealready?