We currently have an sequence ID that is shared/accessible for all our micro-services. And I'm wondering if there is a way to reuse this ID in the traceparent
.
My goal is that all our services can do tracing to the correct trace only using this already shared sequence ID. Anyone have any suggestions?
I have read about distributed tracing, but it all seems very related to HTTP requests. Not all of our services start with HTTP. Also that would mean propagating the traceparent
everywhere, when we already have our sequence ID accessible for all services. Our service chain can be decently long, some are HTTP requests, some are schedulers looking for work in a database, some services start with JMS (ActiveMQ), some a Java main loop looking for files on disk.
Other thoughts
I can create my own traceparent
, and change the trace_id
part, and pad my sequence ID with zeros:
{version}-0000000000000000{sequence ID}-{span_id}-{trace_flags}
But when I use this with ElasticApm.startTransactionWithRemoteParent(...)
I get detached spans. I'm guessing this is because with ElasticApm.startTransactionWithRemoteParent(...)
assume a transaction already exists, which is does not for the first service.
Stack version: 9.1.5 (Fleet with Elastic APM integration)
Dependency: co.elastic.apm:apm-agent-api:1.55.1
Java version: 17