Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Dynamic content in repeated row/panel title #28601

Closed
badrpc opened this issue Oct 28, 2020 · 5 comments
Closed

Dynamic content in repeated row/panel title #28601

badrpc opened this issue Oct 28, 2020 · 5 comments
Labels
area/dashboard/templating gh-discussions A label used for bulk-migration of FRs/ERs to discussions needs investigation for unconfirmed bugs. use type/bug for confirmed bugs, even if they "need" more investigating

Comments

@badrpc
Copy link

badrpc commented Oct 28, 2020

I have some data describing network interfaces in Prometheus fetched via SNMP. These data is indexed with ifIndex metric:

ifIndex{ifIndex="1",instance="192.168.0.4",job="snmp_exporter"}	1
ifIndex{ifIndex="2",instance="192.168.0.4",job="snmp_exporter"}	2
ifIndex{ifIndex="3",instance="192.168.0.4",job="snmp_exporter"}	3
...

and using ifIndex one can get descriptions:

ifName{ifIndex="1",ifName="0/1",instance="192.168.0.4",job="snmp_exporter"}	1
ifName{ifIndex="2",ifName="0/2",instance="192.168.0.4",job="snmp_exporter"}	1
ifName{ifIndex="3",ifName="0/3",instance="192.168.0.4",job="snmp_exporter"}	1
...

and performance metrics:

ifHCInOctets{ifIndex="1",instance="192.168.0.4",job="snmp_exporter"}	3426169443
ifHCInOctets{ifIndex="2",instance="192.168.0.4",job="snmp_exporter"}	2492869885
ifHCInOctets{ifIndex="3",instance="192.168.0.4",job="snmp_exporter"}	134804372659
...

I have a dashboard with variables:

device: label_values(up{job="snmp_exporter"}, instance)
ifIndex: query_result(ifIndex{instance="${device}"})

User selects a device in a drop-down list and dashboard has a row per each ifIndex with performance metrics. Unfortunately all rows look very similar and it is very hard to understand which row correspond to which interface. The best thing I could do is include ifIndex in the row or panel title. But ifIndex is a technical detail of the hardware and not very useful to the user: (indices don't necessarily correspond to interface numbers, there are some internal interfaces and so on). So what would be useful is to have ifName in the row title. Unfortunately I cannot find a working solution for this.

I have tried adding ifName variable to the dashboard and that would work if a single ifIndex was selected in UI, but showing only one interface at a time would limit usefulness of the dashboard. Unfortunately as soon as I select multiple values for ifIndex, ifName variable would also get multiple values.

It appears that I could probably get what I want if row/panel title allowed calling label_values(ifName{instance="$device"},ifName) function (the one available in variable definitions). Another possible option I can think of is to have a special type of a variable reevaluated for each repeated row or panel.

Does this sound as a reasonable feature request or are there any other way to implement what I need?

@hugohaggmark
Copy link
Contributor

@badrpc what happens if you create a hidden query variable with label_values(ifName{instance="$device"},ifName)?

Couldn't you use that hidden variable as the title for the rows?
I might be not understand your problem here (I'm not a Prometheus expert) so I'm sorry if I'm asking a stupid question.

Regarding if this is a reasonable feature request I don't think we want to introduce more variable types except if there is a lot of demand from the community.

@hugohaggmark hugohaggmark added this to Needs triage in Platform Backlog via automation Oct 28, 2020
@hugohaggmark hugohaggmark moved this from Needs triage to Feature requests in Platform Backlog Oct 28, 2020
@hugohaggmark hugohaggmark moved this from Feature requests to Needs investigation or followup in Platform Backlog Oct 28, 2020
@hugohaggmark hugohaggmark added needs investigation for unconfirmed bugs. use type/bug for confirmed bugs, even if they "need" more investigating area/dashboard/templating labels Oct 28, 2020
@badrpc
Copy link
Author

badrpc commented Oct 28, 2020

That's what I tried to explain when described the ifName variable (I wasn't very clear I guess). Basically with another variable defined as label_values(ifName{instance="$device"},ifName) or better as label_values(ifName{instance="$device",ifIndex=~"$ifIndex"},ifName) this variable will have it's own set of values. But this values won't be synchronized with ifIndex in repeated rows/panels. Because rows are repeated for ifIndex the first value of ifName will be used. If I allow it to include "All" this will be literal contents of $ifName in each row. Otherwise it gets the first value from the set returned by label_values. This value will not change between rows. So if only a single ifIndex is selected then this approach works (because there's only one item for ifName). But as I said it limits the usefulness of the dashboard because often one would want to look at a few interfaces at the same time.

I haven't had a chance to look at the code yet. From UI perspective it doesn't actually look like a new type of variable - rather a new evaluation mode. Currently there are Never, On Dashboard Load and On Time Rage Change. So if a variable was evaluated "Per each repeated row/panel" it could work I suppose. But I don't know how much work that would require.

@badrpc
Copy link
Author

badrpc commented Oct 28, 2020

And since you mentioned demand from the community there is #1032. Maybe I misread it but I don't think it was properly resolved. It was closed with a merge of #27829. But the latter only allows for statically configured mapping which I think is not what many people on that feature request were talking about. And complexity of suggested workarounds there is just terrible - from an extra table/database to a dedicated service to perform mapping.

@hugohaggmark
Copy link
Contributor

@badrpc gotcha: and thank you for clarifying this, I'll reopen that issue. I can tell with some confidence that we will not add Per each repeated row/panel option because it won't work as the repeated rows are calculated after all the variables have finished loading. So that would introduce a catch 22 moment.

We're working on the next generation of dashboards that can be more dynamic but that is far from being done.

I'm sorry that I can't come up with any other alternatives @badrpc

@natellium natellium removed this from Needs investigation or followup in Platform Backlog Jul 14, 2021
@pkolyvas pkolyvas added gh-discussions A label used for bulk-migration of FRs/ERs to discussions and removed type/feature-request labels Aug 20, 2021
@pkolyvas
Copy link
Contributor

We're in the process of moving Grafana feature requests to GitHub Discussions. This issue is being moved to Discussions or has been moved from our issues list, depending on where you're seeing this message.

We hope to use the discussion thread to continue building use cases, and additional evidence based on engagement/voting, in order to help us prioritize this feature request later on down the road.

As with all things Grafana, we value your input and participation in this project and appreciate your patience during this transitional period. Looking forward to the discussion!

@grafana grafana locked and limited conversation to collaborators Aug 20, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
area/dashboard/templating gh-discussions A label used for bulk-migration of FRs/ERs to discussions needs investigation for unconfirmed bugs. use type/bug for confirmed bugs, even if they "need" more investigating
Projects
None yet
Development

No branches or pull requests

3 participants