Azure Application Insight: Custom data not recorded when Timestamp or StartTime is set

允我心安 提交于 2019-12-12 02:38:16

问题


I found a strange issue while sending data using custom code. No data appeared in the browser until I figured out it had something to do with how I send it. If I manually set the StartTime or Timestamp of a Telemetry class the data never shows up.

In the code below, only the event with name "None" shows up. Widening the time range of the filter in the browser dashboard does not help.

Is it not possible to send historical data to application insights with a custom datetime stamp?

I need it because my telemtry data comes from a single server and is then persisted to multiple destinations like Application Insights, SQL server en blob storage for later processing.

var rt = new RequestTelemetry
{
    Name = "StartTime",
    Duration = TimeSpan.FromSeconds(8),
    StartTime = DateTime.Now.AddDays(-1)
};
telemetry.TrackRequest(rt);

rt = new RequestTelemetry
{
    Name = "Timestamp",
    Duration = TimeSpan.FromSeconds(8),
    Timestamp = DateTime.Now.AddDays(-1)
};
telemetry.TrackRequest(rt);

rt = new RequestTelemetry
{
    Name = "Both",
    Duration = TimeSpan.FromSeconds(8),
    Timestamp = DateTime.Now.AddDays(-1),
    StartTime = DateTime.Now.AddDays(-1)
};
telemetry.TrackRequest(rt);

rt = new RequestTelemetry
{
    Name = "None",
    Duration = TimeSpan.FromSeconds(8),
};
telemetry.TrackRequest(rt);

来源:https://stackoverflow.com/questions/34417543/azure-application-insight-custom-data-not-recorded-when-timestamp-or-starttime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!