opentracing-contrib / java-spring-messaging

OpenTracing Spring Messaging instrumentation
Apache License 2.0
3 stars 11 forks source link

Exception in instrumenting Spring Cloud Stream with Solace Binder #33

Open hctsang96 opened 4 years ago

hctsang96 commented 4 years ago

Hi all,

In my spring boot app, I used Spring Cloud Stream (with Solace binder), and tried to integrate with Open Tracing API implementation for Spring Cloud (which supports Spring Cloud Stream) but failed with the stack trace as below, probably due to incompatible data type (not supported by Solace SDTMap) of Open API info in message header.

My question is if I can DISABLE the instrumentation related to Spring Cloud Stream, such that I can have the transaction complete normally, and able to keep using OpenTracing API for most of instrumentation.

Any advice is welcome! Thanks

[account-web-v1-7ff588d759-hbqqr account] 2020-05-13 09:21:06.610 ERROR 1 --- [ask-scheduler-6] o.s.integration.handler.LoggingHandler   : org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.cloud.stream.binder.AbstractMessageChannelBinder$SendingHandler@31c62948]; nested exception is com.solace.spring.cloud.stream.binder.util.SolaceMessageConversionException: java.lang.IllegalArgumentException: Invalid type as value - ThreadLocalScope, failedMessage=GenericMessage [payload=byte[14], headers={messageSent=true, id=0ecc2e6c-6585-a781-00db-d613a97bb696, contentType=application/json, io.opentracing.contrib.spring.integration.messaging.OpenTracingChannelInterceptor.SCOPE=io.opentracing.util.ThreadLocalScope@72c13964, uber-trace-id=b69af8c09af7a43f:b69af8c09af7a43f:0:1, timestamp=1589361666604}]
pavolloffay commented 4 years ago

The instrumentation is loaded by this auto configuration https://github.com/opentracing-contrib/java-spring-messaging/blob/e57ad163b8640dd8362a200cd835f83746d9608c/opentracing-spring-messaging-starter/src/main/java/io/opentracing/contrib/spring/integration/messaging/OpenTracingChannelInterceptorAutoConfiguration.java#L29.

Normally our auto instrumentation have a property that can be used to disable it, however, this does not have it. Then the auto-configuration can be disabled by excluding jar or via https://www.baeldung.com/spring-data-disable-auto-config#disable-using-annotation.

I am moving this to java-spring-messaging repository. Would you like to submit a PR to fix it?

MikeR13 commented 4 years ago

I am having the same problem, too. And asked this question on https://stackoverflow.com/questions/63491625/opentracing-spring-cloud-stream-and-solace. Is there a possibilty to keep the OpenTracingChannelInterceptor and the integration with solace?

Thank you