Skip to content

Commit 1f89705

Browse files
authored
docs: update for prometheus metric expiration (#11795)
1 parent 70d4508 commit 1f89705

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

conf/config.yaml.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,9 @@ plugin_attr: # Plugin attributes
611611
# - 100
612612
# - 200
613613
# - 500
614-
# expire: 0 # The expiration time after metrics become inactive, unit: second.
615-
# 0 means the metrics will not expire
614+
# expire: 0 # The expiration time of metrics in seconds.
615+
# 0 means the metrics will not expire.
616+
# Only affect apisix_http_status, apisix_bandwidth, and apisix_http_latency.
616617
# If you need to set the expiration time, it is recommended to use 600, which is 10 minutes.
617618
server-info: # Plugin: server-info
618619
report_ttl: 60 # Set the TTL in seconds for server info in etcd.

docs/en/latest/plugins/prometheus.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ plugin_attr:
9696
- 505
9797
```
9898

99+
### Specifying `expire`
100+
101+
`expire` sets the expiration time of `apisix_http_status`, `apisix_bandwidth`, and `apisix_http_latency` metrics in seconds. When set to 0, metrics will not expire.
102+
103+
Here is a configuration example:
104+
105+
```yaml title="conf/config.yaml"
106+
plugin_attr:
107+
prometheus:
108+
expire: 86400
109+
```
110+
99111
## Metrics endpoint
100112

101113
This Plugin will add the metrics endpoint `/apisix/prometheus/metrics` or your custom export URI for exposing the metrics.

docs/zh/latest/plugins/prometheus.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ description: 本文将介绍 API 网关 Apache APISIX 如何通过 prometheus
4343

4444
:::
4545

46-
## 如何修改暴露指标的 uri
46+
### 如何修改暴露指标的 `export_uri`
4747

4848
你可以在配置文件 `./conf/config.yaml``plugin_attr` 列表下修改默认的 URI。
4949

@@ -78,6 +78,18 @@ plugin_attr:
7878
- 505
7979
```
8080

81+
### 如何修改指标的 `expire`
82+
83+
`expire` 用于设置 `apisix_http_status`、`apisix_bandwidth` 和 `apisix_http_latency` 指标的过期时间(以秒为单位)。当设置为 0 时,指标不会过期。
84+
85+
配置示例如下:
86+
87+
```yaml title="conf/config.yaml"
88+
plugin_attr:
89+
prometheus:
90+
expire: 86400
91+
```
92+
8193
## API
8294

8395
`prometheus` 插件会增加 `/apisix/prometheus/metrics` 接口或者你自定义的 URI 来暴露其指标信息。

0 commit comments

Comments
 (0)