I’m trying to use the micrometer and instrumented the JPA repository and annotated it with @Observed
.
I can see the traces & metrics around that but a new trace is generated with every method call from that JPA repository.
I tried using GlobalChannelInterceptor as follows but issue still persists –
@Bean
@GlobalChannelInterceptor
ObservationPropagationChannelInterceptor observationPropagationChannelInterceptor(final ObservationRegistry observationRegistry) {
log.info("Registering ObservationPropagationChannelInterceptor with the registry {}", observationRegistry);
return new ObservationPropagationChannelInterceptor(observationRegistry);
}
Here’s how I define the DirectChannel –
@Bean(name = CHANNEL_NAME)
public MessageChannel myInputChannel() {
DirectChannel directChannel = new DirectChannel();
directChannel.setComponentName(CHANNEL);
directChannel.setDatatypes(ConsumerRecord.class);
return directChannel;
}
Can someone please help in propagating the context properly in this such cases.
Suyash Soni is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.