When using axon-micrometer we have a warning regarding QueryEventEmitter not having a MessageMonitor

Hi,

When starting our application with the axon-micrometer package we get the following warning:
“Cannot provide MessageMonitor for component [queryUpdateEmitter] of type [QueryUpdateEmitter]. Returning No-Op instance.”

The warning is being logged from the GlobalMetricsRegistry in the axonframework.micrometer package.

The QueryUpdateEmitter is auto-configured, so I would expect it to not give warnings by default.

As a quick fix to not have the warning I’ve extended the GlobalMetricRegistry and added an override for the “registerComponent” method see below:

`
public class CustomGlobalMetricRegistry extends GlobalMetricRegistry {

public CustomGlobalMetricRegistry(MeterRegistry meterRegistry) {
super(meterRegistry);
}

@Override
public MessageMonitor<? extends Message<?>> registerComponent(Class<?> componentType, String componentName) {
if (QueryUpdateEmitter.class.isAssignableFrom(componentType)) {
return registerQueryBus(componentName);
}
return super.registerComponent(componentType, componentName);
}
}
`

Is the warning a bug? or are we doing something wrong?

Thanks in advance!

Hi,

this isn’t really a bug, as it doesn’t affect production, but it is annoying that this gets logged.
Basically, components that support metrics can request a MessageMonitor instance from the Configuration API. If MessageMonitors are available, but none has been registered for a specific type of component, it reports this as a warning.

Ignoring for now is fine. Note that calling “registerQueryBus” is strictly speaking incorrect, as that will return a MessageMonitor<? extends QueryMessage<?,?>>, which isn’t compatible with the type of monitor that the QueryUpdateEmitter expects (MessageMonitor<? super SubscriptionQueryUpdateMessage<?>>). Because of generic type erasure in Java, this usually doesn’t pose any problem, but it could.

Note that you can also configure a monitor (even the NoOp instance) explicitly using the Configuration API. In that case, you wouldn’t have to override the GlobalMetricRegistry’s methods.

In the meantime, we will improve the default settings.

Kind regards,

Allard Buijze
CTO

E: allard.buijze@axoniq.io
T: +31 6 34 73 99 89