Skip to content

GH-1459: Improve MeterRegistry Discovery #1460

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

Merged
merged 3 commits into from
May 18, 2022

Conversation

garyrussell
Copy link
Contributor

Resolves #1459

cherry-pick to 2.4.x

throw new IllegalStateException("No micrometer registry present");
}
Map<String, MeterRegistry> registries = context.getBeansOfType(MeterRegistry.class, false, false);
registries = filterRegistries(registries, context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why does ObjectProvider.getIfUnique() not work for us here:


	/**
	 * Return an instance (possibly shared or independent) of the object
	 * managed by this factory.
	 * @return an instance of the bean, or {@code null} if not available or
	 * not unique (i.e. multiple candidates found with none marked as primary)
	 * @throws BeansException in case of creation errors
	 * @see #getObject()
	 */
	@Nullable
	T getIfUnique() throws BeansException;

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we get one from?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ApplicationContext.getBeanProvider(Class<T> requiredType)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know about that; I've only seen them in the context of auto wiring. Cool.

@artembilan artembilan merged commit cffebb9 into spring-projects:main May 18, 2022
@artembilan
Copy link
Member

... and cherry-picked to 2.4.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhanced configurability for micrometer utilization in AbstractMessageListenerContainer
2 participants