ApplicationInsights-PHP icon indicating copy to clipboard operation
ApplicationInsights-PHP copied to clipboard

Start time doesn't support ms.

Open acollard opened this issue 5 years ago • 2 comments

This makes is pretty much useless when comparing telemetry events.

The ISO string returned from this utility is only accurate to the second. https://github.com/microsoft/ApplicationInsights-PHP/blob/95407ee7978a729f9bad5e2469ff07aadfe6bbd3/ApplicationInsights/Channel/Telemetry_Channel.php#L161

And all start times should use microtime(); https://github.com/microsoft/ApplicationInsights-PHP/blob/95407ee7978a729f9bad5e2469ff07aadfe6bbd3/ApplicationInsights/Channel/Telemetry_Channel.php#L158

Actual Behavior

Start times are truncated at seconds.

Expected Behavior

All times should be accurate to at least milliseconds.

Workaround

We've had to implement a workaround right before flushing. We store the start_time in microseconds, then rewrite the start time right before flushing.

acollard avatar Oct 30 '19 15:10 acollard

I will try to put together a PR with the fixes.

This will require some breaking changes as all start times will now need to be in milliseconds.

acollard avatar Oct 30 '19 15:10 acollard

This shouldn't break any code as passing in a time() will just ignore the milliseconds.

acollard avatar Oct 30 '19 17:10 acollard