You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a CompositeMeterRegistry has a descendant MeterRegistry that has filters it is possible to create a situation where multiple composite meters created by the CompositeMeterRegistry point to a single meter in the descendant registry. If any of these composite meters are removed from the CompositeMeterRegistry it will remove the meter in the descendant registry even if its still referenced by other composite meters.
Environment
Micrometer version 1.13.6
Micrometer registry CompositeMeterRegistry
OS: Linux
Java version: openjdk version "17.0.13" 2024-10-15 LTS
To Reproduce
The following code demonstrates the problem. After meter2 is removed in the following example, no output will ever be seen from meter1.
Meters are only removed from descendants when no composite meters reference them. In the example above the meter MeterId{name='scan.results', tags=[tag(address=localhost:1234)]} should only be removed from loggingRegistry after meter1 and meter2 are removed from compositeRegistry.
To implement this change, maybe a reference check could be added here prior to removal.
Additional context
Issue #1159 seems related, but its not the exact same problem. This issue and #1159 both point to a more general problem that CompositeMeterRegistry and its descendants form a graph of meters and referential integrity of this graph is not always being properly maintained.
The text was updated successfully, but these errors were encountered:
Describe the bug
When a CompositeMeterRegistry has a descendant MeterRegistry that has filters it is possible to create a situation where multiple composite meters created by the CompositeMeterRegistry point to a single meter in the descendant registry. If any of these composite meters are removed from the CompositeMeterRegistry it will remove the meter in the descendant registry even if its still referenced by other composite meters.
Environment
To Reproduce
The following code demonstrates the problem. After
meter2
is removed in the following example, no output will ever be seen frommeter1
.Running the example outputs the following.
Expected behavior
Meters are only removed from descendants when no composite meters reference them. In the example above the meter
MeterId{name='scan.results', tags=[tag(address=localhost:1234)]}
should only be removed fromloggingRegistry
aftermeter1
andmeter2
are removed fromcompositeRegistry
.To implement this change, maybe a reference check could be added here prior to removal.
Additional context
Issue #1159 seems related, but its not the exact same problem. This issue and #1159 both point to a more general problem that CompositeMeterRegistry and its descendants form a graph of meters and referential integrity of this graph is not always being properly maintained.
The text was updated successfully, but these errors were encountered: