Skip to content
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

CompositeMeters don't ignore NoopMeters when forwarding value get calls to child. #1441

Open
jake-at-work opened this issue May 30, 2019 · 0 comments · May be fixed by #4093
Open

CompositeMeters don't ignore NoopMeters when forwarding value get calls to child. #1441

jake-at-work opened this issue May 30, 2019 · 0 comments · May be fixed by #4093
Labels
bug A general bug module: micrometer-core An issue that is related to our core module
Milestone

Comments

@jake-at-work
Copy link

For example, consider a CompositeCounter made up of Counters from two registries where one registry may have filtered or otherwise produces a NoopMeter. Invoking CompositeCounter.count() may result in either 0 from the NoopMeter or some other value from the other Counter.

The problem appears to be in AbstractCompositeCounter.firstChild() as it doesn't filter out NoopMeters when delegating to the child. Alternatively a CompositeMeter could avoid placing any NoopMeters in its collection of child meters.

@shakuzen shakuzen added bug A general bug module: micrometer-core An issue that is related to our core module labels Mar 3, 2022
@shakuzen shakuzen added this to the 1.7.x milestone Mar 3, 2022
@shakuzen shakuzen modified the milestones: 1.7.x, 1.8.x May 11, 2022
@jonatan-ivanov jonatan-ivanov modified the milestones: 1.8.x, 1.9.x Jan 12, 2023
jonatan-ivanov added a commit to jonatan-ivanov/micrometer that referenced this issue Sep 22, 2023
When a CompositeMeterRegistry is used and one of its CompositeMeters
is polled (its value is fetched), the returned value can depend on
the order of the registries inside of the composite if the composite
contains a registry that has any NoopMeters.

Example: a CompositeMeterRegistry contains two registries, A and B.
We create a counter in the composite and increment it once.
After this both A and B contain one counter but lets say that
in A the counter is ignored so it will be noop.
When the count called on CompositeCounter, it can return
either 0 (if NoopCounter was used)
or 1 (if the non-noop counter was used).

In order to fix this, we can ignore the NoopMeters
when Meters are polled in a composite registry.

Closes micrometer-metricsgh-1441
JannickKemming1997 pushed a commit to otto-ec/pdh-da_micrometer that referenced this issue Jan 16, 2024
When a CompositeMeterRegistry is used and one of its CompositeMeters
is polled (its value is fetched), the returned value can depend on
the order of the registries inside of the composite if the composite
contains a registry that has any NoopMeters.

Example: a CompositeMeterRegistry contains two registries, A and B.
We create a counter in the composite and increment it once.
After this both A and B contain one counter but lets say that
in A the counter is ignored so it will be noop.
When the count called on CompositeCounter, it can return
either 0 (if NoopCounter was used)
or 1 (if the non-noop counter was used).

In order to fix this, we can ignore the NoopMeters
when Meters are polled in a composite registry.

Closes micrometer-metricsgh-1441
JannickKemming1997 pushed a commit to otto-ec/pdh-da_micrometer that referenced this issue Jan 25, 2024
When a CompositeMeterRegistry is used and one of its CompositeMeters
is polled (its value is fetched), the returned value can depend on
the order of the registries inside of the composite if the composite
contains a registry that has any NoopMeters.

Example: a CompositeMeterRegistry contains two registries, A and B.
We create a counter in the composite and increment it once.
After this both A and B contain one counter but lets say that
in A the counter is ignored so it will be noop.
When the count called on CompositeCounter, it can return
either 0 (if NoopCounter was used)
or 1 (if the non-noop counter was used).

In order to fix this, we can ignore the NoopMeters
when Meters are polled in a composite registry.

Closes micrometer-metricsgh-1441
jkemming added a commit to jkemming/micrometer that referenced this issue Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug module: micrometer-core An issue that is related to our core module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants