Skip to content

Commit

Permalink
express example updates to get it working
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm committed Feb 21, 2024
1 parent 0cc9047 commit 35ba546
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 341 deletions.
1 change: 1 addition & 0 deletions examples/express/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
54 changes: 21 additions & 33 deletions examples/express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ shows key aspects of tracing such as
## Installation

```sh
# from this directory, install all necessary dependencies from the workspace
npm run setup

# OR alternatively, install dependencies from npm as a standalone example app
npm install --workspaces=false
npm install
```

Setup [Zipkin Tracing](https://zipkin.io/pages/quickstart.html)
Expand All @@ -28,47 +24,39 @@ Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/latest/getting-started/

### Zipkin

- Run the server

```sh
# from this directory
$ npm run zipkin:server
```
Run the server:

- Run the client
```sh
npm run zipkin:server
```

```sh
# from this directory
npm run zipkin:client
```
Then run the client in a separate terminal:

#### Zipkin UI
```sh
npm run zipkin:client
```

`zipkin:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`).
Go to Zipkin with your browser <http://localhost:9411/zipkin/traces/(your-trace-id)> (e.g <http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6>)
After a short time, the generated traces should be available in the Zipkin UI.
Visit <http://localhost:9411/zipkin> and click the "RUN QUERY" button to view
recent traces, then click "SHOW" on a given trace.

<p align="center"><img src="./images/zipkin.jpg?raw=true"/></p>

### Jaeger

- Run the server
Run the server:

```sh
# from this directory
$ npm run jaeger:server
```

- Run the client
```sh
npm run jaeger:server
```

```sh
# from this directory
npm run jaeger:client
```
Then run the client in a separate terminal:

#### Jaeger UI
```sh
npm run jaeger:client
```

`jaeger:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`).
Go to Jaeger with your browser <http://localhost:16686/trace/(your-trace-id)> (e.g <http://localhost:16686/trace/4815c3d576d930189725f1f1d1bdfcc6>)
Visit the Jaeger UI at <http://localhost:16686/search>, select a service (e.g. "example-express-client"), click "Find Traces", then click on a trace to view it.

<p align="center"><img src="images/jaeger.jpg?raw=true"/></p>

Expand Down
3 changes: 1 addition & 2 deletions examples/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"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 .",
"setup": "cd ../../../../ && npm ci && cd plugins/node/opentelemetry-instrumentation-express && npm run compile && cd examples && npm run compile"
"compile": "tsc -p ."
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion examples/express/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.json",
"extends": "../../tsconfig.base",
"compilerOptions": {
"noEmit": true,
"rootDir": ".",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
build
examples
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ registerInstrumentations({
});
```

See [examples](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express/examples) for a short example.
See [examples/express](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/express) for a short example.

### Caveats

Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 35ba546

Please sign in to comment.