1
votes

I have a public facing API that calls to a backend Web App that, in turn, calls out to another API (in same API Management instance as first API) that makes an external call.

My Web App is a Spring Boot using Apache HTTP client and the SDK is configured for AI, and I can see the AppInsights through to the dependency call. But at this point, the call to the next APIMgmt API creates a new request that is not correlated and shows up as a seperate operation (but with the correct BACKEND event).

I've tried passing "Request-Id" and "Correlation-Context" (unmodified) from my Apache client to the API. App Insights show up but under the wrong parent and have no BACKEND events.

How can I correlate this chain of events?

1
Would you enhance the question title please - to indicate that this question is also related to Apache HTTP / Spring Boot. Thanks.Kai Walter

1 Answers

2
votes

After a lot of testing, debugging and reading. This is doable, but you have to access the RequestTelemetry from within your calling code to get the correct Request-Id header value.

    RequestTelemetryContext ctx = ThreadContext.getRequestTelemetryContext();
    RequestTelemetry reqTel = ctx.getHttpRequestTelemetry();
    String currentRequestId = reqTel.getId();