-
Notifications
You must be signed in to change notification settings - Fork 25
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
Capture visibility events #219
Conversation
this.unloading = false; | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function |
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.
Can this be configured in eslint? Especially, if all instances of InstrumentationBase
require init()
to be present.
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.
Switched off globally
import { VERSION } from './version'; | ||
|
||
const MODULE_NAME = 'splunk-visibility'; | ||
let visibilityListener: any; |
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.
Can these listeners be fields of the instrumentation?
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.
✅
}); | ||
browser.globals.emulateTabSwitching = async (visible) => { | ||
await browser.execute((hidden) => { | ||
Object.defineProperty(document, 'hidden', { value: hidden, configurable: true }); |
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.
Looking at this, I'd suggest we make it a unit test. This isn't how an integration test should work.
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.
Will look into making it a real integration test with a real tab switch at some point
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.
No major issues, I'd prefer that the tests for visibility are unit tests because of how they work.
Captured as 0 duration spans as these can't be complete spans(due to us not being able to close some of them in some case) and we don't have events. Disabled for now cause we need to make sure that sending them is fine. At some point we probably need to add this info to each span so data can be filtered in UI.
Code in index.ts is moved cause otherwise some things fire at wrong times.