Open davidelettieri opened 5 years ago
@lmolkova Would you be able to share any example to correlate custom event with the Activity?
As long as OperationCorrelationTelemetryInitializer
is configured, there is no need to do anything else - it will use Activity and stamp ids on all telemtery items including custom events.
Here is where it is added in the example: https://github.com/yantang-msft/service-fabric-application-insights-example/blob/master/StatelessBackend/StatelessBackend.cs#L32
I'm sorry my question was not very clear. I'll try to add some context.
On a .NET Core Web Api Stateless service I have the following action on a controller and the LogInformation calls are correctly linked to the request as shown in the screenshot of my first comment. The random value is retrieved via remoting from another stateless service
Here I have the service I call and I create the tracking events that are shown in my first comment. I also have two LogInformation calls that are in AI but are not related to the chain of calls.
I would like to use the logging infrastructure to log to AI but also be able to follow through the calls and find all the logs.
Let me know if I should clarify more.
@davidelettieri I suppose you have done something like this in your asp.net core project:
WebHost.CreateDefaultBuilder(args)
.UseApplicationInsights()
.ConfigureLogging(logging =>
{
logging.AddApplicationInsights();
}
@lmolkova I don't see the OperationCorrelationTelemetryInitializer
added here. Would it be a bug of the asp.net core sdk?
OperationCorrelationTelemetryInitializer
is configured implicitly inside TelemetryConfiguration.CreateDefault
https://github.com/Microsoft/ApplicationInsights-aspnetcore/blob/883589c8a99fded1b754c5ed688734274c9243e9/src/Microsoft.ApplicationInsights.AspNetCore/Implementation/TelemetryConfigurationOptions.cs#L17
Following this I was able to configure a stateless service to events to AI, I'm also able to write logs to AI but the logs from the Stateless service are not related to the chain of call as shown in the screenshot
Is there any snippet I can use to make this work?