Skip to content

Commit

Permalink
Merge branch 'main' into renovate/gh-pages-4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Aug 9, 2022
2 parents 338f7ca + 7b3eab6 commit 80354d6
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ All notable changes to this project will be documented in this file.

### :books: (Refine Doc)

* chore: update https example [#3152](https://github.com/open-telemetry/opentelemetry-js/pull/3152) @pichlermarc

### :house: (Internal)

## 1.5.0
Expand Down
20 changes: 16 additions & 4 deletions examples/https/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Overview

OpenTelemetry HTTPS Instrumentation allows the user to automatically collect trace data and export them to the backend of choice (we can use Zipkin or Jaeger for this example), to give observability to distributed systems.
OpenTelemetry HTTPS Instrumentation allows the user to automatically collect trace data and export them to the backend
of choice. This example exports directly to Zipkin or Jaeger.

This is a simple example that demonstrates tracing HTTPS request from client to server. The example
shows key aspects of tracing such as
Expand All @@ -22,6 +23,14 @@ npm install
Setup [Zipkin Tracing](https://zipkin.io/pages/quickstart.html)
or
Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/latest/getting-started/#all-in-one)
or

```sh
# from this directory, requires docker and docker-compose
npm run docker:start
# Zipkin UI will be available at http://localhost:9411/zipkin/
# Jaeger UI will be available at http://localhost:16686/
```

## Run the Application

Expand All @@ -44,7 +53,8 @@ Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/latest/getting-started/
#### Zipkin UI

`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)>
Go to Zipkin with your browser <http://localhost:9411/zipkin/traces/(your-trace-id)> (
e.g <http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)>

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

Expand All @@ -67,14 +77,16 @@ Go to Zipkin with your browser <http://localhost:9411/zipkin/traces/(your-trace-
#### Jaeger UI

`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)>
Go to Jaeger with your browser <http://localhost:16686/trace/(your-trace-id)> (
e.g <http://localhost:16686/trace/4815c3d576d930189725f1f1d1bdfcc6)>

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

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more information on OpenTelemetry for Node.js, visit: <https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node>
- For more information on OpenTelemetry for Node.js,
visit: <https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node>

## LICENSE

Expand Down
2 changes: 1 addition & 1 deletion examples/https/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function makeRequest() {
api.context.with(api.trace.setSpan(api.context.active(), span), () => {
https.get({
host: 'localhost',
port: 443,
port: 8443,
path: '/helloworld',
}, (response) => {
const body = [];
Expand Down
14 changes: 14 additions & 0 deletions examples/https/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.8"
services:
# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:1.37.0
ports:
- "16686:16686" # frontend
- "14268:14268" # jaeger.thrift via HTTP
- "6832:6832/udp" # jaeger.thrift via UDP (binary)
# Zipkin
zipkin-all-in-one:
image: openzipkin/zipkin:latest
ports:
- "9411:9411"
25 changes: 14 additions & 11 deletions examples/https/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"name": "https-example",
"private": true,
"version": "0.25.0",
"version": "0.31.0",
"description": "Example of HTTPs integration with OpenTelemetry",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"scripts": {
"zipkin:server": "cross-env EXPORTER=zipkin node ./server.js",
"zipkin:client": "cross-env EXPORTER=zipkin node ./client.js",
"jaeger:server": "cross-env EXPORTER=jaeger node ./server.js",
"jaeger:client": "cross-env EXPORTER=jaeger node ./client.js"
"jaeger:client": "cross-env EXPORTER=jaeger node ./client.js",
"docker:start": "cd ./docker && docker-compose down && docker-compose up",
"docker:startd": "cd ./docker && docker-compose down && docker-compose up -d",
"docker:stop": "cd ./docker && docker-compose down"
},
"repository": {
"type": "git",
Expand All @@ -29,15 +32,15 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/exporter-jaeger": "0.25.0",
"@opentelemetry/exporter-zipkin": "0.25.0",
"@opentelemetry/instrumentation": "0.25.0",
"@opentelemetry/instrumentation-http": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/semantic-conventions": "0.25.0",
"@opentelemetry/sdk-trace-node": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0"
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/exporter-jaeger": "1.5.0",
"@opentelemetry/exporter-zipkin": "1.5.0",
"@opentelemetry/instrumentation": "0.31.0",
"@opentelemetry/instrumentation-http": "0.31.0",
"@opentelemetry/resources": "1.5.0",
"@opentelemetry/semantic-conventions": "1.5.0",
"@opentelemetry/sdk-trace-node": "1.5.0",
"@opentelemetry/sdk-trace-base": "1.5.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/https",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/https/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ function handleRequest(request, response) {
});
}

startServer(443);
startServer(8443);
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"experimental/backwards-compatability/*",
"integration-tests/*",
"selenium-tests",
"examples/otlp-exporter-node"
"examples/otlp-exporter-node",
"examples/https"
]
}

0 comments on commit 80354d6

Please sign in to comment.