Skip to content

Conversation

@Xaelias
Copy link

@Xaelias Xaelias commented Jan 12, 2026

💸 TL;DR

Add support for native histograms using the following settings:

  • NativeHistogramBucketFactor: 1.1
  • NativeHistogramMaxBucketNumber: 160
  • NativeHistogramMinResetDuration: 1h

Jira

This changes means that all histograms defined in baseplate.go will now be scraped as native histograms if the service is scraped using the PrometheusProto protocol. This also requires the resulting prometheus instance to be configured to accept native histograms.

If the service is scraped using plantext (the default), then the existing classic histograms will be scraped and this change doesn't change anything for the resulting metrics.

NB:

  • services will keep track of BOTH classic and native histograms while both buckets and these 3 settings are set at the same time
  • if a namespace is configured to scrape using protobuf, but native histogram support is not explicitly enabled, neither the classic or native histograms will be scraped.

🧪 Testing Steps / Validation

Ran in snoodev, made sure that when namespace was configured to scrape native histograms, native histograms would show up, and classic histograms would still appear if prometheus was not configured to scrape native histograms.

image List of native histograms off of graphql-go without

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

@Xaelias Xaelias force-pushed the chore_-_adhoc_-_2026-01-12_-_add_support_for_native_histograms branch from 69e31fa to b06a4cd Compare January 15, 2026 17:44
@Xaelias Xaelias marked this pull request as ready for review January 15, 2026 17:47
@Xaelias Xaelias requested a review from a team as a code owner January 15, 2026 17:47
@Xaelias Xaelias requested review from konradreiche, mathyourlife-reddit and pacejackson and removed request for a team January 15, 2026 17:47

import "time"

const (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a golang expert but I believe we want these to be const?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they can be declared as constants, it's definitely preferable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is one service that is overriding the prometheusbp.DefaultLatencyBuckets. maybe remove the Default prefix if these are not intended to be overridden directly.

@Xaelias Xaelias closed this Jan 15, 2026
@Xaelias Xaelias reopened this Jan 15, 2026
Copy link
Member

@konradreiche konradreiche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. What would it look like to test those changes in an existing or new Go test?


import "time"

const (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they can be declared as constants, it's definitely preferable.


import "time"

const (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is one service that is overriding the prometheusbp.DefaultLatencyBuckets. maybe remove the Default prefix if these are not intended to be overridden directly.

@Xaelias Xaelias force-pushed the chore_-_adhoc_-_2026-01-12_-_add_support_for_native_histograms branch 3 times, most recently from b1d7c95 to 5bf74f1 Compare January 20, 2026 22:26
Add support for native histograms using the following settings:
- NativeHistogramBucketFactor: 1.1
- NativeHistogramMaxBucketNumber: 160
- NativeHistogramMinResetDuration: 1h
@Xaelias Xaelias force-pushed the chore_-_adhoc_-_2026-01-12_-_add_support_for_native_histograms branch 3 times, most recently from 6c05835 to 86ba4be Compare January 21, 2026 17:20
@Xaelias Xaelias force-pushed the chore_-_adhoc_-_2026-01-12_-_add_support_for_native_histograms branch from 86ba4be to dd13d98 Compare January 21, 2026 17:35
Copy link
Contributor

@kylelemons kylelemons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but def make sure to sync with the Baseplate team before merging


// DefaultNativeHistogramMinResetDuration is the default minimum duration between
// resets for native histograms.
DefaultNativeHistogramMinResetDuration = time.Hour
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔕 (nit) I like to treat the constants as units that always need a coefficient for readability:

Suggested change
DefaultNativeHistogramMinResetDuration = time.Hour
DefaultNativeHistogramMinResetDuration = 1 * time.Hour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants