I'm trying to set up distributed tracing across several .NET 8 microservices using OpenTelemetry. My current setup works for a single service, but the spans aren't correlating across services. Any recommendations on best practices or configuration snippets?
Make sure you export the traceparent and tracestate headers on every outbound HTTP call. In .NET, the HttpClient instrumentation does this automatically when you add services.AddOpenTelemetry().WithTracing(...). Also, verify that all services share the same Resource attributes (service.name, service.version) so they appear under the same application in the UI.
Also, if you use Kafka, you need to manually inject the context into the message headers. There's a helpful extension method in OpenTelemetry.Contrib.Extensions.Propagators that simplifies this.