Native Metadata support in PromQL - #99
roidelapluie wants to merge 2 commits into
Conversation
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
|
|
||
| Query results: | ||
|
|
||
| Metadata are only visible in query outputs once promoted, in which case they appear as labels. |
There was a problem hiding this comment.
Maybe I missed something: is there a way to promote metadata without applying a matcher? (eg. let's say I want to get foo with the value of resource.power.status but don't want to filter based on resource.power.status)
There was a problem hiding this comment.
We could have foo{~resource.cpu.name} or foo{~resource.cpu.name as cpu_name}, WDYT?
There was a problem hiding this comment.
Makes sense to me. If we support aliases in the selector like that, I don't think we need to support them elsewhere (eg. in binary operations like foo and on (~resource.power.status as power_status) bar).
|
|
||
| 6. Native metadata can be aliased with the `as` keyword. | ||
|
|
||
| `foo and on (~resource.power.status as power_status) bar` |
There was a problem hiding this comment.
How would this look for aggregations? sum by (~resource.power.status as power_status) (foo) perhaps?
|
|
||
| `foo and on (~resource.power.status as power_status) bar` | ||
|
|
||
| In this case, the metadata will be promoted on the left, on the right, or on both sides. |
There was a problem hiding this comment.
I'm wondering about some edge cases:
How would this work if someone wanted to promote metadata from just the left or right side, but not both? eg. I want to promote resource.power.status from the left side as power_status, but not from the right.
Related: would it be possible to promote different metadata to the same label from different sides (eg. resource.power.status from left and resource.foo.bar from right, with both being aliased to power_status)?
What happens if the alias exists as a label on the series? (I'm assuming the aliased metadata takes precedence?)
There was a problem hiding this comment.
WDYT of foo{~resource.power.status as power_status} and on (power_status) bar?
There was a problem hiding this comment.
For aliases, I we can chose: warn or error. I think we could probably error to start with.
There was a problem hiding this comment.
WDYT of
foo{~resource.power.status as power_status} and on (power_status) bar?
I prefer this - if aliases are only possible in selectors, then we don't need to think about how to make them work in a bunch of other places like binops and aggregations.
Would we also support aliasing ordinary labels (eg. foo{env as region})? This would be nice from a consistency standpoint, and remove the need to use label_replace or label_join in some circumstances.
For aliases, I we can chose: warn or error. I think we could probably error to start with.
Sounds good to me.
No description provided.