GET/metrics指标暴露
Try it 面板需要启用 JavaScript。
以 Prometheus 文本格式暴露运行指标;供监控采集器抓取。仅内网可达,无需业务认证。
Request
Headers
该 jsonschema:headers 围栏未声明任何属性
Response
Body
Prometheus 文本格式(text/plain; version=0.0.4),不使用统一信封。核心指标族:
| Metric | Type | Description |
|---|---|---|
| http_requests_total | counter | HTTP 请求总数(标签:method / route / code) |
| nats_requests_total | counter | NATS 请求总数(标签:subject / code) |
| nats_request_duration_seconds | histogram | NATS 请求-reply 耗时分布(标签:subject) |
| jetstream_published_total | counter | JetStream 事件发布数(标签:stream) |
| jetstream_consumed_total | counter | JetStream 事件消费数(标签:stream) |
| login_attempts_total | counter | 登录尝试数(标签:status / factors) |
| otp_delivered_total | counter | OTP 投递结果数(标签:channel / result) |
| payment_orders_total | counter | 订单状态流转数(标签:status) |
HTTP Code
| HTTP Status | Meaning | Notes |
|---|---|---|
| 200 | 成功 | 返回指标文本 |
| 403 | 禁止 | 来源不在内网允许列表 |
Examples
GET /metrics
# HELP http_requests_total HTTP 请求总数
# TYPE http_requests_total counter
http_requests_total{method="POST",route="/api/v1/auth/login/password",code="0"} 12304
# HELP nats_requests_total NATS 请求总数
# TYPE nats_requests_total counter
nats_requests_total{subject="identity.session.validate",code="0"} 45210
# HELP login_attempts_total 登录尝试数
# TYPE login_attempts_total counter
login_attempts_total{status="satisfied",factors="password,mfa"} 812
Remarks
同一端点同时部署在 api_service 与 apps/openapi;指标口径随实现补充,上表为契约性下限。