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(scope-zone): new scope manager to support async operations in web #461

Merged
merged 21 commits into from
Nov 11, 2019

Conversation

obecny
Copy link
Member

@obecny obecny commented Oct 25, 2019

Which problem is this PR solving?

  1. Fixes Add new ZoneScopeManager for web #435

Short description of the changes

This PR adds new ZoneScopeManager for web that will support async operation - will keep the reference to scope (span) between asynchronous operations. This will allow to build more plugins for web. It is created into 2 packages. One is bundled together with zone.js and second allows to use your own zone.js if user already has it (for example when building angular apps)

Updated the corresponding readme too.

@obecny
Copy link
Member Author

obecny commented Oct 25, 2019

cc @draffensperger

@codecov-io
Copy link

codecov-io commented Oct 25, 2019

Codecov Report

Merging #461 into master will decrease coverage by 1.96%.
The diff coverage is 28.51%.

@@            Coverage Diff             @@
##           master     #461      +/-   ##
==========================================
- Coverage   94.39%   92.43%   -1.97%     
==========================================
  Files         120      143      +23     
  Lines        5749     6863    +1114     
  Branches      533      597      +64     
==========================================
+ Hits         5427     6344     +917     
- Misses        322      519     +197
Impacted Files Coverage Δ
...entelemetry-scope-zone-peer-dep/test/utils.test.ts 0% <0%> (ø)
packages/opentelemetry-web/test/WebTracer.test.ts 0% <0%> (ø) ⬆️
...-scope-zone-peer-dep/test/ZoneScopeManager.test.ts 0% <0%> (ø)
...ages/opentelemetry-scope-zone-peer-dep/src/util.ts 100% <100%> (ø)
...emetry-scope-zone-peer-dep/src/ZoneScopeManager.ts 87.95% <87.95%> (ø)
...kages/opentelemetry-metrics/test/mocks/Exporter.ts 66.66% <0%> (-33.34%) ⬇️
...es/opentelemetry-node/src/instrumentation/utils.ts 90.47% <0%> (-9.53%) ⬇️
...entelemetry-exporter-jaeger/test/transform.test.ts 100% <0%> (ø) ⬆️
.../opentelemetry-plugin-dns/test/utils/assertSpan.ts 100% <0%> (ø) ⬆️
...try-node/test/instrumentation/PluginLoader.test.ts 100% <0%> (ø) ⬆️
... and 28 more

Copy link
Contributor

@draffensperger draffensperger left a comment

Choose a reason for hiding this comment

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

This is really cool! I've given a first pass that caught mostly extra log entries, style changes, etc.

I'd like to understand and review the design and core code a bit more carefully though.

Could you provide a longer-form JSDoc comment at the start of the zone scope manager that explains its design at a high level, including what data it stores, how it attaches / unattaches to listeners and timeouts, etc.?

I'm also curious as to why the extra complexity with binding is needed vs. relying more heavily on Zones themselves (i.e. delegating the binding to the Zone binding functions)

examples/tracer-web/index.js Outdated Show resolved Hide resolved
packages/opentelemetry-scope-zone-peer-dep/src/types.ts Outdated Show resolved Hide resolved
packages/opentelemetry-scope-zone/README.md Outdated Show resolved Hide resolved
@obecny obecny changed the title feat(scope-zone): new scope manager to support async operations in web WIP: feat(scope-zone): new scope manager to support async operations in web Oct 28, 2019
@obecny obecny changed the title WIP: feat(scope-zone): new scope manager to support async operations in web feat(scope-zone): new scope manager to support async operations in web Oct 28, 2019
Copy link
Contributor

@draffensperger draffensperger left a comment

Choose a reason for hiding this comment

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

Awesome that this now supports parallel async operations. I think this is really coming together.

I made some nit-picky type comments, but also asked a question about the event listeners - I'd like to understand that part better and help us think through whether it's needed.

Copy link
Contributor

@draffensperger draffensperger left a comment

Choose a reason for hiding this comment

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

Nice work on this @obecny !! I think this is in a good place to merge in.

Copy link
Member

@mayurkale22 mayurkale22 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@mayurkale22 mayurkale22 merged commit 3d01be6 into open-telemetry:master Nov 11, 2019
@obecny obecny deleted the scope_zone_manager branch July 8, 2020 12:13
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
martinkuba pushed a commit to martinkuba/opentelemetry-js that referenced this pull request Mar 13, 2024
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.

Add new ZoneScopeManager for web
7 participants