- Documentation
Volcengine Managed Service for Prometheus
Prometheus basic knowledge
Get started with PromQL
PromQL selector
Get started with PromQL
PromQL selector
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.
In the label selector, you can use label matching operators to select labels, including - !=: 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.
In the range selector, you can specify different periods of time.
Last updated: 2026.07.10 11:37:29