microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
324 stars 141 forks source link

Event timestamps are at track time rather than at event start time #345

Open OsvaldoRosado opened 6 years ago

OsvaldoRosado commented 6 years ago

See: https://github.com/Microsoft/ApplicationInsights-node.js/blob/develop/Library/EnvelopeFactory.ts#L83

This makes the timeline view of dependencies for requests show dependencies occurring before the start time of the request.

OsvaldoRosado commented 6 years ago

Related to https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/658

asos-craigmorten commented 4 years ago

This would be awesome to get fixed - it makes tying the relationship between requests and dependencies near impossible as the times are simply not accurate! See below for an example where I have tracked express middleware as dependencies and the request apparently occurs after the middleware which are called as a result of the request! 😄

incorrect_request_time
jeromewir commented 2 years ago

For anyone still having this issue, I've found a way to use it properly if you are using trackRequest (might work for other methods but I haven't check)

You can pass the variable time (JS Date) in the trackRequest method which will be used at the start time of the request on app-insights.