fix: register explicit bucket boundaries for duration histograms - #2255
Open
cowsking wants to merge 1 commit into
Open
fix: register explicit bucket boundaries for duration histograms#2255cowsking wants to merge 1 commit into
cowsking wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/test kpt-config-sync-presubmit |
| @@ -51,6 +51,14 @@ const ( | |||
| InternalErrorsName = "internal_errors_total" | |||
| ) | |||
|
|
|||
Contributor
There was a problem hiding this comment.
Thanks for working on the fix, could you check if the fix apply to pkg/kmetrics as well?
Following the OpenCensus to OpenTelemetry metrics migration, duration
histogram instruments in Config Sync lacked explicit bucket boundaries.
This caused the OpenTelemetry Go SDK to fall back to default
millisecond-scale boundaries {0, 5, 10, 25, ...}, which for second-unit
metrics resulted in all sub-5-second values falling into the (0, 5] bucket
and skewing Prometheus histogram_quantile queries (e.g. static 4.75s).
This change:
- Configures explicit sub-second bucket boundaries for core duration
metrics (APICallDuration, ReconcileDuration, RemediateDuration) and
long duration metrics (ParserDuration, ApplyDuration).
- Configures explicit bucket boundaries for ResourceGroup ReconcileDuration.
- Adds unit tests to verify histogram bucket bounds and sub-second data
point placement.
Fixes b/545631804
cowsking
force-pushed
the
fix-duration-histogram-buckets
branch
from
August 15, 2026 00:40
1a1956e to
535a861
Compare
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.
Following the OpenCensus to OpenTelemetry metrics migration, duration histogram instruments in Config Sync lacked explicit bucket boundaries. This caused the OpenTelemetry Go SDK to fall back to default millisecond-scale boundaries {0, 5, 10, 25, ...}, which for second-unit metrics resulted in all sub-5-second values falling into the (0, 5] bucket and skewing Prometheus histogram_quantile queries (e.g. static 4.75s).
This change:
pkg/kmetricskustomize_build_latency: the histogram recorded raw nanosecond values while declaring a millisecond unit, so every recording landed in the overflow (+Inf) bucket regardless of bucket configuration. It now records the duration in seconds (consistent with all other Config Sync duration metrics), declares the unit ass, and registers explicit bucket boundaries. Note this changes the scale of the exported values (previously nanosecond-scale numbers labeled as ms).