I am using following azure application insights sdk for go - https://github.com/microsoft/ApplicationInsights-Go/tree/master
and I wanted to use following close method from following file -
https://github.com/microsoft/ApplicationInsights-Go/blob/master/appinsights/telemetrychannel.go
but it is not sending telemetry to application insights but when I am using Flush method then it is sending the telemetry. But the problem with flush method is that I have to put extra sleep method (with 2 or 5 seconds of sleep).
Please not I am directly calling the method (cant share full code snippet):
appInsClient.Channel.Close() and result which I am getting is empty channel.
if possible please share the code snippet that I can if I want to execute following method.
It is due to the asynchronous nature of telemetry submission in the SDK.
Introduces a short delay (1 second in this case) after flushing the channel and before calling the
Closemethod.The delay allows time for the telemetry to be processed and sent. Adjust the delay duration based on the application's requirements.
Here is the code is to use a combination of the
FlushandClosemethods along with a short delay.Code:
Availability Check: