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: remove examples from lerna packages #470

Merged

Conversation

dyladan
Copy link
Member

@dyladan dyladan commented Oct 31, 2019

Which problem is this PR solving?

Short description of the changes

Examples fail to run if they are installed with the regular boostrap process.
Removing them from packages allows the user to npm install them
regularly.

If someone knows a reason to keep examples/* in the lerna packages please let me know so we can find a different workaround

Examples fail to run if they are installed with the regular boostrap process.
Removing them from packages allows the user to `npm install` them
regularly.
@codecov-io
Copy link

codecov-io commented Oct 31, 2019

Codecov Report

Merging #470 into master will decrease coverage by 0.11%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #470      +/-   ##
==========================================
- Coverage   95.26%   95.14%   -0.12%     
==========================================
  Files         137      136       -1     
  Lines        6840     6715     -125     
  Branches      597      591       -6     
==========================================
- Hits         6516     6389     -127     
- Misses        324      326       +2
Impacted Files Coverage Δ
...-plugin-http/test/functionals/http-package.test.ts 95.45% <0%> (-4.55%) ⬇️
...entelemetry-exporter-jaeger/test/transform.test.ts 100% <0%> (ø) ⬆️
...ges/opentelemetry-exporter-zipkin/src/transform.ts 100% <0%> (ø) ⬆️
...telemetry-plugin-grpc/test/utils/assertionUtils.ts 100% <0%> (ø) ⬆️
.../opentelemetry-exporter-zipkin/test/zipkin.test.ts 100% <0%> (ø) ⬆️
.../opentelemetry-exporter-jaeger/test/jaeger.test.ts 100% <0%> (ø) ⬆️
packages/opentelemetry-web/src/WebTracer.ts 100% <0%> (ø) ⬆️
...entelemetry-exporter-zipkin/test/transform.test.ts 100% <0%> (ø) ⬆️
...opentelemetry-plugin-http/test/utils/assertSpan.ts 100% <0%> (ø) ⬆️
...ackages/opentelemetry-exporter-zipkin/src/utils.ts
... and 1 more

@mayurkale22
Copy link
Member

One advantage of keeping examples/* in the lerna packages is when you bump the version, it will update the latest version in examples/* as well. Otherwise, you need to do it manually.

@dyladan
Copy link
Member Author

dyladan commented Oct 31, 2019

We just need to find a way to exclude it from the lerna bootstrap process

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.

Actually, I am ok to remove examples/* from Lerna. Would like to hear more from others.

@markwolff
Copy link
Member

This would also solve this issue #384 (comment)

@dyladan
Copy link
Member Author

dyladan commented Oct 31, 2019

I think the additional burden of periodically updating dependencies in the examples is outweighed by the confusions new users will have when they can't load the examples using the instructions provided.

@dyladan
Copy link
Member Author

dyladan commented Oct 31, 2019

Here is my attempt to explain why this is broken and suggest an alternative fix.

In the examples/http/node_modules/@opentelemetry folder there is a symlink named node which points too ../../../../packages/opentelemetry-node. When the example loads the @opentelemetry/node package, it is loaded in the packages/ directory, not the examples/node_modules/ directory. When the @opentelemetry-node package tries to require the plugin, it looks in the following directories on my machine:

[ '/Users/daniel.dyla/playground/opentelemetry/js/packages/opentelemetry-node/build/src/instrumentation/node_modules',
  '/Users/daniel.dyla/playground/opentelemetry/js/packages/opentelemetry-node/build/src/node_modules',
  '/Users/daniel.dyla/playground/opentelemetry/js/packages/opentelemetry-node/build/node_modules',
  '/Users/daniel.dyla/playground/opentelemetry/js/packages/opentelemetry-node/node_modules',
  '/Users/daniel.dyla/playground/opentelemetry/js/packages/node_modules',
  '/Users/daniel.dyla/playground/opentelemetry/js/node_modules',
  '/Users/daniel.dyla/playground/opentelemetry/node_modules',
  '/Users/daniel.dyla/playground/node_modules',
  '/Users/daniel.dyla/node_modules',
  '/Users/node_modules',
  '/node_modules' ]

none of these directories are '/Users/Daniel.dyla/playground/opentelemetry/js/examples/http/node_modules' which is where it should be looking. The require tree has been entirely moved into the packages directory from the examples directory. In a customer's installation, or if the example's dependencies are installed not using symlinks like this PR suggests, @opentelemetry/node exists in the same node_modules as the http plugin.

One alternative fix would be to install all plugin packages as dev dependencies in the root of the project, which is a parent of both directories.

@OlivierAlbertini
Copy link
Member

I think the additional burden of periodically updating dependencies in the examples is outweighed by the confusions new users will have when they can't load the examples using the instructions provided.

Also once we will install greenkeeper tool (or other), it will check that for us

@OlivierAlbertini OlivierAlbertini added the enhancement New feature or request label Oct 31, 2019
@danielkhan
Copy link
Contributor

danielkhan commented Nov 1, 2019

We are using lerna to allow package inter-dependencies during development.
The same applies to the examples folder.
Say - you just added a new feature and want to provide an example for it.

I saw the problem with the plugin loader - so this seems just not to work with lerna - and this is a valid point but I'm not sure if we should ditch the benefits for that.

If we go down that route, we should at least document a reliable way to solve this during development.

@mayurkale22 mayurkale22 merged commit df58228 into open-telemetry:master Nov 5, 2019
@Flarna Flarna deleted the fix-examples branch December 13, 2019 20:58
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants