You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When any publisher is used inside middleware of a message.Router and a handler is registered with router.AddNoPublisherHandler, the publisher_name label in metrics is incorrect.
Expected
Run code at the bottom of this message. It should produce metric where publisher_name="main.NoOpPublisher".
The obvious fix is to change the priority and use the decorated publisher name and, if it's empty, use the name from the context. However, it should never be empty, so it's puzzling why it's necessary to get the name from the context at all. Therefore, it's seems that the fix is not that simple.
Can I simply push a fix to use the name from m.publisherName or it will be incorrect and problem should be approached differently?
When any publisher is used inside middleware of a
message.Router
and a handler is registered withrouter.AddNoPublisherHandler
, thepublisher_name
label in metrics is incorrect.Expected
Run code at the bottom of this message. It should produce metric where
publisher_name="main.NoOpPublisher"
.Actual
Instead it produce metrics with
publisher_name="message.disabledPublisher"
.Cause
A publisher name is correctly set by metricsBuiled. When a handler is registered via
AddNoPublisherHandler()
,message.disabledPublisher
is used, and it's name is written to a context. ThePublisherPrometheusMetricsDecorator
tries to obtain from the name from the context first and only uses its own name if it's not present, resulting in the use ofmessage.disabledPublisher
, which is incorrect.Solution
The obvious fix is to change the priority and use the decorated publisher name and, if it's empty, use the name from the context. However, it should never be empty, so it's puzzling why it's necessary to get the name from the context at all. Therefore, it's seems that the fix is not that simple.
Can I simply push a fix to use the name from
m.publisherName
or it will be incorrect and problem should be approached differently?Code to reproduce
The text was updated successfully, but these errors were encountered: