fix: record db.client.operation.duration in seconds#72
Open
slavovojacek wants to merge 1 commit intoexaring:mainfrom
Open
fix: record db.client.operation.duration in seconds#72slavovojacek wants to merge 1 commit intoexaring:mainfrom
slavovojacek wants to merge 1 commit intoexaring:mainfrom
Conversation
The instrument declares unit "s" per the OTel semantic conventions (semconv.DBClientOperationDurationUnit), but was recording integer milliseconds via time.Duration.Milliseconds(). This caused the Prometheus exporter to emit a misleadingly named db_client_operation_duration_seconds metric whose bucket boundaries and values were in milliseconds. Change operationDuration from Int64Histogram to Float64Histogram and record time.Duration.Seconds() to match the declared unit. Fixes exaring#70
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #70.
The
db.client.operation.durationinstrument declares unit"s"per the OpenTelemetry semantic conventions (semconv.DBClientOperationDurationUnit = "s"), butrecordOperationDurationwas recording integer milliseconds viatime.Duration.Milliseconds(). This causes the Prometheus exporter to emit adb_client_operation_duration_secondsmetric whose values and bucket boundaries are actually in milliseconds — making the metric name actively misleading and any histogram quantile queries return incorrect results.Change
operationDuration:metric.Int64Histogram→metric.Float64HistogramcreateMetrics:meter.Int64Histogram→meter.Float64HistogramrecordOperationDuration:time.Since(startTime).Milliseconds()→time.Since(startTime).Seconds()Notes
This is a breaking change for existing Prometheus users: bucket
lelabels and all recorded values will shift from millisecond-range integers (e.g.le="5"for 5ms) to second-range floats (e.g.le="0.005"). Users with custom histogram views or dashboards querying bucket boundaries by value will need to update them.