Elastic APM / How to join a transaction?

41 views Asked by At

Elastic APM supports some often used frameworks and propagates the transaction / span context when one of that frameworks is used to make a call. But now I have to work with a system that is not supported out of the box. Hence, I have to write the glue code that would propagate the APM context for that system.

The whole should work as follows:

  1. I get an external call which is handled by Spring which is supported by APM and where I can get the information about the current APM transaction and span.
  2. Within the call processing, a DB entry is created.
  3. At a later point in time and in another thread, the DB entry is read and processed.

My objective is to propagate the APM context to the DB entry processing code.

My solution idea is:

  1. When creating the DB entry, I'd also save the information about the transaction and span (what is this? a string?)
  2. When the other thread reads the DB entry and starts to process it I'd call some APM API to join the APM transaction. I'd like the DB entry processing to be part of the same transaction but a new span.

To my surprise, I could not find the API to call to join the transaction. On the Public API page I found many methods but I can't find the one that allows me to say "I'm participating on the transaction with the ID such and such."

What method should I call to join an existing transaction? What serves as a transaction identifier?

0

There are 0 answers