-
Notifications
You must be signed in to change notification settings - Fork 998
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
Gauges may be silently ignored when MeterFilters drop or transform tags #5616
Comments
Thank you for the issue! SimpleMeterRegistry registry = new SimpleMeterRegistry();
AtomicLong al1 = new AtomicLong(2);
AtomicLong al2 = new AtomicLong(3);
Gauge.builder("test.meter1", al1::get).tag("tag2","val2").register(registry);
Gauge.builder("test.meter1", al2::get).tag("tag2","val2").register(registry);
System.out.println(registry.getMetersAsString());
al1.set(7);
al2.set(11);
System.out.println(registry.getMetersAsString()); At the second registration, the Gauge that was registered in the previous line will be returned so the builder will not be applied since the This is because of the "async" nature of the I think we should document this behavior (you cannot register a micrometer/micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java Lines 631 to 645 in 602f6f3
|
@keith-turner Could you please take a look at #5617 |
For this situation the following scenario is where an error or log message would be helpful.
In step 2 above some data from gauges is silently ignored because of the meter filters. Developers X,Y,Z have no idea they are not seeing all of the data after working around the operational issue using meter filters. |
fyi: #5688 |
Describe the bug
As demonstrated by this example program Gauges can be silently ignored when meter filters drop or transform tags.
When run this example outputs :
The second gauge that was registered and its associated atomic long are silently ignored by the metrics system. Only the data related to the first gauge is seen. Tested with LoggingMeterRegistry and CompositeMeterRegistry also and saw the same behavior.
Environment
Expected behavior
There are a few things that could be done for this. Could simply document the behavior, was not able to find any warning about this in the micrometer documentation. Could add a way for user to specify a function to merge gauges. Could make registration fail with an exception if the gauge would be ignored. Could log a warning that data is being ignored.
Going forward an exception or log message warning that data is being ignored seems best because it would make it obvious to the user that data is not being seen. For the currently released version it would be nice to update the docs.
The text was updated successfully, but these errors were encountered: