-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: moves express examples into its package to establish pattern (#…
…939) * chore: moves express examples into its package to establish pattern * revert: unintentional path change * fix: uses more correct value * chore: bumps dependency versions * Adds instructions for migrating examples * Update plugins/node/opentelemetry-instrumentation-express/examples/package.json Co-authored-by: Gerhard Stöbich <[email protected]> * Update plugins/node/opentelemetry-instrumentation-express/examples/package.json Co-authored-by: Gerhard Stöbich <[email protected]> * ignores examples from lint * removes extra line * bumps otel dependency versions * cleanup * updates to use package name instead of relative path * updates CI approach to use lerna run command * bumps dependency versions Co-authored-by: Gerhard Stöbich <[email protected]> Co-authored-by: Rauno Viskus <[email protected]>
- Loading branch information
1 parent
c5b9356
commit 8786cbe
Showing
15 changed files
with
144 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Instrumentation Examples | ||
|
||
:warning: Note: We are working on migrating these examples to their respective package directories. | ||
|
||
For instance, examples of using `express` instrumentation have moved from this directory to [plugins/node/opentelemetry-instrumentation-express](https://github.com/open-telemetry/opentelemetry-js/tree/main/plugins/node/opentelemetry-instrumentation-express). | ||
|
||
## Instructions for Migrating an Example | ||
|
||
* [ ] Move the files | ||
* [ ] Choose an instrumentation package to migrate examples for. | ||
* [ ] Move the examples from `./examples/[name]` to `./plugins/[node or web]]/opentelemetry-instrumentation-[name]/examples`. | ||
* [ ] Update the `package.json` in the examples folder | ||
* [ ] Remove the `@opentelemetry/instrumentation-[name]` dependency. | ||
* [ ] Install `typescript` and `ts-node` in the examples directory. | ||
* [ ] Replace usage of `node` in scripts with `ts-node`. | ||
* [ ] Add a script for compiling the code in scripts: `"compile": "tsc -p ."` | ||
* [ ] Add a tsconfig.json file in the examples folder. (Example below) | ||
* [ ] Update the code | ||
* [ ] Change code to use a relative import of the library. | ||
* [ ] Add types to the code | ||
* [ ] Update the instrumentation package's `package.json` | ||
* [ ] Add a script `"compile:examples": "cd examples && npm run compile",`. | ||
* [ ] Test the updated code | ||
* [ ] Test building the examples by running `npm run compile:examples` | ||
* [ ] Test that the actual exapmle code runs as expected | ||
|
||
Example tsconfig.json file: | ||
|
||
```json | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"rootDir": ".", | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
] | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains 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 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
1 change: 1 addition & 0 deletions
1
plugins/node/opentelemetry-instrumentation-express/.eslintignore
This file contains 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 +1,2 @@ | ||
build | ||
examples |
File renamed without changes.
File renamed without changes
File renamed without changes
52 changes: 52 additions & 0 deletions
52
plugins/node/opentelemetry-instrumentation-express/examples/package.json
This file contains 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "express-example", | ||
"private": true, | ||
"version": "0.28.0", | ||
"description": "Example of Express integration with OpenTelemetry", | ||
"main": "index.js", | ||
"scripts": { | ||
"zipkin:server": "cross-env EXPORTER=zipkin ts-node src/server.ts", | ||
"zipkin:client": "cross-env EXPORTER=zipkin ts-node src/client.ts", | ||
"jaeger:server": "cross-env EXPORTER=jaeger ts-node src/server.ts", | ||
"jaeger:client": "cross-env EXPORTER=jaeger ts-node src/client.ts", | ||
"compile": "tsc -p ." | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/open-telemetry/opentelemetry-js.git" | ||
}, | ||
"keywords": [ | ||
"opentelemetry", | ||
"express", | ||
"tracing" | ||
], | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"author": "OpenTelemetry Authors", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/open-telemetry/opentelemetry-js/issues" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "^1.0.4", | ||
"@opentelemetry/exporter-jaeger": "^1.1.1", | ||
"@opentelemetry/exporter-zipkin": "^1.1.1", | ||
"@opentelemetry/instrumentation": "^0.27.0", | ||
"@opentelemetry/instrumentation-express": "^0.28.0", | ||
"@opentelemetry/instrumentation-http": "^0.27.0", | ||
"@opentelemetry/resources": "^1.1.1", | ||
"@opentelemetry/sdk-trace-base": "^1.1.1", | ||
"@opentelemetry/sdk-trace-node": "^1.1.1", | ||
"@opentelemetry/semantic-conventions": "^1.1.1", | ||
"axios": "^0.21.1", | ||
"cross-env": "^7.0.3", | ||
"express": "^4.17.1" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", | ||
"devDependencies": { | ||
"@types/express": "^4.17.13", | ||
"ts-node": "^10.6.0", | ||
"typescript": "^4.6.2" | ||
} | ||
} |
This file contains 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 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 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
10 changes: 10 additions & 0 deletions
10
plugins/node/opentelemetry-instrumentation-express/examples/tsconfig.json
This file contains 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"rootDir": ".", | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
] | ||
} |
This file contains 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