-
Notifications
You must be signed in to change notification settings - Fork 137
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
feat(rum-core): add network info for all transactions #752
base: main
Are you sure you want to change the base?
Conversation
function getNetworkInformation() { | ||
const connection = navigator && navigator.connection | ||
|
||
if (!(connection && typeof connection === 'object')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to not negate the condition and just wrap the following return inside if.
@@ -211,7 +214,12 @@ describe('Context', () => { | |||
}, | |||
...userContext | |||
}) | |||
|
|||
expect(pageloadTr.context.page.netinfo).toEqualOrUndefined({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, using toEqualOrUndefined
is not a good idea, instead we should detect if the feature that is required for this to work exist and we should add explicit checks for the outcomes. With this matcher we don't know whether the result was undefined because of a bug or because the api is not supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i get it right, do you want to test it only for supported browsers? Like we do explicit check like
if (connection) {
expect(measuredInfo).toBe(actualInfo)?
}
I was trying to express this using the matcher, May be i missed something. We can also do explicit checks in tests if its confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct! also check the else condition, i.e:
if (connection) {
expect(measuredInfo).toBe(actualInfo)
} else {
expect(measuredInfo).toBe(undefined)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sounds good 👍
💔 Build FailedExpand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
On hold till the spec is finalised on the APM Server- More details elastic/apm-server#3918 (comment) |
page-load
,route-change
and other auto instrumented transactions would include this information by default under transaction page metadata.Server schema spec - elastic/apm-server#3657