配置 Beyla Prometheus 和 OpenTelemetry 指标直方图
配置 Beyla Prometheus 和 OpenTelemetry 指标直方图,以及是否使用原生直方图和指数直方图。
覆盖直方图桶
您可以通过设置 buckets
YAML 配置选项来覆盖 OpenTelemetry 和 Prometheus 指标导出器的直方图桶边界
YAML | 类型 |
---|---|
duration_histogram | []float64 |
设置与请求持续时间相关的指标的桶边界。具体来说,包括
http.server.request.duration
(OTEL) /http_server_request_duration_seconds
(Prometheus)http.client.request.duration
(OTEL) /http_client_request_duration_seconds
(Prometheus)rpc.server.duration
(OTEL) /rpc_server_duration_seconds
(Prometheus)rpc.client.duration
(OTEL) /rpc_client_duration_seconds
(Prometheus)
如果未设置该值,则默认桶边界遵循 OpenTelemetry 语义约定中的建议
0, 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10
YAML | 类型 |
---|---|
request_size_histogram | []float64 |
response_size_histogram | []float64 |
设置与请求/响应大小相关的指标的桶边界。具体来说,包括
http.server.request.body.size
(OTEL) /http_server_request_body_size_bytes
(Prometheus)http.client.request.body.size
(OTEL) /http_client_request_body_size_bytes
(Prometheus)http.server.response.body.size
(OTEL) /http_server_response_body_size_bytes
(Prometheus)http.client.response.body.size
(OTEL) /http_client_response_body_size_bytes
(Prometheus)
如果未设置该值,则默认桶边界为
0, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192
默认值是 UNSTABLE(不稳定)的,如果 Prometheus 或 OpenTelemetry 语义约定推荐不同的桶边界集,可能会发生变化。
使用原生直方图和指数直方图
对于 Prometheus,如果您在 Prometheus Collector 中启用了 native-histograms
功能,则原生直方图会启用。
对于 OpenTelemetry,您可以对预定义的直方图使用指数直方图,而无需手动定义桶。您需要设置标准的 OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION
环境变量。有关更多信息,请参阅OTEL 指标导出器部分中的 histogram_aggregation
部分。