You need to enable JavaScript to run this app.
Volcengine Managed Service for Prometheus

Volcengine Managed Service for Prometheus

Copy page
Download PDF
Get started with PromQL
PromQL selector
Copy page
Download PDF
PromQL selector
You can filter data by label in PromQL. This topic describes how to use labels.​
Label selector​
The raw data in Prometheus contains multiple labels. In most cases, you only need to view the content of specified labels. In this case, you need to use a label selector. A label selector is placed in {}. The following sample code shows how to query the number of requests with an HTTP status code 400.​
​
http_requests_total{code="400"}​
In the label selector, you can use label matching operators to select labels, including​
  • =: matches the string.​
  • !=: does not match the string.​
  • =~: regex-matches the string.​
  • !~: does not regex-match the string.​
Range selector​
The range selector is often used to specify a period of time. The following sample code shows how to query sampling records with an HTTP status code 400 in the last 5 minutes.​
​
http_requests_total{code="400"}[5m]​
In the range selector, you can specify different periods of time.​
​
Time Unit​
Descriptions​
s​
Second​
m​
Minute​
h​
Hour​
d​
Day​
w​
Week​
y​
Year​
​
​
Last updated: 2026.07.10 11:37:29