TelemetryClient不发送任何数据,除非同花顺被称为 [英] TelemetryClient does not send any data unless Flush is called

查看:545
本文介绍了TelemetryClient不发送任何数据,除非同花顺被称为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我直接在我的code。使用TelemetryClient(v0.17.0.576),它看起来像我可以把数据天青只有当我手动调用它时觉得这是错的末端齐平。我失去了一些东西在这里?

  VAR配置= TelemetryConfiguration.CreateDefault();
            configuration.InstrumentationKey =KEY;
            VAR的客户=新TelemetryClient(配置);            的for(int i = 0;我小于10;我++)
            {
                log.Information(循环:{0} {1},我,值);                client.Track(新TraceTelemetry(值));
            }            client.Flush();


解决方案

有关性能方面的原因,应用程序洞察SDK批次遥测,并将它在块。要看到这个动作可以一起Thread.sleep代码(70000)的调用替换您的通话冲洗,你会看到仪表上传到AI一旦应用程序终止。

I'm using TelemetryClient (v0.17.0.576) directly in my code and it looks like I can push data to Azure only when I manually call Flush at the end which feels wrong. Am I missing something here ?

 var configuration = TelemetryConfiguration.CreateDefault();
            configuration.InstrumentationKey = "KEY";
            var client = new TelemetryClient(configuration);

            for (int i = 0; i < 10; i++)
            {
                log.Information("Loop: {0} {1}", i, value);

                client.Track(new TraceTelemetry(value));
            }

            client.Flush();

解决方案

For performance reasons, the Application Insights SDK batches telemetry and sends it up in chunks. To see this in action you can replace your Flush call with a call to Thread.Sleep (70000) and you will see the instrumentation uploaded to AI once the app terminates.

这篇关于TelemetryClient不发送任何数据,除非同花顺被称为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆