- What Grafana version and what operating system are you using?
Grafana version: v9.4.7 (4add91f03d)
OS: Windows 10 Pro 64bit
Runtime: Desktop Docker For Windows
Data Source: Prometheus
- What are you trying to achieve?
I have the following Prometheus metrics for pool connections with current/min/max gauge metrics:
# HELP atomicos_connections_min Min connections
# TYPE atomicos_connections_min gauge
atomicos_connections_min{application="local-railway-api-service",pool="rolis-main@postgres-distributed",} 2.0
atomicos_connections_min{application="local-railway-api-service",pool="rolis-main@sybase-distributed",} 3.0
atomicos_connections_min{application="local-railway-api-service",pool="rolis-meta@postgres-distributed",} 2.0
# HELP atomicos_connections_max Max connections
# TYPE atomicos_connections_max gauge
atomicos_connections_max{application="local-railway-api-service",pool="rolis-main@postgres-distributed",} 4.0
atomicos_connections_max{application="local-railway-api-service",pool="rolis-main@sybase-distributed",} 5.0
atomicos_connections_max{application="local-railway-api-service",pool="rolis-meta@postgres-distributed",} 4.0
# HELP atomicos_connections Total connections
# TYPE atomicos_connections gauge
atomicos_connections{application="local-railway-api-service",pool="rolis-main@postgres-distributed",} 2.0
atomicos_connections{application="local-railway-api-service",pool="rolis-main@sybase-distributed",} 3.0
atomicos_connections{application="local-railway-api-service",pool="rolis-meta@postgres-distributed",} 2.0
I want to visualize gauge for each pool with different min/current/max gauge values looks like this:
- How are you trying to achieve it?
I have added new dashboard.
I have added variables to my dashboard:
- application: label_values(atomicos_connections_max{}, application)
- atomicos_pool: label_values(atomicos_connections_max{application=“$application”}, pool) with multi-value option
I have added panel with Gauge visualization and set the following properties:
Panel Options:
Title: $atomicos_pool
Repeat options:
Repeat by variable: atomicos_pool
Repeate direction: Horizontal
Max per row: 4
Value options:
Show: Calculation
Calculation: Last *
Fields: Numeric Fields
Gauge
Show threshold labels: True
Query
A: atomicos_connections{application="$application", pool="$atomicos_pool"}
B: atomicos_connections_max{application="$application", pool="$atomicos_pool"}
Transform
Config from query results:
Config query: B
Apply to: Fields with type
Apply to options: Numeric(2)
Field: {__name="atomicos_connections_max...}
Use as: Max
Select: Last *
- What happened?
The gauge maximum value has been set only for the first value of the repeated variable atomicos_pool, as the result only the first gauge looks correctly. You can see it on the picture:
- What did you expect to happen?
I expected to see correct gauge maximum value for each value of the repeated variable.
- Can you copy/paste the configuration(s) that you are having problems with?
Yes, I can share one with pastebin: { "annotations": { "list": [ { "builtIn": 1, "d - Pastebin.com
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
No, there are no any errors
- Did you follow any online instructions? If so, what is the URL?
My approach is based on the following article but with several changes: Grafana, Dynamic gauge max value. Grafana is a multi-platform open source… | by Hossein Yousefi | DevOps.dev