PromQL Query¶
Applying PromQL queries in charts can help you extract and analyze time series data from the Prometheus data source, and visually display the results in the chart.
Simple Definition
PromQL is the query language of Prometheus, used to query and manipulate time series data from the Prometheus data source. It provides a rich set of functions and operators that support aggregation, filtering, calculation, and comparison of data, helping users quickly extract and analyze data.
Start Querying¶
- Click "Add PromQL Query";
- Select query method;
- Begin querying.
Query Method¶
- Range Query: Runs the query over a specified time range
- Instant Query: Runs the query for a single point in time
For more details, refer to Comparison between DQL and other query languages; or go directly to PromQL.
Query Examples¶
For instance, if you want to monitor whether the concurrent limiter in a specific region has been triggered, so as to promptly identify potential performance issues or resource bottlenecks.
Entering the above query statement means: filter out all data points where the value of the guance_concurrent_limiter_current
Metrics is greater than 0, and the value of the region
label for these data points is #{region}
.
Assuming the value of region
is us-west-1
, the actual query statement will become:
This query will return all time series data where the region
is us-west-1
and the value of the guance_concurrent_limiter_current
Metrics is greater than 0.
Statement Format
- Dynamic replacement of label values:
#{region}
is a placeholder that needs to be replaced with an actual value during the real query. Ensure that placeholders are correctly replaced when querying. - Time range: PromQL queries typically require a specified time range; for example,
[5m]
in the instance indicates data from the past 5 minutes.