My answer tries to elaborate on Carl's answer. I assume that the GUI layout may have changed a little since 2016, so it took me while to find the "name" option.

Assuming you have a metric as follows:

# HELP db2_prometheus_adapter_info Information on the state of the DB2-Prometheus-Adapter
# TYPE db2_prometheus_adapter_info gauge
db2_prometheus_adapter_info{app_state="UP"} 1.0

and you would like to show the value of the label app_state.

Follow these steps:

  • Create a "SingleStat" visualization.
  • Go to the "Queries" tab:
    • Enter the name (here db2_prometheus_adapter_info) of the metric.
    • Enter the label name as the legend using the {{[LABEL]}} notation (here {{app_state}}).
    • Activate the "instant" option.

  • Go to the "Visualization" tab:
    • Choose the value "Name" under "Value - Stat".

Note on the "Instant" setting: This setting switches from a range query to a simplified query only returning the most recent value of the metric (also see What does the "instant" checkbox in Grafana graphs based on prometheus do?). If not activated, the panel will show an error as soon as there is more than one distinct value for the label in the history of the metric. For a "normal" metric you would remedy this by choosing "current" in the "Value - Stat" option. But doing so here prevents your label value to be shown.

Answer from Marcus Rickert on Stack Overflow
Top answer
1 of 9
38

My answer tries to elaborate on Carl's answer. I assume that the GUI layout may have changed a little since 2016, so it took me while to find the "name" option.

Assuming you have a metric as follows:

# HELP db2_prometheus_adapter_info Information on the state of the DB2-Prometheus-Adapter
# TYPE db2_prometheus_adapter_info gauge
db2_prometheus_adapter_info{app_state="UP"} 1.0

and you would like to show the value of the label app_state.

Follow these steps:

  • Create a "SingleStat" visualization.
  • Go to the "Queries" tab:
    • Enter the name (here db2_prometheus_adapter_info) of the metric.
    • Enter the label name as the legend using the {{[LABEL]}} notation (here {{app_state}}).
    • Activate the "instant" option.

  • Go to the "Visualization" tab:
    • Choose the value "Name" under "Value - Stat".

Note on the "Instant" setting: This setting switches from a range query to a simplified query only returning the most recent value of the metric (also see What does the "instant" checkbox in Grafana graphs based on prometheus do?). If not activated, the panel will show an error as soon as there is more than one distinct value for the label in the history of the metric. For a "normal" metric you would remedy this by choosing "current" in the "Value - Stat" option. But doing so here prevents your label value to be shown.

2 of 9
17

We recently added support for displaying the series name as a value in the single stat panel (https://github.com/grafana/grafana/issues/4740). So you have to run our nightly build until we release version 4.0.

Just make sure the query returns one series and you can use the "name" value in the dropdown under Options -> big value. Then you can format the string using the legend formatter. Ex {{job}} would return "node" as a series name.

I hope this answers your question.

Discussions

Implement HTTP API for getting all label names
Would be relevant for grafana/grafana#6038 (cc @bergquist). Endpoint would be: GET /api/v1/labels Output would be: { "status" : "success", "data" : [ "__name__", "job", "instance", "method", "statu... More on github.com
🌐 github.com
8
September 28, 2016
Histogram bucket label value gets converted to float somehow
I've checked the http output of the specific caddy instance and every "le" label is correctly formatted as int. Only when querying prometheus I get a float value: More on github.com
🌐 github.com
6
January 14, 2021
Prometheus: Try to use labels API instead of series API as it newly supports match
What happened: On metric with high cardinality (a lots of prometheus series) we can't get label values. This is because label_values use /api/v1/series instead of /api/1v/label when there is a ... More on github.com
🌐 github.com
20
April 28, 2021
Get label's value as query value - PromQL - Prometheus Monitoring System
Hello, I’m looking for a way to get a label’s value as query result rather than just a 1 or a 0 I’ve been knocking my head all around the web for hours but I’ve yet to find a definitive working answer. I’ve found the topic been asked on different websites (including but not limited to stackoverflow and github ... More on discuss.prometheus.io
🌐 discuss.prometheus.io
0
November 21, 2022
🌐
GitHub
github.com › prometheus › prometheus › issues › 3351
Support labels/{label}/values and labels through the remote read API · Issue #3351 · prometheus/prometheus
October 25, 2017 - prometheus / prometheus Public · Notifications · You must be signed in to change notification settings · Fork 9.6k · Star 59k · New issueCopy link · New issueCopy link · Open · #11877 · Open · Support labels/{label}/values and labels through the remote read API#3351 ·
Author: prometheus
🌐
GitHub
github.com › prometheus › client_python › discussions › 1027
Help with labels · prometheus/client_python · Discussion #1027
I am trying to get a list\array of label values for a label name. c = Enum('ChannelStatus', 'This shows Started or Stopped',labelnames=["ChannelName"],states=["on&quo...
Author: prometheus
🌐
client_python
prometheus.github.io › client_python › instrumenting › labels
Labels | client_python
April 9, 2026 - It is recommended to initialize the label values by calling the .labels() method alone: from prometheus_client import Counter c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint']) c.labels('get', '/') c.labels('post', '/submit') Remove a specific labelset from the metric.
🌐
GitHub
github.com › prometheus › prometheus › issues › 2038
Implement HTTP API for getting all label names · Issue #2038 · prometheus/prometheus
September 28, 2016 - Would be relevant for grafana/grafana#6038 (cc @bergquist). Endpoint would be: GET /api/v1/labels Output would be: { "status" : "success", "data" : [ "__name__", "job", "instance", "method", "statu...
Author: prometheus
🌐
GitHub
github.com › prometheus › prometheus › labels
Labels · prometheus/prometheus
The Prometheus monitoring system and time series database. - prometheus/prometheus
Author: prometheus
🌐
client_java
prometheus.github.io › client_java › getting-started › labels
Labels | client_java
If you have labels values that never change, you can specify them in the builder as constLabels(): Counter counter = Counter.builder() .name("payments_total") .help("total number of payments") .constLabels(Labels.of("env", "dev")) .labelNames("type", "status") .register(); However, most use cases for constLabels() are better covered by target labels set by the scraping Prometheus ...
Find elsewhere
🌐
Google Groups
groups.google.com › g › prometheus-developers › c › oK_bx8rHmZs
hi how do i get all labels list in prometheus?
Bit old, but I did find a way to do it. http://promethesusserver:port/api/v1/label/__name__/values will return all Labels that are shown in the Graph listing.
🌐
GitHub
github.com › prometheus › prometheus › issues › 8367
Histogram bucket label value gets converted to float ...
January 14, 2021 - I've checked the http output of the specific caddy instance and every "le" label is correctly formatted as int. Only when querying prometheus I get a float value:
Author: prometheus
🌐
GitHub
github.com › grafana › grafana › issues › 33487
Prometheus: Try to use labels API instead of series API as it newly supports match · Issue #33487 · grafana/grafana
April 28, 2021 - Fill a prometheus/victoria metrics server with a high cardinality metrics (3 tag/label with 500 different values), getting values from one label/tag will return 250000 of series using series endpoint, but only 500 label values using label endpoint.
Author: grafana
🌐
OneUptime
oneuptime.com › home › blog › how to write prometheus queries that return label values
How to Write Prometheus Queries That Return Label Values
December 17, 2025 - This guide covers all the methods for extracting and manipulating labels in Prometheus. PromQL queries return time series with numeric values.
🌐
SigNoz
signoz.io › guides › how to write prometheus queries to return label values
How to Write Prometheus Queries to Return Label Values | SigNoz
July 25, 2024 - With 24,000+ GitHub stars, open-source SigNoz is loved by developers. Find the instructions to self-host SigNoz. SigNoz simplifies the process of querying and visualizing label values, making it an excellent choice for teams looking for a comprehensive monitoring solution. To ensure efficient and maintainable label queries: ... By following these best practices, you'll create efficient, readable, and maintainable Prometheus ...
🌐
Prometheus
discuss.prometheus.io › promql
Get label's value as query value - PromQL - Prometheus Monitoring System
November 21, 2022 - Hello, I’m looking for a way to get a label’s value as query result rather than just a 1 or a 0 I’ve been knocking my head all around the web for hours but I’ve yet to find a definitive working answer. I’ve found the t…
🌐
GitHub
github.com › grafana › grafana › issues › 5094
[Feature Request] ability to display metric label value in single state panel [Prometheus] · Issue #5094 · grafana/grafana
May 19, 2016 - Hi, Given a prometheus metric such as: kubernetes_build_info{gitCommit="123412341234",gitTreeState="clean",gitVersion="vx.y.z",instance="1.1.1.1:8080",job="kubernetes",major="1",minor="2"} It would be useful for the prometheus/grafana co...
Author: grafana
🌐
GitHub
github.com › prometheus › prometheus › issues › 11584
No prometheus metric to find all unique label names, unique label counts or unique label value pairs · Issue #11584 · prometheus/prometheus
November 15, 2022 - See URL below: https://grafana.com/docs/grafana-cloud/billing-and-usage/control-prometheus-metrics-usage/cardinality-management/ But I have found that there is no metric which can give me unique label names or count of unique labels or unique values for each label.
Author: prometheus
🌐
GitHub
github.com › prometheus › prometheus › issues › 1495
Add filtering on metric name to label_values · Issue #1495 · prometheus/prometheus
March 21, 2016 - Currently, Prometheus supports the following HTTP API call to retrieve all label values by its name: /label/:name/values It would be great to extend this with some kind of filtering on metric name, so you can get label values limited to ...
Author: prometheus
🌐
GitHub
github.com › prometheus-community › prom-label-proxy
GitHub - prometheus-community/prom-label-proxy: A proxy that enforces a given label in a given PromQL query. · GitHub
1 month ago - /api/v1/labels for GET and POST methods (Prometheus/Thanos) /api/v1/label/<name>/values for GET method (Prometheus/Thanos)
Author: prometheus-community
🌐
GitHub
github.com › VictoriaMetrics › VictoriaMetrics › issues › 282
label_values from grafana works inconsistently with prometheus when label == "app" · Issue #282 · VictoriaMetrics/VictoriaMetrics
December 27, 2019 - Describe the bug label_values(label) query from grafana returns something that looks like set of timestamps. In prometheus this query returns values for label accross all metrics. label_values(metric, label) works as expected. To Reprodu...
Author: VictoriaMetrics
🌐
Go Packages
pkg.go.dev › github.com › prometheus › prometheus › model › labels
labels package - github.com/prometheus/prometheus/model/labels - Go Packages
DropReserved returns Labels without the chosen (via shouldDropFn) reserved (starting with underscore) labels. ... Get returns the value for the label with the given name.