microsoft / ApplicationInsights-ServiceFabric

ApplicationInsights SDK for ServiceFabric projects
MIT License
63 stars 26 forks source link

Need documentation on integrating AI config file with SF config API #27

Closed mikanyg closed 4 years ago

mikanyg commented 7 years ago

I am unable to figure out whether the applicationinsights.config should be placed in project root or in the PackageRoot\Config folder, as it should be when using Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights

I need to load the content of applicationinsights.config on startup and set it as the default configuration for all TelemetryClient instances used in SF services.

karolz-ms commented 7 years ago

I believe the answer to this is "does not matter--place the config file where AI SDK can find it" :-)

The simplest thing for an SF app is to load configuration explicitly from a well-known location, like SF AI output does it for example https://github.com/Azure/diagnostics-eventflow/blob/master/src/Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights/ApplicationInsightsOutput.cs#L148

If you are using EventFlow, that known location is the root of some Fabric configuration package https://github.com/Azure/diagnostics-eventflow/blob/master/src/Microsoft.Diagnostics.EventFlow.ServiceFabric/ServiceFabricDiagnosticPipelineFactory.cs#L42 So with EventFlow you can put the AI SDK config in any configuration package and as long as you pass the right package name to pipeline factory, the config file will be found and loaded.

The telemetry module & initializer in this package really "don't care" about AI SDK configuration file location. There might event be no config file if you are initializing everything imperatively.

mikanyg commented 7 years ago

In my simple test, I could not get the default telemetry intializers and processors from MS.AI.WindowsServer nuget package to work when I was using the eventflow approach where the ai.config was located in PackageRoot/Config folder.

We are already using eventflow with AI as output, and I have been experimenting with adding the other AI nuget packages (WindowsServer, SnapshotCollector and ServiceFabric) to benefit from the build-in initializers and processors, but I felt like hitting a brick wall, but some of them worked after moving the ai.config to project root.

karolz-ms commented 7 years ago

Please share the configuration that you are trying to enable (e.g. the "simple test" one) and I will see if there is a way to make it work--thx!

mikanyg commented 7 years ago

I am working on a simple setup, to repro this behaviour, but can't say when It'll be ready.

brahmnes commented 4 years ago

Closing this issue since it's been inactive and presumably the issue was resolved.