Allow dynamic list of labels in custom legend #51386
Closed
AntoineThebaud
announced in
Dashboards, Panels & Visualizations
Replies: 1 comment
-
Hello, as you may have heard, we are transitioning away from using discussions to discuss feature requests. We are migrating this discussion to an issue and closing the discussion. The issue is #82998. Feel free to continue the discussion around this there. Thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
(datasource: Prometheus)
It's not possible currently to provide a custom formatting of the legend when having a dynamic list of labels in the query result.
See an example with the following:
Here
{{label_name}}
actually equals to empty string, thus it falls back to the Auto legend,. So if I try to add some text behind, it stops being rendered:For sure if I provide the actual labels being used, it works:
But again, the list of labels is dynamically generated from the grouping variable here, so we dont want to 'hardcode' the labels like that.
We actually found a solution that works when selecting 1 value only in the
grouping
dropdown: "double interpolation" by interpolating the value of the dropdown within curly braces:But for sure this doesnt work anymore when you select multiple values:
Thus I am looking for a solution to achieve this. We thought about a solution with @w4rgrum that would be to add a new variable format option. This could look like this:
For sure the separator character (here comma) is subject to debate.
So in the end we would input in the legend textbox:
${grouping:legend}-custom
Does that proposal look fine to you? If not, how could the implementation be done to properly allow using a dynamic list of labels in a custom legend?
Beta Was this translation helpful? Give feedback.
All reactions