mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-25 15:38:25 +00:00
fix: correct river otel metrics units (#10425)
# Which Problems Are Solved The [otelriver](https://github.com/riverqueue/rivercontrib/tree/master/otelriver) package uses default otel histogram buckets that are designed for millisecond measurements. OTEL docs also suggest standardizing on using seconds as the measurement unit. However, the default buckets from opentelemetry-go are more or less useless when used with seconds as the smallest measurement is 5 seconds and the largest is nearly 3 hours. Example: ``` river_work_duration_histogram_seconds_bucket{attempt="1",kind="notification_request",otel_scope_name="github.com/riverqueue/rivercontrib/otelriver",otel_scope_version="",priority="1",queue="notification",status="ok",tag="[]",le="0"} 0 river_work_duration_histogram_seconds_bucket{attempt="1",kind="notification_request",otel_scope_name="github.com/riverqueue/rivercontrib/otelriver",otel_scope_version="",priority="1",queue="notification",status="ok",tag="[]",le="5"} 1144 river_work_duration_histogram_seconds_bucket{attempt="1",kind="notification_request",otel_scope_name="github.com/riverqueue/rivercontrib/otelriver",otel_scope_version="",priority="1",queue="notification",status="ok",tag="[]",le="10"} 1144 <...more buckets here...> river_work_duration_histogram_seconds_bucket{attempt="1",kind="notification_request",otel_scope_name="github.com/riverqueue/rivercontrib/otelriver",otel_scope_version="",priority="1",queue="notification",status="ok",tag="[]",le="7500"} 1144 river_work_duration_histogram_seconds_bucket{attempt="1",kind="notification_request",otel_scope_name="github.com/riverqueue/rivercontrib/otelriver",otel_scope_version="",priority="1",queue="notification",status="ok",tag="[]",le="10000"} 1144 river_work_duration_histogram_seconds_bucket{attempt="1",kind="notification_request",otel_scope_name="github.com/riverqueue/rivercontrib/otelriver",otel_scope_version="",priority="1",queue="notification",status="ok",tag="[]",le="+Inf"} 1144 ``` # How the Problems Are Solved Change the default unit to "ms" from "s" as supported by the middleware API: https://riverqueue.com/docs/open-telemetry#list-of-middleware-options # Additional Changes None # Additional Context None Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
This commit is contained in:
@@ -33,6 +33,7 @@ type Config struct {
|
||||
func NewQueue(config *Config) (_ *Queue, err error) {
|
||||
middleware := []rivertype.Middleware{otelriver.NewMiddleware(&otelriver.MiddlewareConfig{
|
||||
MeterProvider: metrics.GetMetricsProvider(),
|
||||
DurationUnit: "ms",
|
||||
})}
|
||||
return &Queue{
|
||||
driver: riverdatabasesql.New(config.Client.DB),
|
||||
|
||||
Reference in New Issue
Block a user