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(sdk-trace-base): pin core.hrtime dependencies on timeOrigin #2768

Merged
merged 4 commits into from
Mar 1, 2022

Conversation

legendecas
Copy link
Member

Which problem is this PR solving?

Fixes #2764

Short description of the changes

  • timeInputToHrTime in Span constructor calls hrTime, which depends on performance.timeOrigin. performance.timeOrigin is DOMHighResTimeStamp, a double-precision floating-point number.
  • hrTimeToMilliseconds rounds the hrTime to milliseconds, which could round up or down.
  • hrTime returns the performanceNow (in the case, 0) + performance.timeOrigin, hence the result may have a fractional portion and may be round up or down (to 123 or 124).

After the change, the test can pass 10 out of 10 (compared to main branch 8/10) locally.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #2768 (29f5812) into main (def9ba3) will decrease coverage by 0.82%.
The diff coverage is n/a.

❗ Current head 29f5812 differs from pull request most recent head 531f52f. Consider uploading reports for the commit 531f52f to get more accurate results

@@            Coverage Diff             @@
##             main    #2768      +/-   ##
==========================================
- Coverage   93.41%   92.58%   -0.83%     
==========================================
  Files         159      153       -6     
  Lines        5450     5164     -286     
  Branches     1145     1076      -69     
==========================================
- Hits         5091     4781     -310     
- Misses        359      383      +24     
Impacted Files Coverage Δ
packages/opentelemetry-sdk-trace-web/src/utils.ts 65.62% <0.00%> (-29.38%) ⬇️
...lemetry-resources/src/detectors/ProcessDetector.ts 95.23% <0.00%> (-4.77%) ⬇️
packages/opentelemetry-sdk-trace-base/src/Span.ts 99.18% <0.00%> (-0.82%) ⬇️
...ry-context-zone-peer-dep/src/ZoneContextManager.ts
packages/exporter-trace-otlp-http/src/transform.ts
...s/exporter-trace-otlp-http/src/OTLPExporterBase.ts
packages/exporter-trace-otlp-http/src/util.ts
packages/exporter-trace-otlp-http/src/types.ts
...es/opentelemetry-context-zone-peer-dep/src/util.ts

@legendecas legendecas marked this pull request as ready for review February 7, 2022 06:34
@legendecas legendecas requested a review from a team February 7, 2022 06:34
@legendecas legendecas requested a review from a team February 15, 2022 02:40
@vmarchaud vmarchaud merged commit 9579106 into open-telemetry:main Mar 1, 2022
@legendecas legendecas deleted the karma-sourcemap branch March 1, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky test: @opentelemetry/sdk-trace-base should have an entered time for event
3 participants