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

feat: use events from PW for network data #372

Merged
merged 8 commits into from
Oct 7, 2021

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Sep 8, 2021

Missing data

  • We don't have a queuing time exposed from the PW API as Queueing time is pretty specific to chromium and not exposed for other browsers like FF and Webkit and its in the order of 1-2ms max when tested -
  • Bare uncompressed resource size is not exposed for each request instead we have header and body sizes for both request and responses.
  • http.version data is not exposed, but we can add that as a follow up once PW adds support for it and we are not using it on the waterfall UI.

@apmmachine
Copy link

apmmachine commented Sep 8, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-10-06T19:10:20.728+0000

  • Duration: 15 min 1 sec

  • Commit: 58f6e19

Test stats 🧪

Test Results
Failed 0
Passed 140
Skipped 0
Total 140

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

expect(netinfo[1].timings.total).toBeGreaterThan(delayTime);
});

describe('waterfall timing calculation', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good reason to remove this? It seems helpful if for no other reason than to ensure that the data we send to heartbeat/uptime is consistent. Is that checked elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do calculation in the Synthetics code anymore, It's as part of Playwright code.

},
http: {
version: formatVersion(response?.protocol),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove the version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the PR description already

http.version data is not exposed, but we can add that as a follow up once PW adds support for it and we are not using it on the waterfall UI.

src/reporters/json.ts Show resolved Hide resolved
expect(netinfo[0]).toMatchObject({
resourceSize: 10,
transferSize: expect.any(Number),
resourceSize: -1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for the change here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the PR description

Bare uncompressed resource size is not exposed for each request instead we have header and body sizes for both request and responses.

@shahzad31
Copy link
Contributor

Aren't we displaying queuing time in waterfal chart, if so, this seems like a breaking change.

Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Do you have any suggestions for testing the feature? Can I run it with heartbeat to check for compatibility with waterfall?

src/plugins/network.ts Show resolved Hide resolved
src/plugins/network.ts Outdated Show resolved Hide resolved
@vigneshshanmugam
Copy link
Member Author

Looks great. Do you have any suggestions for testing the feature? Can I run it with heartbeat to check for compatibility with waterfall?

Yeah we need to run it via HB to test this for compatibility

  1. Switch to this branch and install it globally npm i -g .
  2. Run only inline monitors via HB which will use this version.

@vigneshshanmugam
Copy link
Member Author

Aren't we displaying queuing time in waterfal chart, if so, this seems like a breaking change.

I wouldnt call it as breaking change, if its not sent to UI, it shouldn't show those timings.

Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are expecting requestStartTime and loadEndTime to be chrome's special baseline in seconds value. It appears to have now been changed to epoch millis in this PR. This will require a change on the Kibana side to be compatible with this version of synthetics, unless you are able to convert those two values back to the way chrome was providing it.

@vigneshshanmugam
Copy link
Member Author

We are expecting requestStartTime and loadEndTime to be chrome's special baseline in seconds value

I remember we were using this on the UI only for calculating the offset, Why does this have to be in a special format? I can surely workaround to not break the UI, but would like to know the reason so we can solve this in a better way to never break on the future iteration.

@dominiqueclarke
Copy link
Contributor

We are expecting requestStartTime and loadEndTime to be chrome's special baseline in seconds value

I remember we were using this on the UI only for calculating the offset, Why does this have to be in a special format? I can surely workaround to not break the UI, but would like to know the reason so we can solve this in a better way to never break on the future iteration.

We are using it for the offset, but before we use it we actually covert it to milliseconds. This allows accurately place the start of each request on the chart in milliseconds. So the code is expecting seconds to convert to milliseconds.

@vigneshshanmugam
Copy link
Member Author

@dominiqueclarke So if I can change the epochTime in Seconds then it should be good from the UI side? We dont need it to be in the chrome devtools monotonic time format?

@dominiqueclarke
Copy link
Contributor

monotonic time format?

Yes, I believe that should work just fine.

@vigneshshanmugam
Copy link
Member Author

/test

Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Timing changes look good with Kibana waterfall chart.

Screen Shot 2021-10-05 at 1 00 29 PM

Screen Shot 2021-10-05 at 1 00 17 PM

@dominiqueclarke
Copy link
Contributor

dominiqueclarke commented Oct 6, 2021

Timings and headers look good as well.
Screen Shot 2021-10-06 at 10 42 25 AM
Screen Shot 2021-10-06 at 10 46 35 AM

loadEndTime: -1,
responseReceivedTime: -1,
response: null,
resourceSize: 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are expecting the value to be falsey if it is not able to be extracted. The change to making it truthy breaks UI.

Screen Shot 2021-10-06 at 11 31 28 AM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting it to 0 would solve it? I had a thought since 0 is a actual size and could be for cached resource.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes changing it to 0 would solve it. To be fair, we are displaying 0 values right now as --, which may not be totally accurate, so perhaps we want to fix this on the UI side. The same is true for transfer size.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, will revert it to zero. May be we can add a fix on the UI side in parallel. Do you mind creating an issue?

@vigneshshanmugam
Copy link
Member Author

/test

@vigneshshanmugam
Copy link
Member Author

@dominiqueclarke Can we merge it now or do you still see issue with the Request/Response headers?

@dominiqueclarke
Copy link
Contributor

@dominiqueclarke Can we merge it now or do you still see issue with the Request/Response headers?

Yep, looks good to me.

Screen Shot 2021-10-07 at 3 21 14 PM

@vigneshshanmugam vigneshshanmugam merged commit 2231f3b into elastic:master Oct 7, 2021
@vigneshshanmugam vigneshshanmugam deleted the switch-to-pw branch October 7, 2021 20:47
v1v added a commit to dominiqueclarke/synthetics that referenced this pull request Nov 22, 2021
…a-fleet-heartbeat-synthetics-e2e-tests

* upstream/master:
  [jjbb] for scheduling e2e jobs (elastic#418)
  docs: release notes for beta.17 (elastic#415)
  1.0.0-beta.17
  feat: add --playwright-options (elastic#405)
  fix: ensure timestamps of events are inorder (elastic#413)
  fix: do not stash `.nvm` folder (elastic#414)
  deprecate suite-params option over params (elastic#406)
  fix: end timestamp should reflect duration (elastic#410)
  docs: release notes for 1.16.0 (elastic#403)
  1.0.0-beta.16
  fix: revert Playwright to 1.14.0 (elastic#402)
  docs: release notes for beta 15 (elastic#400)
  1.0.0-beta.15
  chore: update deps and fix lint issues (elastic#399)
  fix: handle page close during response event (elastic#398)
  chore: require node > 14 for usage (elastic#397)
  fix: fix megabytes to mbps (elastic#394)
  feat: enable trace as part of rich-events (elastic#387)
  feat: use events from PW for network data (elastic#372)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants