I am very new to Elastic APM and not sure how it can support different frameworks. I can see that from the documentation APM supports Spring Boot. I was wondering if it supports Spring Cloud Stream as well. Spring Cloud Stream provides Event Driven Architecture by using Spring Boot and messaging middleware. Middleware can be Kafka, RabbitMQ, etc.
However, Elastic APM agents expose APIs that provide the ability to follow traces across multiple services programatically. If you have the ability to add a string property to your messages/events on the producer side and read them on the consumer side, this is all you need. Install Elastic APM agents on each of your services and let them instrument your applications. When producing a message to send, use our APIs to get a string representation of the trace context and attach it to the message. When receiving a message, use this trace context string to initiate a transaction related to the same trace.
Both injectTraceHeaders and startTransactionWithRemoteParent works based on request and response headers. Spring cloud stream does not use http, so we need to have some kind of interceptor to message producer and consumer and add trace details to message header right?
Please confirm.
Yes, you are correct. The header in the name may be misleading, it is not restricted in any way to HTTP.
As you say, you need to find an interceptor on the producer side that provides a hook for adding a String property/header/attribute to the message and call the injectTraceHeaders API with an implementation of HeaderInjector that uses it. On the consumer side, you need to find an interceptor that provides a way for reading this String and call the startTransactionWithRemoteParent API with an implementation of either HeaderExtractor or HeadersExtractor that uses it.
I hope this helps. Please let us know how it worked out.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.