So I am creating webjob which will be processed in background of the webapp. I have configured my webjobs with InMemoryChannel because I thought there will be no power-cut issue or issues like latency in memory on App Service. In ServerTelemetryChannel it will store data on disk, which in this case is not possible when hosted on App Service. Am I thinking it right way? Should I continue using InMemoryChannel for production as well when the program is used as a webjob?
Right now with InMemoryChannel I am receiving logs properly with a bit delay on Application Insight when I am running console application on my machine and not on webjob.
CodePudding user response:
InMemoryChannel or ServerTelemetryChannel?
InMemoryChannel
Microsoft.ApplicationInsights.Channel.InMemoryChannel
is a lightweight loosy telemetry channel that is used by default.- Every SendingInterval (default is 30 seconds) or when the number of items exceeds MaxTelemetryBufferCapacity (default is 500), it will batch data and send it out.
- If it fails to send telemetry, it will not try again.
InMemory channel
is well suited for short-running applications where a synchronous flush is ideal.- When nothing else is specified, the SDK will use this channel, which is part of the larger Microsoft.ApplicationInsights NuGet package.
ServerTelemetryChannel
- This channel is regarded more reliable and is recommended for all production applications due to these retry features and local disk storage.
What Telemetry Channel I should use?
ServerTelemetryChannel
is recommended for most production scenarios involving long-running applications.- We recommend that you create some delay after calling Flush() if you use this channel in cases where the programme is about to shut down.
If you need to do a synchronous flush, InMemoryChannel is the way to go.
Can you suggest me any good practice to apply ServerTelemetryChannel in my project.
Refer Configuration in code for .NET/.NET Core console applications