Fix PrometheusHttpServerBuilder copy constructor dropping the default handler#8619
Draft
thswlsqls wants to merge 1 commit into
Draft
Conversation
thswlsqls
force-pushed
the
fix/prometheus-http-server-to-builder-default-handler
branch
from
July 17, 2026 00:49
4895b3c to
8d2370a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8619 +/- ##
============================================
- Coverage 91.63% 91.60% -0.03%
- Complexity 10326 10343 +17
============================================
Files 1013 1013
Lines 27295 27353 +58
Branches 3205 3215 +10
============================================
+ Hits 25011 25058 +47
- Misses 1558 1567 +9
- Partials 726 728 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 #8618
Description
PrometheusHttpServerBuildercopy constructor copied 8 of the builder's 9 fields, omittingdefaultHandlerand silently losing anHttpHandlerset viasetDefaultHandler().build()stores a defensive copy on the server andtoBuilder()copies that again, sotoBuilder()users lose the handler despite the documented "same configuration as this instance" contract. The firstbuild()is unaffected — it passesdefaultHandlerfrom the field directly.authenticatorline: an identical@Nullable, setter-only field passed toHTTPServer.builder(). The field arrived in Make /metrics the only Prometheus metrics endpoint #6476 without a copy-constructor line;memoryModehad the same omission, fixed later in Enable reusuable_data memory mode by default #6799.Testing done
PrometheusHttpServerTest#toBuilder: the new assertion fails withexpected: <handler> but was: nullbefore the fix, passes after../gradlew :exporters:prometheus:check— 191 tests plus 1testJpmstest pass.CHANGELOG.md## Unreleasedentry added. No apidiff: signatures unchanged, alpha module untracked indocs/apidiffs/.*ITand GraalVM native-image tests (outsidecheck).