-
Notifications
You must be signed in to change notification settings - Fork 293
Description
Issue
ServerTelemetryChannel channel retries sending telemetry if transient errors occur. This channel uses local disk storage to keep items on disk during network outages or high telemetry volumes. In Windows, either %LOCALAPPDATA% or %TEMP% is used if no custom path is specified explicitly. In environments other than Windows, custom folder location should be provided or telemetry won't be stored to local disk.
Below trace information is logged to Application Insights, if storage location is not specified in non-windows environments like Linux or MacOS
AI: Local storage access has resulted in an error (User: ) (CustomFolder: ). If you want Application Insights SDK to store telemetry locally on disk in case of transient network issues please give the process access to %LOCALAPPDATA% or %TEMP% folder. If application is running in non-windows platform, create StorageFolder yourself, and set ServerTelemetryChannel.StorageFolder to the custom folder name. After you gave access to the folder you need to restart the process. Currently monitoring will continue but if telemetry cannot be sent it will be dropped. Error message:
In Windows, SDK creates a storage folder in %LOCALAPPDATA% or %TEMP% and restricts access to Current User and Administrators. Restricting permissions in non-windows environment won’t work as there are no .NET APIs available to change permissions in Linux or MacOS. SDK does not add permission when custom folder name is used, hence providing customer folder name is the only solution to use StorageFolder in Linux or MacOS environment. Providing custom storage location requires code change and not a viable option for production applications.
Related Issue: #1067
Microsoft Doc: StorageFolder - Linux/MacOS
Proposal
Modify ServerTelemetryChannel to read StorageFolder from an environment variable named APPLICATIONINSIGHTS_SERVERCHANNEL_STORAGEFOLDER. When this specific environment variable is present, consider the case as same of custom folder and avoid setting permission on it.