DataDog / dd-trace-java

Datadog APM client for Java
https://docs.datadoghq.com/tracing/languages/java
Apache License 2.0
553 stars 277 forks source link

Span context propagation for the integration with third-party system #5095

Open Ekatereana opened 1 year ago

Ekatereana commented 1 year ago

Hi, my use case looks like this:

service-A with dd-agent makes a request to 3rd party system-B, and system-B then produces the event, that my Kafka consumer will consume. However, there is no option for how I may inject the dd agent into the system B, my trace hierarchy breaks. I though maybe I could send the trace-id of the parent trace from service-A in the body of the kafka event, but how then I will set it as the parent trace_id in consumer?

Is there any option to propagate span context from service-A to the consumer, though that system-B doesn't inject dd-agent?

PerfectSlayer commented 1 year ago

Hi @Ekatereana

There is mechanism for context propagation that can be applied automatically or used programmatically. Can you help me to understand your architecture, components and how they interaction with each others?

From your comment, here is what I picture (so I be wrong on multiples parts 😉 ):

graph LR;
    service-A -- request --> system-B
    system-B -- create event --> kafka
    kafka-consummer -- consume event --> kafka
    style service-A fill:#774aa4

Where: