0
votes

I am tracking telemetry in the sdk of application insights with an applicationinsights.config file. In my output log I see this: pic

I want to grab ai.user.id and the session id and send them to azure. however, I am unsure as to how to do this. I read this: https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-filtering-sampling#add-properties-itelemetryinitializer

but I am still confused

1

1 Answers

0
votes

Write a TelemetryInitializer like this, and populate the Session Id.

class MyInitializer : ITelemetryInitializer
{         
    public void Initialize(ITelemetry item)
    {
        item.Context.Session.Id = "mysessionidvaluehere";
        item.Context.User.Id = "useridhere"
    }
}

Make sure you add this to the active configuration by TelemetryConfiguration.Active.TelemetryInitializers.Add(new MyInitializer())