-
Notifications
You must be signed in to change notification settings - Fork 142
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
🐛 [RUMF-1077] use cookies to get Synthetics context #1161
🐛 [RUMF-1077] use cookies to get Synthetics context #1161
Conversation
Cookies + global variable should be enough/more reliable than the user agent which can be edited by the customer.
By using both global variable and cookies, the Synthetics context retrieval should be more reliable. We shouldn't need to check it every time we assemble an event. It should allow us to get it once at init, and keep the value locally so we don't need caching mechanism to access cookies and ensure good performances.
…-get-synthetics-context
const resultId = (window as BrowserWindow)._DATADOG_SYNTHETICS_RESULT_ID | ||
const testId = (window as BrowserWindow)._DATADOG_SYNTHETICS_PUBLIC_ID || getCookie(SYNTHETICS_TEST_ID_COOKIE_NAME) | ||
const resultId = | ||
(window as BrowserWindow)._DATADOG_SYNTHETICS_RESULT_ID || getCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME) | ||
|
||
if (typeof testId === 'string' && typeof resultId === 'string') { |
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 (typeof testId === 'string' && typeof resultId === 'string') {
Out of curiosity, what is this test for?
Is there any previous issue related to it?
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.
Mmh this test is a bit too preventive, indeed. I don't recall any issue where values where truthy without being a string. But I guess it's fine nonetheless?
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.
yes
Motivation
More reliable way to get Synthetics context on Selenium-based browsers (Firefox, IE)
Changes
Testing
I have gone over the contributing documentation.