-
Notifications
You must be signed in to change notification settings - Fork 983
remove plugins #2081
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
Merged
Merged
remove plugins #2081
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d2e4cd4
chore: replacing plugins with instrumentations
obecny 4a912c0
chore: removing grpc and http plugins
obecny 14bd90a
chore: removing old plugin loader
obecny 7ba6b8c
chore: removing meta packages
obecny d01175f
chore: removing base plugin
obecny 6397a3c
chore: removing plugins - updating readme
obecny 93013a3
chore: removing remaining plugins configurations, updating readme, re…
obecny 0119ae3
Merge branch 'main' into rc-plugins
obecny fe12bbc
chore: removing remaining plugins configurations, updating readme, re…
obecny 626bf4e
Merge branch 'rc-plugins' of github.com:obecny/opentelemetry-js into …
obecny 413a9ce
chore: linting
obecny a178b88
chore: addressing review comments
obecny ac77f5b
Merge branch 'main' into rc-plugins
vmarchaud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,11 @@ | ||
| # Instrumentation Developer Guide | ||
|
|
||
| We provide out-of-the-box instrumentations for many popular frameworks and libraries by using an instrumentation system (see [builtin instrumentations][builtin-instrumentations]), and provide a means for developers to create their own. | ||
| A detailed explained guide how to instrument a package is available at [instrumentation package][base-instrumentation] | ||
|
|
||
| We strongly recommended to create a dedicated package for newly added plugin, example: `@opentelemetry/plugin-xxx`. | ||
| For more comprehensive examples please refer to the [HTTP instrumentation][http-instrumentation] or [gRPC instrumentation][grpc-instrumentation] for node | ||
| and [XMLHttpRequest instrumentation][xhr-instrumentation] for web. | ||
|
|
||
| Each plugin must extend the abstract class [BasePlugin][base-plugin] implementing the below methods: | ||
|
|
||
| - `patch`: A function describing how the module exports for a given file should be modified. | ||
|
|
||
| - `unpatch`: A function describing how the module exports for a given file should be unpatched. This should generally mirror the logic in `patch`; for example, if `patch` wraps a method, `unpatch` should unwrap it. | ||
|
|
||
| The core `PluginLoader` class is responsible for loading the instrumented plugins that use a patch mechanism to enable automatic tracing for specific target modules. In order to load new plugin, it should export `plugin` identifier. | ||
|
|
||
| ```typescript | ||
| export const plugin = new HttpPlugin(...); | ||
| ``` | ||
|
|
||
| > Example of simple module plugin created and used in the tests. | ||
| <https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-node/test/instrumentation/node_modules/%40opentelemetry/plugin-simple-module/simple-module.js> | ||
| After the plugin is created, it must be added in the [list of default supported plugins][DEFAULT_INSTRUMENTATION_PLUGINS]. | ||
|
|
||
| ```typescript | ||
| export const DEFAULT_INSTRUMENTATION_PLUGINS: Plugins = { | ||
| http: { | ||
| enabled: true, | ||
| path: '@opentelemetry/plugin-http', | ||
| }, | ||
| grpc: { | ||
| enabled: true, | ||
| path: '@opentelemetry/plugin-grpc', | ||
| }, | ||
| // [ADD NEW PLUGIN HERE] | ||
| xxx: { | ||
| enabled: true, | ||
| // You may use a package name or absolute path to the file. | ||
| path: '@opentelemetry/plugin-xxx', | ||
| } | ||
| }; | ||
| ``` | ||
|
|
||
| We recommend using [`shimmer`][shimmer] to modify function properties on objects. | ||
|
|
||
| Please refer to the [HTTP instrumentation][http-plugin] or [gRPC instrumentation][grpc-plugin] for more comprehensive examples. | ||
|
|
||
| [shimmer]: https://github.com/othiym23/shimmer | ||
| [builtin-instrumentations]: https://github.com/open-telemetry/opentelemetry-js#instrumentations&plugins | ||
| [base-plugin]: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/src/platform/node/BasePlugin.ts | ||
| [http-plugin]: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-plugin-http/src/http.ts#L44 | ||
| [grpc-plugin]: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-plugin-grpc/src/grpc.ts#L52 | ||
| [DEFAULT_INSTRUMENTATION_PLUGINS]: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-node/src/config.ts#L29 | ||
| [base-instrumentation]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation | ||
| [http-instrumentation]: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-instrumentation-http/src/http.ts#L59 | ||
| [grpc-instrumentation]: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts#L28 | ||
| [xhr-instrumentation]: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts#L71 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.