i'm currently working on a solution to setting metric tags for the microprofile fault-tolerance framework. We're using it together with metrics, but one cannot directly set tags via the fault-tolerance annotations.
So we came up with a workaround setting a ThreadLocal
value via an Interceptor, which then is read by a custom ConfigSource
. The ConfigSource
checks for "mp.metrics.tags"
and "MP_METRICS_TAGS"
config keys in it's getValue(final String propertyName)
method. This would basically work if the getValue
would get called every time a fault-tolerance annotation is processed. But is seems like this is not the case and the invocations of the method happen randomly.
In my oppinion ConfigSources and their getValue(final String propertyName)
should always get called as a developer might rely on config values which could change every second.
Any ideas why the config source is not called?
It looks like the custom
ConfigSource
does no longer get called when returningnull
multiple times or at least during the server startup phase. In the mentioned scenario this can be bypassed by returning an empty string. Then theConfigSource
also gets called for everygetValue()
method call at runtime.