Full trace with custom integration

Welcome to the forum :slight_smile:

Yes, you can link the two transactions together into one trace by ensuring that you pass on the current traceparent from the outgoing service (service A) and read it again in the receiving service (service B). This happens automatically with HTTP based services, but if you use raw TCP or UDP, you need to pass this information along manually.

I assume you use the agent API to manually start a new transaction in service A. During an active transaction, you can always call agent.currentTraceparent, to get the current traceparent string. You need to send this to service B inside your regular UDP request. Then when you start a new transaction in service B using agent.startTransaction(), you need to pass in the traceparent as a childOf option.

Service A example:

agent.startTransaction('my-service-a-transaction')
const traceparent = agent.currentTraceparent

// Somehow send the traceparent as a "header" to service B
sendMetadata(`traceparent: ${traceparent}\n`)

Service B example:

// Somehow read the traceparent from the incoming request
const traceparent = readTraceparentFromUDPPacket()

// Use the traceparent to initialize the new transaction
agent.startTransaction('my-service-b-transaction', { childOf: traceparent })

// continue program as normal...