9.4. 3scale APIcast 指标公开给 Prometheus

在将 Prometheus 设置为监控 3scale APIcast 后,它默认可以监控 表 9.2 “用于 3scale APIcast 的 Prometheus 默认指标” 中列出的指标。

只有在您使用 3scale Batcher 策略时,表 9.3 “3scale APIcast 批处理策略的 Prometheus Metrics” 中列出的指标才可用。

表 9.2. 用于 3scale APIcast 的 Prometheus 默认指标

指标描述Type标签

nginx_http_connections

HTTP 连接数

gauge

state(accepted,active,handled,reading,total,waiting,writing)

nginx_error_log

APIcast 错误

计数

level(debug,info,notice,warn,error,crit,alert,emerg)

openresty_shdict_capacity

worker 共享字典的能力

gauge

dict(每个字典对应一个)

openresty_shdict_free_space

worker 共享字典的可用空间

gauge

dict(每个字典对应一个)

nginx_metric_errors_total

管理指标的 Lua 库错误数

计数

none

total_response_time_seconds

向客户端发送响应所需的时间(以秒为单位)

:要访问 service_idservice_system_name 标签,您必须将 APICAST_EXTENDED_METRICS 环境变量设置为 true,如 第 9.2 节 “APIcast 与 Prometheus 集成” 所述。

histogram

service_id,service_system_name

upstream_response_time_seconds

来自上游服务器的响应时间(以秒为单位)

:要访问 service_idservice_system_name 标签,您必须将 APICAST_EXTENDED_METRICS 环境变量设置为 true,如 第 9.2 节 “APIcast 与 Prometheus 集成” 所述。

histogram

service_id,service_system_name

upstream_status

来自上游服务器的 HTTP 状态

:要访问 service_idservice_system_name 标签,您必须将 APICAST_EXTENDED_METRICS 环境变量设置为 true,如 第 9.2 节 “APIcast 与 Prometheus 集成” 所述。

计数

status, service_id, service_system_name

threescale_backend_calls

授权并报告请求到 3scale 后端(Apisonator)

计数

endpoint(authrep, auth, report), status(2xx, 4xx, 5xx)

表 9.3. 3scale APIcast 批处理策略的 Prometheus Metrics

指标描述Type标签

batching_policy_auths_cache_hits

按 3scale 批处理策略的 auths 缓存中的内容

计数

none

batching_policy_auths_cache_misses

3scale 批处理策略的 auths 缓存中丢失

计数

none