grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
61.33k stars 11.71k forks source link

Template variables per row #5329

Open MatMeredith opened 8 years ago

MatMeredith commented 8 years ago

I have the following use case.

I can create template variables: node_types (containing the different node types) and nodes (containing all nodes of all types).

I want to show a graph for each node, but I want to group them by node type. Ideally, I would have a row repeat that repeats over each node type, and then have a panel repeat within the row that repeats over nodes of that type. But I don't think I can do this at the moment?

jbergler commented 8 years ago

I have a similar need where I would love to be able to do something like iterating and array of dictionaries. Consider the following data

[
  {"var1":1,"var2":2,"var3":3},
  {"var1":2,"var2":3,"var3":5}
]

It would be great to be able to repeat both rows and panels to be instantiated for each member of the array with variables for each key.

It would also be great if this JSON could be entered manually or loaded from a URL directly potentially including other variables along the way. ie, if I were to define a global variable $host that resolves from a graphite query, I would love to be able to load JSON from a url https://example.com/give/me/some.json?host=$host

voiprodrigo commented 6 years ago

+1 I'm really missing this feature of template variables per-row. Instead, have to create separate dashboards. Actually, even per-graph template variables would be useful.

bbczeuz commented 6 years ago

Another application:

The $second_variable needs to be evaluated once per $host. The current version (4.4.1) performs the evaluation just once and then returns the full outer join of $host and $second_variable. As hosts typically have different $mount_points/... this results in lots of empty (N/A) results.

SitWatchCloudRise commented 6 years ago

+1 I desperately need this feature to work. I am trying to use Prometheus snmp_exporter to gather metrics for Cisco switches and use Grafana repeated panels for displaying. the Grafana works magically well. However, I have difficulity to assign the title automatically on each panel based on the interface.

These are the sample of Prometheus data:

ifDescr{ifDescr="GigabitEthernet1/0/12",ifIndex="10112"} 1
ifDescr{ifDescr="GigabitEthernet1/0/13",ifIndex="10113"} 1
...
ifHCInOctets{ifIndex="10112"} 1.03615731929e+11
ifHCInOctets{ifIndex="10113"} 2.644180651e+09

Since all metrics are referenced with ifIndex, I managed to irate the rows by ifIndex. However, the title doesn't change along with the ifIndex: image

image

I guess the only way to work is to have variable per row or panel. Please do let me know if there is any other way to achieve this. Thanks and regards, Roger

NadMag commented 6 years ago

+1 I have encountered this issue in the following scenario:

  1. The first template variable is a collection of hostnames (Multi-Value selection is enabled).
  2. The second template variable Query whose value is a collection of full URLs of the selected hostname.

In order to repeat the entire valid permutations ie the Inner Join of both collections, I want to:

  1. Repeat row on hostname values.
    1. Repeat panels within each row for the query result for the matching hostname.

Currently the panel is repeated on the value of the template variable in the dashboard context.

I would give this issue a shot and attempt to fix it and PR.

vmoloko commented 6 years ago

+1 I Have a similar issue Two template variables: "hosts" = {h1, h2} "metrics" = {m1, m2, m3} Row is templated for "hosts", so there are two rows "h1" and "h2". Each row should contain a graph for all metrics (for the host declared in a row) and singlestats with metric values templated for "metrics" (3 singlestats in each row). So, in fact after second row wrapping and unwrapping the graph is missing, there are only singlestats. The same behavior is noticed if there are more than two hosts (only first row has the graph, on the other it is missing) and if only some of the hosts (not "All") are ticked. Also behavior is the same if graphs are static (i.e. do not contain any template variables).

eMerzh commented 6 years ago

Just to add my 2cts here, sorry for notification everyone:

my use case is that i have a dashboard with say 15 panels, but only one of them is using the template. And it make quite hard to understand the relation between the two and why the other are not changing, ... so yeah if i could at least put them both in a single row, it would be helpful

MartinRoenneburg commented 5 years ago

+1 My use case: Prometheus / Grafana ... I use Grafana repeated rows to show details of a special controller (snmp data). This works fine. Problem: I repeat rows by a special index. Depending on that index i need to query/define variables (in my case the room and the rack) to query other significant values from a different database (the rack temperature) in the same row.

aline-fidencio commented 5 years ago

+1

aud10slave commented 5 years ago

+1, would love to have this.

adriananeci commented 5 years ago

+1

RedHat93 commented 5 years ago

+1

isaqueprofeta commented 5 years ago

+1, would love to have this.

duuz commented 5 years ago

+1

cznewt commented 5 years ago

+1

elisabet123 commented 5 years ago

+1

vrdn-23 commented 5 years ago

+1 Templating per panel would actually be a useful feature

adithyamenon commented 5 years ago

+1

AayushNagpal commented 5 years ago

+1

chengwang86 commented 5 years ago

+1 need this feature desparately

thannaske commented 5 years ago

+1

bjoernbusch commented 4 years ago

+1

I have temperature measurements from different nodes (variable1) in different locations / rooms (variable2). I'd like to have a row per node (already possible) and then show the available measurement of the different rooms with a repeating panel. For that I would have to forward the selected variable of the row to the panel.

brau89 commented 4 years ago

+1

crazycoop74 commented 4 years ago

+1

mbroyles-ns commented 4 years ago

+1M

ademxoy commented 4 years ago

+1 for variable per panel

s196-shubham commented 4 years ago

+1 for variable per row or panel

johannesloher commented 4 years ago

+1

jakub-d commented 4 years ago

+1

treboul01 commented 4 years ago

+1

mikegpl commented 4 years ago

+1

NadavkOptimalQ commented 4 years ago

+1

hezal-s commented 4 years ago

+1

ztaylor797 commented 4 years ago

+1

atornetto commented 4 years ago

+1

aitchjoe commented 4 years ago

+1

aratik711 commented 4 years ago

+1

matt-mercer commented 4 years ago

yes please +1

FelipeNascimento commented 4 years ago

Please

osas1111 commented 4 years ago

+1

zodiake commented 4 years ago

+1

topranks commented 4 years ago

+1 from me!!

nsagot commented 4 years ago

+1

surajtripathi commented 4 years ago

+1

radenkoletic commented 3 years ago

+1

jkloian commented 3 years ago

+1

mjf commented 3 years ago

Having "On row iteration" and "On panel iteration" for refreshing variables would be very useful in many cases! Please, consider to implement it.

sammcadams-8451 commented 3 years ago

+1

daldoyle commented 3 years ago

This would be the single most killer feature for us right now. We have a lot of use cases like what has been described above. There are various workarounds but they are usually more labor intensive and/or provide a lower quality UX such as unnecessary blank graphs for combinations with no results.

SimonScholz commented 3 years ago

+1