Skip to content

Metrics: expose histograms in both classic and native form #3822

Open

Description

@pbleser-oc

Part of #3817.

Goal

Expose every classic histogram also as a native histogram (dual exposition), using a small shared helper in pkg/metrics that adds the native settings to a prometheus.HistogramOpts, so all services are configured the same way.

Affected histograms (all classic today):

Service Metric Labels
graph http_request_duration_seconds method, path, version, resource, code, result
graph ldap_client_operation_duration_seconds operation, result (+ const: uri, write)
graph identity_backend_api_duration_seconds operation, result (+ const: type)
postprocessing duration_seconds status
search search_duration_seconds, index_duration_seconds status
invitations invitation_duration_seconds none
webfinger webfinger_duration_seconds none

proxy's classic duration_seconds and service_duration_seconds histograms remain classic-only on purpose: they are the fallback for the native-only request_duration_seconds on scrapers without native histograms, and their native form would only duplicate it.

Buckets must stay set explicitly: once native buckets are used, client_golang defaults to no classic buckets at all.

Decisions to make

  • Native settings: hardcoded defaults (NativeHistogramBucketFactor: 1.1, NativeHistogramMaxBucketNumber: 100, NativeHistogramMinResetDuration: 1h), or configurable. Decided: hardcoded, factor 1.1, at most 100 buckets, never reset (NativeHistogramMinResetDuration: 0), as a reset would also set the classic buckets, count and sum back to zero.
  • graph http_request_duration_seconds: with 6 labels it is the most expensive classic histogram. Options: dual exposition with the labels kept (no change in cost for classic-only setups), or native-only plus a classic fallback with fewer labels (breaks dashboards that use its classic buckets). Decided: dual exposition, labels kept.
  • Existing native-only histograms: whether they should use the same helper defaults (bucket cap, reset duration). Decided: yes, they use the same defaults.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions