Skip to content

Duplicate meter binding when context contains multiple registries, none are primary, and one or more is a composite #42396

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wilkinsona opened this issue Sep 20, 2024 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

See #42310 for discussion and background.

When there are multiple MeterRegistry beans and none of them is marked @Primary, auto-configuration creates a @Primary composite meter registry that contains every MeterRegistry bean. In such a situation, MeterRegistryPostProcessor will bind and MeterBinder beans to every CompositeMeterRegistry in the context. This works as intended when the auto-configured composite is the only CompositeMeterRegistry. However, when there's a user-defined composite as well as the auto-configured composite, it results in meters being bound twice to the user-defined composite: once directly when the user-defined composite is post-processed and once when the auto-configured composite cascades the binding down to the meter registries that it contains.

When the context contains an auto-configured composite, we should ignore every meter registry other than the auto-configured composite.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant