Summarizing REST calls from a C++ client in a Transaction?


I have a fat client which is written in C++ and communicates with a Java backend using REST. Many “actions” performed in the client call a handful of REST endpoints (mostly between 1 and 10 each).

Now I would like to summarize the REST-calls from the client which are performed during one action in APM transactions and I am thinking about the best way to do this. At the moment, I am thinking about two alternatives:

  1. Providing an additional (dummy) REST endpoint in my Java application which just uses the ElasticApm API to start a new transaction and returns the transaction ID to the client. The client calls this endpoint at the beginning of every action and then sets this ID as the tracestate header of every request it makes as part of the action. I then probably need another endpoint to “finish” the transaction (I might need to store the Transaction instances in a static variable or something to achieve this)

  2. Directly calling the API of the APM server from my C++ application. This appears a bit more complicated as I first would need to figure out how to use the API.

I also saw that there is the Transaction.ensureParentId for RUM in the Java API of the agent. Maybe I could also use that one somehow and pretend my C++ client is actually a Browser and just utilize the RUM functionality?

Any ideas on how I can achieve that easily without basically having to write a fully fledged C++ APM agent? I don’t really care about Spans or errors or anything from C++ - I just would like to see transactions in Elastic APM which contain all the REST calls made during one “action” in C++.