Description
ServerTelemetryChannel was enabled for .NET Core Applications starting 2.5.0-beta1 (https://github.com/Microsoft/ApplicationInsights-dotnet/releases/tag/v2.5.0-beta1)
This enabled .NET Core apps to use full functionalities provided by ServerTelemetryChannel including persistent storage, retries, adaptive sampling etc.
However, for non-windows users, this release caused an issue. (microsoft/ApplicationInsights-aspnetcore#551)
ServerTelemetryChannel relied on windows specific mechanisms to determine (and secure) local storage folder where telemetry items are stored when it cannot be sent to Application Insights due to temporary network issues. A workaround is currently made (#655).
With the above fix in place, starting with beta2 following is the way for Non-Windows users to fully use persistent storage capabilities.
- Create a local storage folder manually, and specify this in ServerTelemetryChannel.StorageFolder. Please make sure that the process running your application has write access to this folder, but also make sure this folder is protected from other users to avoid telemetry being read by unintended users.
Following code snippet inConfigureServices()
method in youStartup.cs
class shows how to use channel with custom storage folder.
services.AddSingleton(typeof(ITelemetryChannel), new ServerTelemetryChannel () {StorageFolder = "/tmp/myfolder"});
If the above is not done, telemetry will still be collected and sent, but in case of network issues, items will get dropped.