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

chore: fixing problem with load event and performance for loadend #469

Merged
merged 6 commits into from Nov 2, 2019

Conversation

@obecny
Copy link
Member

obecny commented Oct 30, 2019

Which problem is this PR solving?

It appeared that load event might not yet have the performance metrics for loadEnd The support for loadEnd event is very limited and cannot be used instead. The solution is to use timeout when document loads so that this one missing performance metric is in place.

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Oct 30, 2019

Codecov Report

Merging #469 into master will increase coverage by 0.17%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #469      +/-   ##
==========================================
+ Coverage   95.19%   95.37%   +0.17%     
==========================================
  Files         137      137              
  Lines        6833     7003     +170     
  Branches      594      598       +4     
==========================================
+ Hits         6505     6679     +174     
+ Misses        328      324       -4
Impacted Files Coverage Δ
...telemetry-plugin-document-load/src/documentLoad.ts 97.75% <100%> (+0.07%) ⬆️
...entelemetry-plugin-postgres/test/assertionUtils.ts 96.55% <0%> (-3.45%) ⬇️
...opentelemetry-base/test/resources/resource.test.ts 100% <0%> (ø) ⬆️
...entelemetry-exporter-jaeger/test/transform.test.ts 100% <0%> (ø) ⬆️
...ges/opentelemetry-exporter-zipkin/src/transform.ts 100% <0%> (ø) ⬆️
.../opentelemetry-exporter-zipkin/test/zipkin.test.ts 100% <0%> (ø) ⬆️
.../opentelemetry-exporter-jaeger/test/jaeger.test.ts 100% <0%> (ø) ⬆️
...telemetry-scope-base/test/NoopScopeManager.test.ts 100% <0%> (ø) ⬆️
packages/opentelemetry-web/src/WebTracer.ts 100% <0%> (ø) ⬆️
...entelemetry-exporter-zipkin/test/transform.test.ts 100% <0%> (ø) ⬆️
... and 3 more
// Support for event "loadend" is very limited and cannot be used
window.setTimeout(() => {
this._collectPerformance();
});

This comment has been minimized.

Copy link
@draffensperger

draffensperger Nov 1, 2019

Contributor

Would it make sense to have a little delay here, e.g. 1 second or so?

This comment has been minimized.

Copy link
@obecny

obecny Nov 1, 2019

Author Member

if I understand correctly it should work like this. When load event is being called then the performance is collecting the remaining metrics included "loadEnd", I assume this is synchronous so whenever this is finished the browser will start executing all the timeouts that were set together with the same load event. Then it really doesn't make sense to wait longer as the loadEnd metric should be there. If this is not the case then it will be hard to really say how long you should wait, 100ms, 1s, maybe 2s, but it seems like the moment the setTimeout calls the callback this metric is already there.

This comment has been minimized.

Copy link
@obecny

obecny Nov 1, 2019

Author Member

In the end this is not final, we can always put there 1s at any moment if for any reason it appeared that some browsers don't have it yet.

@mayurkale22 mayurkale22 added this to the Alpha v0.2 milestone Nov 1, 2019
@mayurkale22 mayurkale22 merged commit d5141f7 into open-telemetry:master Nov 2, 2019
8 checks passed
8 checks passed
ci/circleci: docs Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: node10 Your tests passed on CircleCI!
Details
ci/circleci: node11 Your tests passed on CircleCI!
Details
ci/circleci: node12 Your tests passed on CircleCI!
Details
ci/circleci: node12-browsers Your tests passed on CircleCI!
Details
ci/circleci: node8 Your tests passed on CircleCI!
Details
cla/linuxfoundation obecny authorized
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.