Rousonur Jaman
Rousonur Jaman

Reputation: 1261

Application Insight does not send data without using Thread.Sleep

I have a console application that runs through a web job scheduler after 15 minutes interval. But problem is that Application Insight Telemetry does not send data without using Thread.Sleep at the end of the code.

    private static void Main(string[] args)
    {
         Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = "APPINSIGHTS_INSTRUMENTATIONKEY";
        //do others stuff
        System.Threading.Thread.Sleep(10000);
   }

Here, I am using 10 sec for thread sleep. But sometimes it misses some data of the last portion. But, after giving 70 sec it working fine.

I want to know, what is the minimum sleep time where every data will be sent.

Or, there is any other way which does not need Thread.Sleep.

Upvotes: 0

Views: 667

Answers (1)

Peter Bons
Peter Bons

Reputation: 29780

What happens if you set DeveloperMode to true as outlined here? AI does not send telemetry items directly. If it does work in developer mode maybe you should call Flush as outlined here. Also, bear in mind it can take a few minutes before items appear in the portal

Upvotes: 1

Related Questions