AcmeX 内置了完善的监控、日志和链路追踪支持,基于 tracing 和 OpenTelemetry 体系。
AcmeX 支持 OTLP (OpenTelemetry Line Protocol) 协议,可以将追踪数据发送到 Jaeger, Tempo, 或 Datadog。
在启动服务器时,可以通过环境变量配置 OTLP 导出器:
# 启用 OTLP 导出 (默认推送到 http://localhost:4317)
export OTEL_EXPORTER_OTLP_ENDPOINT="http://jaeger-collector:4317"
export OTEL_SERVICE_NAME="acmex-server"
# 运行服务器
acmex serve
AcmeX 集成了 Prometheus 指标导出。
GET /metrics (如果启用 API 模式)| 指标名称 | 类型 | 说明 |
|---|---|---|
acmex_orders_total |
Counter | 总订单数 (按状态分类) |
acmex_challenges_duration_seconds |
Histogram | 挑战验证耗时 |
acmex_cert_expiry_timestamp |
Gauge | 证书过期时间戳 |
acmex_nonce_pool_size |
Gauge | 当前 Nonce 池余量 |
关键业务行为(如:撤销证书、删除账户)会生成审计事件。
// 示例审计事件
event_auditor.track_event(Event {
action: "certificate_revoke",
actor: "admin-api-key-1",
resource: "example.com",
timestamp: 1700000000
});
我们提供了预设的 Grafana 面板 JSON(位于 examples/grafana/),可以快速可视化: