microsoft / microsoft/ApplicationInsights-JS

TrackPageView api does not support floating point duration

Open
#269 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
685
Forks
261
Avg merge
21h 33m
Merged PRs (30d)
5

Description

If track page view is called with a floating point time such as 6738.160000000033, the request is sent with data like: duration:"00:00:06.738.1600000000326" This leads to an exception being thrown and this telemetry point being dropped.

```

message: "108: Field 'duration' on type 'PageViewData' is not a valid duration string. Expected: TimeSpan DD.HH:MM:SS.MMMMMM format, Actual: 00:00:06.738.1600000000326"
statusCode: 400
```

Floating point times are possible by using higher accuracy timers such as performance.now() in javascript.
The api should either round / chop or correctly format the data so that the telemetry is not lost.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TrackPageView API and reproduce the request using a floating-point duration such as 6738.160000000033, including a value from JavaScript's performance.now(). Trace how the duration becomes the PageViewData duration string; done means the request uses a valid duration format and the telemetry point is no longer rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.