In my sample project, I am using EventFlow to collect my diagnostic data and output to ApplicationInsight. Logging is also done through ApplicationInsight. Diagnostic data showed up on the ApplicationInsight portal, but all telemetry types show as TRACE (even though diagnostic sends with telemetry type REQUEST). But if I directly log with ApplicationInsight (without EventFlow), it will correctly show the right Telemetry Type in ApplicationInsight. Below is my EventFlow config file and sample code I used.
By the way my sample application is ASP.NET Core2 Web API.
eventFlowConfig.json
{
"inputs": [
{ "type": "ApplicationInsights" }
],
"outputs": [
// Please update the instrumentationKey.
{
"type": "ApplicationInsights",
"instrumentationKey": "xxxxxxxxxxx"
}
],
"schemaVersion": "2016-08-11"
}
Sample Code
public void ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry();
services.AddApplicationInsightsTelemetryProcessor<EventFlowTelemetryProcessor>();
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
var telemetryConfiguration = app.ApplicationServices.GetService<TelemetryConfiguration>();
var eventFlowTelmetryProcessor = (EventFlowTelemetryProcessor)telemetryConfiguration
.TelemetryProcessors
.First(x => x.GetType() == typeof(EventFlowTelemetryProcessor));
if (eventFlowTelmetryProcessor != null)
{
var diagnosticPipeline = app.ApplicationServices.GetService<DiagnosticPipeline>();
eventFlowTelmetryProcessor.Pipeline = diagnosticPipeline;
}
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
}
Here I attached a screenshot of ApplicationInsight for more clarity. Here It has some diagnostic data with telemetry type REQUEST but even those are shown as TRACE.
It happens because Event Flow AppInsights Ouput uses TrackTrace to handle all input events\telemetry, and these events are sent to the Trace table on ApplicationInsights.
It also uses the AppInsights Event Type(Request) to set the LogLevel of these events, Like Informational, Trace, Debug.
Because of this unnecessary processing, you lose something on the way to its destination. Why not log direct to appInsights instead of adding this extra overhead to parse to eventFlow and then send to AppInsights?