2
votes

Almost all request telemetry for my .NET core API is missing the UserId property. I've got an Angular SPA making HTTP requests to my API via Azure Front Door. The only request telemetry that has an UserId property is traffic that is not passed through Azure Front Door. To be precise: it's SignalR requests directly to the API. I have a feeling that our Angular app passes telemetry to our Application Insights (for the front-end only) and that in our other Application Insights (for the back-end only) things don't seem to line up. The dependency telemetry in the front-end is to a different URL than the request telemetry in the back-end is receiving. Azure Front Door is set to forward requests, so it does the request it receives again to the right destination.

Schematic overview of HTTP requests missing the UserId property in the back-end:

---------                          --------                       --------
|Angular|  GET domain.com/api1     | Front|  GET domain2.com/api  | Back |
|  app  | -----------------------> | Door | --------------------> | End  |
---------                          --------                       --------

Schematic overview of HTTP requests containing the UserId property in the back-end:

---------                          --------
|Angular|  GET domain2.com/signalr | Back |
|  app  | -----------------------> | End  |
---------                          --------

I've looked into the the request headers but I see no indication that a UserId is passed there and they are practically the same for requests to front door or directly to my API (hostname is the big difference there). I think that front door does the request with the same headers it gets the request.

First of all, are my assumptions correct? Is the problem that the URL the front-end dependency tracks is different than the back-end is receiving? If so, what can I do about this? I want to use the UserId for troubleshooting actions a specific user has done before he ran in to an issue (the "All available telemetry for this user session" feature).

1

1 Answers

0
votes

I think your issue is correlating front-end and back-end telemetry. There is a attribute operation_id which can be found on both front-end and back-end telemetries and can be used to correlate. You may want to customize both front-end and back-end telemetry to have authenticated userid. Have a look at the below resource on correlating telemetries. Hope that helps.

https://docs.microsoft.com/en-us/azure/azure-monitor/app/correlation