Azure/diagnostics-eventflow

ServiceFabricDiagnosticPipelineFactory doesn't relate log with service fabric information

davidelettieri opened this issue · 3 comments

Hi,

We're trying to configure EventFlow with service fabric and application insight using the configuration below. We are writing logs using the ILogger interface and the LogInformation method.

We are able to see the logs in AI but they doesn't contain any SF specific info such as ServiceFabric.ApplicationName

  "inputs": [
    {
      "type": "Microsoft.Extensions.Logging"
    }
  ],
  "filters": [
    {
      "type": "drop",
      "include": "Level == Verbose"
    }
  ],
  "outputs": [
    {
      "type": "ApplicationInsights",
      "instrumentationKey": "key"
    }
  ],
  "schemaVersion": "2016-08-11",
  "extensions": []
}

What kind of SF application is this and what version/type of .NET Framework/ASP.NET is it using?

EventFlow does not add Service Fabric context to the traces. We have an Application Insights SDK telemetry module that does that: https://github.com/Microsoft/ApplicationInsights-ServiceFabric

You can enable this module in two ways

  1. Use configurationFilePath parameter to ApplicationInsights output to provide your own Application Insights SDK configuration file that would include the Service Fabric telemetry module. For more information see https://github.com/Azure/diagnostics-eventflow#application-insights and https://github.com/Azure/diagnostics-eventflow#support-for-service-fabric-settings-and-application-parameters (the latter for servicefabricfile: scheme that allows you to point EventFlow to an arbitrary Service Fabric configuration file).
  2. Another way is to just ditch EventFlow and use Application Insights SDK directly. If you do not need the flexibility of EventFlow and the only destination for your logs is Application Insights, this is entirely reasonable. Application Insights SDK has native support for ILogger if used in ASP.NET Core environment.

Hope this helps--I realize this is a bit terse. Let us know how it goes and if you have further questions.

Looks like you found the SF telemetry module already microsoft/ApplicationInsights-ServiceFabric#100 Are you trying to work around that issue using EventFlow?

Thanks for the reply

Looks like you found the SF telemetry module already microsoft/ApplicationInsights-ServiceFabric#100 Are you trying to work around that issue using EventFlow?

I was actually, since we used event flow in another project I was giving it a try.

We were trying to use AI SDK in a .NET Stateless service (not ASP.NET Core) and as I already mentioned in microsoft/ApplicationInsights-ServiceFabric#100 logs are sent to AI but without the SF Context.

I'm closing this issue, thanks for your support :)