-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Delay Single User Journey Finish #129991
Delay Single User Journey Finish #129991
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -19,6 +19,8 @@ apm.start({ | |||||||||||||||||||||||||||||||||||||||||||||||
secretToken: 'CTs9y3cvcfq13bQqsB', | ||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
export interface StepCtx { | ||||||||||||||||||||||||||||||||||||||||||||||||
page: Page; | ||||||||||||||||||||||||||||||||||||||||||||||||
kibanaUrl: string; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -166,6 +168,7 @@ export class PerformanceTestingService extends FtrService { | |||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
private async tearDown(page: Page, client: CDPSession, context: BrowserContext) { | ||||||||||||||||||||||||||||||||||||||||||||||||
if (page) { | ||||||||||||||||||||||||||||||||||||||||||||||||
await sleep(5000); | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are not using rum agent here and we don't have flushInterval on node agent. Ref: https://www.elastic.co/guide/en/apm/agent/nodejs/current/agent-api.html#apm-flush. But I will add relevant comment to explain why do we use flush There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don’t use the RUM agent in this file, but we can configure kibana/x-pack/test/performance/config.playwright.ts Lines 43 to 65 in 34d5ef8
and then use the same / a bit longer delay in the tearDown step.Did I miss anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyway, I liked Vighesh' proposal from better There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It might happen in theory. We can extend this logic to count the number of outcoming and responded requests. this.rumRequestsInFlight = []
await page.route('**', async (route, request) => {
if(isRumReportingRequest(route)) {
rumRequestsInFlight.push(request.response);
});
function tearDown() {
// wait for the one more reporting call
await page.waitForResponse((response) => response.url().includes('/rum/events'));
// make sure all the requests were finished
await Promise.all(rumRequestsInFlight); @vigneshshanmugam is there API to disable metrics collection by the RUM agent and enforce it to report already collected events?
@suchcodemuchwow how would you suggest this problem be solved? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The better way to fix this would be
page.evaluate(() => {
const apmServer = window.elasticApm.serviceFactory.getService('ApmServer')
apmServer.queue.flush()
}); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Opened #130765 |
||||||||||||||||||||||||||||||||||||||||||||||||
apm.flush(); | ||||||||||||||||||||||||||||||||||||||||||||||||
await client.detach(); | ||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
171
to
172
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vigneshshanmugam suggested to add |
||||||||||||||||||||||||||||||||||||||||||||||||
await page.close(); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
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.
nit: I think we can simply use
await page.waitForTimeout(5000);
?