Add immutable noop Observation.Context#7133
Merged
jonatan-ivanov merged 1 commit intomicrometer-metrics:1.15.xfrom Jan 29, 2026
Merged
Add immutable noop Observation.Context#7133jonatan-ivanov merged 1 commit intomicrometer-metrics:1.15.xfrom
jonatan-ivanov merged 1 commit intomicrometer-metrics:1.15.xfrom
Conversation
jonatan-ivanov
commented
Jan 28, 2026
shakuzen
reviewed
Jan 28, 2026
Member
shakuzen
left a comment
There was a problem hiding this comment.
Thanks for this. We should do this in the maintenance branches, right?
marcingrzejszczak
approved these changes
Jan 28, 2026
a4048f4 to
a642ef9
Compare
Member
Author
When I started I was not sure but looking at how it ended up, I think so, I moved to |
Before this change, the Observation.Context instance used for noop observations were mutable. This can be a source of memory leaks if the user gets a noop Observation and writes the context directly. This change introduces an immutable noop implementation. See micrometer-metrics#7105 (comment)
a642ef9 to
664307d
Compare
Member
Author
|
Forward merge will be a bit more adventurous, let me know if it looks ok and I will merge it. |
shakuzen
approved these changes
Jan 29, 2026
inshining
pushed a commit
to inshining/micrometer
that referenced
this pull request
Jan 30, 2026
Before this change, the Observation.Context instances used for noop observations were mutable. This can be a source of memory leaks if the user gets a noop Observation and writes the context directly. This change introduces an immutable noop implementation. See micrometer-metrics#7105 (comment)
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.
Before this change the
Observation.Contextinstance used for noop observations were mutable.This can be a source of memory leaks if the user gets a noop Observation and writes the context directly:
This change introduces an immutable and noop
Observation.Contextimplementation.See #7105 (comment)