-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing registry from CompositeMeterRegistry removes composite meters added to the removed registry #2281
base: 1.5.x
Are you sure you want to change the base?
Conversation
…oesn't extends AbstractCompositeMeter.
…d when a child registry is removed
Currently, the PR fails because the test "io.micrometer.core.instrument.binder.logging.Log4j2MetricsTest > asyncLogShouldNotBeDuplicated()" fails. Please, can anyone reRun the build in circleci? Thanks! |
@jkschneider, could you help me? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pull request and patience on it getting reviewed. I'd like to focus this pull request on solving the scenario for #1159. That is, removing a child registry from a composite should remove the meter contributed from the composite. I've handled fixing #2354 in a different way in #2362. The changes here now should work as is, but I've left some comments about simplifications given #2362, and the tests should be updated to ensure we're covering the original issue described in #1159.
Also, we will want to merge this into 1.3.x
so we can include it in that line of maintenance releases, but I can take care of that on merging if you don't want to deal with rebasing and changing the target branch.
...meter-core/src/main/java/io/micrometer/core/instrument/composite/CompositeMeterRegistry.java
Show resolved
Hide resolved
...r-core/src/test/java/io/micrometer/core/instrument/composite/CompositeMeterRegistryTest.java
Show resolved
Hide resolved
...r-core/src/test/java/io/micrometer/core/instrument/composite/CompositeMeterRegistryTest.java
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/composite/CompositeCustomMeter.java
Show resolved
Hide resolved
...r-core/src/test/java/io/micrometer/core/instrument/composite/CompositeMeterRegistryTest.java
Show resolved
Hide resolved
public final void remove(MeterRegistry registry) { | ||
for (; ; ) { | ||
if (childrenGuard.compareAndSet(false, true)) { | ||
try { | ||
Map<MeterRegistry, T> newChildren = new IdentityHashMap<>(children); | ||
newChildren.remove(registry); | ||
newChildren.computeIfPresent(registry, (reg, met) -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
micrometer-core/src/main/java/io/micrometer/core/instrument/composite/CompositeCustomMeter.java
Show resolved
Hide resolved
...meter-core/src/main/java/io/micrometer/core/instrument/composite/CompositeMeterRegistry.java
Show resolved
Hide resolved
...r-core/src/test/java/io/micrometer/core/instrument/composite/CompositeMeterRegistryTest.java
Show resolved
Hide resolved
...r-core/src/test/java/io/micrometer/core/instrument/composite/CompositeMeterRegistryTest.java
Show resolved
Hide resolved
@admoca60 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
5 similar comments
@admoca60 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@admoca60 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@admoca60 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@admoca60 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@admoca60 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
Dear @shakuzen I had a mistake and I answered your comments at last Nov 20th, but I forgot click on "Submit Review". Currently, most of these comments are obsoleted, but one of them was very important. I will copy&paste it to review. I was asking about the expected behaviour of a metric after the child registry was removed and added (again) to a composite meter registry. The comment was:
|
This is the pull request to fix the issue #1159
My branch was created from 1.5.x. I don't know if it's correct or now. Please, fix me if I'm wrong!
Thank you!