The Insights application sets the user in the context of RequestTelemetry, which is not displayed in the event details

I use Application Insights to track usage of my application. In my service, I use the App Insights API to manually track requests and exceptions and disable the default sets of initializers and telemetry modules that track requests and exceptions in favor of some custom tools based on the structure used. However, when I manually track such a request, I do not see any user information in the request details in the Application Insights toolbar.

A simplified version demonstrating the problem I am facing:

Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active
    .InstrumentationKey = "<InstrumentationKey>";
var tc = new TelemetryClient();
var request = new RequestTelemetry();
request.Context.User.Id = "1234";
request.Name = "Test Request";
tc.TrackRequest(request);

EDIT 11/30/15

It was an error in the application portal. Since then it has been allowed.

+4
source share
4 answers

It should work. We are investigating this issue.

I created a problem here: https://github.com/Microsoft/ApplicationInsights-dotnet/issues/111

+2
source

That should work, I did something similar. To clarify, you see that your telemetry telemetry appears on the control panel, but you do not see any data in your user charts? You can also try setting the AuthenticatedUserId field to see if this works.

+1
source

SessionId Userid. Userid, sessionId null

+1
source

I recently discovered that if UserAgent is not installed in the telemetry context, user and session data will be ignored. Try setting Context.User.UserAgent to something (ideally HttpContext.Request.UserAgent, but any non-empty line should work).

+1
source

Source: https://habr.com/ru/post/1614481/