Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid timings sent by instrumentations (xhr,fetch,resource) #4478

Closed
Abinet18 opened this issue Feb 13, 2024 · 2 comments · Fixed by #4486
Closed

Invalid timings sent by instrumentations (xhr,fetch,resource) #4478

Abinet18 opened this issue Feb 13, 2024 · 2 comments · Fixed by #4486

Comments

@Abinet18
Copy link
Contributor

Abinet18 commented Feb 13, 2024

When browser navigation or resource timing apis don't set a certain timing value or report it as 0 (e.g connectionStart, responseStart,...) the spans generated by instrumentations like like xhr/fetch/resource report a value that is lower than fetchStart ( timeOrigin ) , which can result in wrong metrics by backend. Can we avoid reporting this invalid timings by either checking if their value is above 0, or above a certain reference time like fetchStart

Here is a sample payload from xhr with such issues, It is a failed xhr request and the values from domainLookupStart up to responseEnd show a lower value than fetchStart. Similar issue can happen to cached requests, or aborted requests too.

events: [
{
"attributes": [],
"name": "open",
"timeUnixNano": "1707848692048000000",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "send",
"timeUnixNano": "1707848692048200000",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "fetchStart",
"timeUnixNano": "1707848692048699951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "domainLookupStart",
"timeUnixNano": "1707848675667199951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "domainLookupEnd",
"timeUnixNano": "1707848675667199951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "connectStart",
"timeUnixNano": "1707848675667199951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "connectEnd",
"timeUnixNano": "1707848675667199951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "requestStart",
"timeUnixNano": "1707848675667199951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "responseStart",
"timeUnixNano": "1707848675667199951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "responseEnd",
"timeUnixNano": "1707848692057099951",
"droppedAttributesCount": 0
},
{
"attributes": [],
"name": "error",
"timeUnixNano": "1707848692058000000",
"droppedAttributesCount": 0
}
]

Here is how the events are added to spans,

export function addSpanNetworkEvent(

@Abinet18
Copy link
Contributor Author

@martinkuba , @MSNev , @scheler , @t2t2 , can you take a loot at this issue ?

@dyladan
Copy link
Member

dyladan commented Feb 14, 2024

I think we can add logic to check that these values are sane, but some of them have 0 as a valid value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants