MP Metrics provides a recommendation to support multiple applications
However it also mention that this recommendation also applies to EAR with subdeployments.
It write that the subdeployments can use their META-INF/microprofile-config.properties properties file to specify an unique mp.metrics.appName property.
This does not work with smallrye-metrics. All injected metrics (regardless of the subdeployments) are registered from io.smallrye.metrics.setup.MetricCdiInjectionExtension.
The code will end up in org.eclipse.microprofile.metrics.MetricID#MetricID(java.lang.String, org.eclipse.microprofile.metrics.Tag...) that will call ConfigProvider.getConfig() to load the Config object to read the configuration properties.
At this point, the Config will be fetched corresponding to the TCCL which is the EAR ClassLoader.
All registered metrics in the EAR will use the same Config object and will not use their properties from their respective META-INF/microprofile-config.properties file.
Am I missing something on how this feature is supposed to work for EAP deployment with subdeployments?
MP Metrics provides a recommendation to support multiple applications
However it also mention that this recommendation also applies to EAR with subdeployments.
It write that the subdeployments can use their
META-INF/microprofile-config.propertiesproperties file to specify an uniquemp.metrics.appNameproperty.This does not work with smallrye-metrics. All injected metrics (regardless of the subdeployments) are registered from io.smallrye.metrics.setup.MetricCdiInjectionExtension.
The code will end up in
org.eclipse.microprofile.metrics.MetricID#MetricID(java.lang.String, org.eclipse.microprofile.metrics.Tag...)that will callConfigProvider.getConfig()to load theConfigobject to read the configuration properties.At this point, the
Configwill be fetched corresponding to the TCCL which is the EAR ClassLoader.All registered metrics in the EAR will use the same
Configobject and will not use their properties from their respectiveMETA-INF/microprofile-config.propertiesfile.Am I missing something on how this feature is supposed to work for EAP deployment with subdeployments?