问题
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