Skip to content

Commit

Permalink
update docs for prometheus metric expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
kayx23 committed Dec 2, 2024
1 parent ee6a04c commit 0f3f5c7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
5 changes: 3 additions & 2 deletions conf/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,9 @@ plugin_attr: # Plugin attributes
# - 100
# - 200
# - 500
# expire: 0 # The expiration time after metrics become inactive, unit: second.
# 0 means the metrics will not expire
# expire: 0 # The expiration time of metrics in seconds.
# 0 means the metrics will not expire.
# Only affect apisix_http_status, apisix_bandwidth, and apisix_http_latency.
# If you need to set the expiration time, it is recommended to use 600, which is 10 minutes.
server-info: # Plugin: server-info
report_ttl: 60 # Set the TTL in seconds for server info in etcd.
Expand Down
12 changes: 12 additions & 0 deletions docs/en/latest/plugins/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ plugin_attr:
- 505
```

### Specifying `expire`

`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.

Here is a configuration example:

```yaml title="conf/config.yaml"
plugin_attr:
prometheus:
expire: 86400
```

## Metrics endpoint

This Plugin will add the metrics endpoint `/apisix/prometheus/metrics` or your custom export URI for exposing the metrics.
Expand Down
14 changes: 13 additions & 1 deletion docs/zh/latest/plugins/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ description: 本文将介绍 API 网关 Apache APISIX 如何通过 prometheus

:::

## 如何修改暴露指标的 uri
### 如何修改暴露指标的 `export_uri`

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

Expand Down Expand Up @@ -78,6 +78,18 @@ plugin_attr:
- 505
```

### 如何修改指标的 `expire`

`expire` 用于设置 `apisix_http_status`、`apisix_bandwidth` 和 `apisix_http_latency` 指标的过期时间(以秒为单位)。当设置为 0 时,指标不会过期。

配置示例如下:

```yaml title="conf/config.yaml"
plugin_attr:
prometheus:
expire: 86400
```

## API

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

0 comments on commit 0f3f5c7

Please sign in to comment.