-
Notifications
You must be signed in to change notification settings - Fork 41k
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
Make sure MeterBinder and CompositeMeterRegistry registration behavior is consistent #42310
Comments
I think there should be two composites. Boot using the user-created composite wouldn't really be in keeping with the auto-configuration approach as we'd be changing the user's configuration, leaving them with something that they may not want. For example, in your example above,
I think what we're missing is some logic in Boot to avoid binding meters to a composite that's part of another composite. That missing logic results in double binding which we should probably avoid, for efficiency if nothing else. WDYT, @jonatan-ivanov? Does that make sense? |
This branch contains an implementation of the fix that I've tried to describe above. |
I've since realised that this fix won't always work as it relies on the meter registries being processed in a particular order so that a nested composite is seen after the composite that contains it. I'm not yet sure what we can do about that. |
All of this makes sense, thank you! I'm not sure what to do with the ordering issue but I think your changes could make things better even if it won't work in all cases. |
Excluding user-created composites has the potential to be a breaking change. They may have defined a single One change that I think we can make is that, when there's an I'll leave this open, for now at least, until we decide what to do about the duplicate binding that remains. |
We discussed this one today and decided that we're going to leave things as they are for now. We can look at this again if it's still causing problems after the improvements made in #42396. |
First of all, maybe this is intentional and Boot should do what it does today but maybe the behavior of registering
MeterBinder
andCompositeMeterRegistry
have some inconsistencies (maybeMeterFilter
too).In the latest GA version of Boot (
3.3.3
), if I create a custom registry bean, let's say aSimpleMeterRegistry
in addition to what Boot creates, (let's sayPrometheusMeterRegistry
), binders are bound once, and the registry that will be injected if I ask for aMeterRegistry
isAutoConfiguredCompositeMeterRegistry
(what binders bound to).This behavior looks expected to me.
If I also create a
CompositeMeterRegistry
on top of the previous scenario (so I will have 1. Composite, 2. Simple, 3. Prometheus) Boot will create anAutoConfiguredCompositeMeterRegistry
where all three registries are registered (expected) but it will also bind every binders to two registries: toAutoConfiguredCompositeMeterRegistry
(expected) and to theCompositeMeterRegistry
that I created (unexpected?).This will result in the following structure:
Should there be two composites or should Boot back off and use the user-created composite to register other registries? If so, should binders be bound to all the composites?
The text was updated successfully, but these errors were encountered: