{{ message }}
Verify and document native histograms with custom buckets (NHCB) support#1846
Merged
Conversation
… custom buckets (NHCB) Implements issue #1838 by verifying and documenting that client_java fully supports native histograms with custom buckets (NHCB, schema -53). According to the Prometheus specification, NHCB is handled by exposing classic histograms with custom bucket boundaries, which Prometheus servers convert to native histograms (schema -53) when configured with convert_classic_histograms_to_nhcb. Changes: - Add comprehensive test suite (11 tests) verifying custom bucket support for arbitrary, linear, and exponential boundaries - Add documentation section on custom buckets and NHCB to metric-types.md - Create complete working example with Docker Compose (Prometheus + Grafana) - Add verification report documenting findings Test coverage: - Arbitrary custom boundaries - Linear boundaries (equal-width buckets) - Exponential boundaries - Classic-only and dual-mode histograms - Text and protobuf format serialization - Labeled histograms and edge cases All 11 tests pass successfully. Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
- Compress table columns to fit 100 char line limit - Break long URL link across lines Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
6eff53c to
0f04572
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR verifies and documents that client_java supports native histograms with custom buckets (NHCB, schema -53), adds a concrete end‑to‑end example wired to Prometheus and Grafana, and updates contributor guidance around formatting and linting.
Changes:
- Add a comprehensive
CustomBucketsHistogramTestsuite covering arbitrary, linear, exponential, labeled, classic-only, and dual-mode histograms with custom buckets, including text and protobuf serialization. - Introduce an
example-custom-bucketsmodule with a runnable Java app, Docker Compose setup (Prometheus with NHCB enabled, Grafana dashboard), and README showing NHCB usage and verification. - Extend
metric-types.mdwith documentation for custom bucket APIs and NHCB usage, and updateCLAUDE.mdwith stricter style and linting guidance (with one mismatch vs. actualmisetask behavior).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Member
Author
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.

Fixes #1838
Summary
Addresses #1838 by verifying and documenting that
client_javafully supports native histograms with custom buckets (NHCB, schema -53).Background
According to the Prometheus Native Histograms specification, NHCB is handled by:
convert_classic_histograms_to_nhcb: trueChanges
1. Comprehensive Test Suite ✅
prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/CustomBucketsHistogramTest.java2. Documentation ✅
docs/content/getting-started/metric-types.md3. Working Example ✅
examples/example-custom-buckets/4. Verification Report ✅
CUSTOM_BUCKETS_VERIFICATION.mdTest Results
[INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
All tests pass successfully, confirming that custom bucket support works correctly in all scenarios.
Key Findings
✅ Custom bucket support is fully functional
How to Test
Run the tests:
./mvnw test -Dtest=CustomBucketsHistogramTest -pl prometheus-metrics-coreRun the example:
./mvnw package cd examples/example-custom-buckets docker-compose upThen visit:
Documentation Links