Distributed Tracing Across .NET and Java with OpenTelemetry
articleNovember 26, 2026By Ali Haghighi
An API may spend most of its response time waiting on a service written in another language. An application-level log might show the timeout, but it cannot necessarily show the path the request took.
While working on a cross-language tracing experiment in November 2026, I wanted the investigation layer to understand that path without asking a language model to invent a dependency graph.
The useful data already exists in the trace.
Preserve context across the boundary
OpenTelemetry supports propagation of trace context across HTTP and other instrumented transports. With W3C Trace Context, a downstream service can receive the trace identifier and the parent span context through the traceparent header.
A .NET service and a Java service do not need to share an application framework. They need compatible context propagation, appropriate instrumentation and a way to export their spans to a trace backend.
For a small lab, I would instrument the inbound server and outbound HTTP client in both runtimes and export the resulting spans using OTLP. Check version compatibility before choosing automatic instrumentation, particularly for older Java runtimes.
Reconstruct the call tree from identifiers
The following example is illustrative, not a production measurement:
.NET API [0-------------------------240 ms]
Java API [30-------------180 ms]
Database [45------125 ms]
Remote API [130--165 ms]Join parent and child spans using their identifiers within the same trace. Use timestamps and durations to draw the waterfall. A child span that references an unavailable parent should be displayed as incomplete rather than silently attached to another service.
The trace tells us that these recorded operations occurred. A dependency being present does not, by itself, make it the cause of an incident.
Be careful with duration and self-time
Adding all span durations double-counts nested and overlapping work. For a span with children, one useful estimate of exclusive recorded time subtracts the union of the child intervals clipped to the parent interval.
That estimate is not CPU time. Nor does it prove which thread was blocked. Uninstrumented work and clock differences can make it misleading.
Identifying a critical path requires more than choosing the longest span. Parallel calls, synchronization points and asynchronous links affect which work actually determines the end-to-end duration. If the necessary causal information is absent, label the result as an estimate.
Make uncertainty visible
A useful trace view should distinguish:
- Explicit errors and span status from inferred errors.
- Slow recorded operations from uninstrumented gaps.
- Sequential and overlapping operations.
- Complete and partially sampled traces.
- Recorded evidence from AI-generated explanations.
Where available, a span can link to correlated logs using the trace identifier. A log correlation is useful evidence, but the absence of logs does not establish that an error never occurred.
Keep topology independent of AI
I would calculate parent relationships, intervals and duration summaries in application code. The model can explain the measurements or suggest which spans deserve inspection. It should not calculate the authoritative graph.
That separation makes the same trace evidence useful whether an AI provider is available or not.