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

test(instr-document-load): fix test to allow missing network span events #2145

Conversation

trentm
Copy link
Contributor

@trentm trentm commented Apr 24, 2024

The change in open-telemetry/opentelemetry-js#4486
means that a addSpanNetworkEvent() in v1.24.0 and
later might get dropped -- if its time value is before the fetchStart time.
Typically this happens if the event time value is 0.

The change in open-telemetry/opentelemetry-js#4486
means that a addSpanNetworkEvent() in  v1.24.0 and
later might get dropped -- if its time value is before the fetchStart time.
Typically this happens if the event time value is 0.
@trentm
Copy link
Contributor Author

trentm commented Apr 24, 2024

This should fix the browser-test failure on #2091

@trentm
Copy link
Contributor Author

trentm commented Apr 24, 2024

This was written to have the test pass with sdk-trace-web versions before and after 1.24.0 where the change in behaviour happened, because instr-documentation-load has this dep: "@opentelemetry/sdk-trace-web": "^1.15.0",.

to test it

npm ci --ignore-scripts
cd plugins/web/opentelemetry-instrumentation-document-load
npm run compile
npm run test:browser

Then test with the newer sdk-trace-web:

npm install --no-save @opentelemetry/[email protected]
npm run test:browser

Copy link

codecov bot commented Apr 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.35%. Comparing base (dfb2dff) to head (c7e9980).
Report is 68 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2145      +/-   ##
==========================================
- Coverage   90.97%   90.35%   -0.63%     
==========================================
  Files         146      147       +1     
  Lines        7492     7679     +187     
  Branches     1502     1575      +73     
==========================================
+ Hits         6816     6938     +122     
- Misses        676      741      +65     

see 10 files with indirect coverage changes

Copy link
Member

@JamieDanielson JamieDanielson left a comment

Choose a reason for hiding this comment

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

Thanks for picking this up so quickly! This looks like a better solution than what I was thinking, which was just to set the unloadEventStart and unloadEventEnd to 1571078170306 (one tick higher than fetchStart)

@trentm trentm enabled auto-merge (squash) April 25, 2024 05:03
@trentm trentm merged commit 46b6775 into open-telemetry:main Apr 25, 2024
1 check passed
@trentm trentm deleted the tm-document-load-allow-missing-network-span-events branch April 25, 2024 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants