prometheus_http_requests_total records the number of requests made to various Prometheus APIs with different response status codes.# HELP prometheus_http_requests_total Counter of HTTP requests.# TYPE prometheus_http_requests_total counterprometheus_http_requests_total{code="200",handler="/api/v1/label/:name/values"} 7prometheus_http_requests_total{code="200",handler="/api/v1/query"} 19prometheus_http_requests_total{code="200",handler="/api/v1/query_range"} 27prometheus_http_requests_total{code="200",handler="/graph"} 11prometheus_http_requests_total{code="200",handler="/metrics"} 8929prometheus_http_requests_total{code="200",handler="/static/*filepath"} 52prometheus_http_requests_total{code="302",handler="/"} 1prometheus_http_requests_total{code="400",handler="/api/v1/query_range"} 6
groups:- name: examplerules:- record: code:prometheus_http_requests_total:sumexpr: sum by (code) (prometheus_http_requests_total)
sum by (code) (prometheus_http_requests_total) is the metric query statement (PromQL), which calculates the sum of request counts grouped by status code.code:prometheus_http_requests_total:sum is the generated metric name, which can be customized. You can use this name in subsequent queries to directly retrieve the precomputed metric.Configuration Item | Description |
Configuration Name | Enter the configuration name. |
Service Logs | Task run logs are saved in the log topic cls_service_log to facilitate monitoring the task running status. This log topic is free and enabled by default. |
Query statement | The PromQL statement to be executed. The pre-aggregation task will run this statement at scheduled intervals to retrieve the execution results. |
Metric Name | The result of the execution statement will be stored under this metric name, which can be used for subsequent data queries. It supports English letters, numbers, underscores, and colons, and should conform to the regular expression [a-zA-Z_:][a-zA-Z0-9_:]*. |
Custom Dimension | Adds dimensions to the metric. If there is a conflict between the custom dimension and the dimension names in the execution statement results, the custom dimension takes precedence. |
Scheduling cycle | The execution interval for the pre-aggregation task, with the range from 1 to 1440 minutes. It is recommended to use a 1-minute interval. |
Advanced Configurations | Target metric topic: Specifies where the pre-aggregated metric data will be stored. By default, it is stored in the current topic. If you want to store this data separately (e.g., to set a different retention period for this portion of data), you can store it in another metric topic. Delayed execution: Since there may be delays in metric data collection, you can set a delayed execution to ensure the data is fully collected before the pre-aggregation task runs. The default delay is 30 seconds. |
Configuration Item | Description |
Configuration Name | Enter the configuration name. |
Enabling Status | Indicates whether the task needs to run. Tasks that are not running will not generate pre-aggregated result data. |
Service Logs | Task run logs are saved in the log topic cls_service_log to facilitate monitoring the task running status. This log topic is free and enabled by default. |
Execution interval | The execution interval for the pre-aggregation task, with the range from 1 to 1440 minutes. It is recommended to use a 1-minute interval. |
YAML configuration | Compatible with Prometheus Recording Rule YAML. The interval only supports a range from 1 to 1440 minutes. For example:
|
Advanced Configurations | Target metric topic: Specifies where the pre-aggregated metric data will be stored. By default, it is stored in the current topic. If you want to store this data separately (e.g., to set a different retention period), you can store it in another metric topic. Delayed execution: Since there may be delays in metric data collection, you can set a delayed execution to ensure the data is fully collected before the pre-aggregation task runs. The default delay is 30 seconds. |
フィードバック