Azure 应用程序跳过事件
我使用此代码将事件发送到控制台应用程序中的application insightsAzure 应用程序跳过事件,azure,azure-application-insights,Azure,Azure Application Insights,我使用此代码将事件发送到控制台应用程序中的application insights TelemetryConfiguration.Active.InstrumentationKey = "XXXXXXXXX"; TelemetryClient telemetryClient = new TelemetryClient(); for (int i = 0; i < 100; i++) { tele
TelemetryConfiguration.Active.InstrumentationKey = "XXXXXXXXX";
TelemetryClient telemetryClient = new TelemetryClient();
for (int i = 0; i < 100; i++)
{
telemetryClient.TrackEvent("Hello World!");
telemetryClient.TrackException(new OutOfMemoryException());
}
telemetryClient.Flush();
Task.Delay(60000).Wait();
TelemetryConfiguration.Active.InstrumentationKey=“XXXXXXXXX”;
遥测客户端遥测客户端=新遥测客户端();
对于(int i=0;i<100;i++)
{
telemetryClient.TrackEvent(“你好,世界!”);
TrackException(新的OutOfMemoryException());
}
Flush();
Task.Delay(60000.Wait();
现在我遇到的问题是,它似乎并没有记录我所有的事件,有时VisualStudio工具栏上显示44,有时是68,而不是100
我将要发送的信息类型很重要,因为我将从此服务监视多个控制台应用程序
有没有办法让application insights将所有内容发送到azure而不跳过事件?我想我给了它足够的时间在离开之前发送所有的东西 如果没有完整的代码,很难说出所使用的配置。需要查找以下几点:
您好,您能提供完整的代码吗(删除一些机密信息)?完整的代码现在已经存在,不知道这两行代码会有什么不同。完整的代码在那里,除了初始化之外,没有遗漏任何东西,这就是为什么我一开始没有包括它。明白了-所以您没有启用采样,所以这不是问题。但您需要做服务器通道,因为您关心事件的可靠性。
var config = new TelemetryConfiguration(); // or active or create default...
var channel = new ServerTelemetryChannel();
channel.initialize(config)
// create client from the config.
TelemetryClient tc= new TelemetryClient(config);