Skip to content

Commit e7cc441

Browse files
authored
chore(examples/web): modernize the docker compose & collector setup for this example (#2556)
1 parent 4aba201 commit e7cc441

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

examples/web/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

examples/web/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,26 @@ This example shows how to use [@opentelemetry/sdk-trace-web][] with different in
99
npm install
1010
```
1111

12+
## Start a collector and trace viewer
13+
14+
Optionally, you can use the provided Docker Compose file to start an OpenTelemetry Collector and a Zipkin to view collected traces.
15+
You can skip this step if you have your own collector already setup.
16+
17+
```sh
18+
npm run docker:start
19+
```
20+
1221
## Run the Application
1322

1423
```sh
1524
# from this directory
1625
npm start
1726
```
1827

19-
By default, the application will run on port `8090`.
28+
- Open the application at <http://localhost:8090>.
29+
- Click around in each of the example sub-paths to create some tracing data.
30+
- Open Zipkin at <http://127.0.0.1:9411/zipkin/> and search for some traces (click "Run Query").
31+
2032

2133
## More information
2234

examples/web/docker/collector-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ receivers:
33
protocols:
44
grpc:
55
http:
6-
cors_allowed_origins:
7-
- http://*
8-
- https://*
6+
cors:
7+
allowed_origins:
8+
- http://*
9+
- https://*
910

1011
exporters:
1112
zipkin:

examples/web/docker/docker-compose.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
version: "3"
21
services:
3-
# Collector
42
collector:
5-
image: otel/opentelemetry-collector:0.38.0
3+
image: otel/opentelemetry-collector:0.99.0
64
command: ["--config=/conf/collector-config.yaml"]
75
volumes:
86
- ./collector-config.yaml:/conf/collector-config.yaml
@@ -13,7 +11,6 @@ services:
1311
depends_on:
1412
- zipkin-all-in-one
1513

16-
# Zipkin
1714
zipkin-all-in-one:
1815
image: openzipkin/zipkin:latest
1916
ports:

examples/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"description": "Example of using web plugins in browser",
66
"main": "index.js",
77
"scripts": {
8-
"docker:start": "cd ./docker && docker-compose down && docker-compose up",
9-
"docker:startd": "cd ./docker && docker-compose down && docker-compose up -d",
8+
"docker:start": "cd ./docker && docker compose down && docker compose up",
9+
"docker:startd": "cd ./docker && docker compose down && docker compose up -d",
1010
"start": "webpack-dev-server --progress --color --port 8090 --config ./webpack.config.js --hot --host 0.0.0.0"
1111
},
1212
"repository": {

0 commit comments

Comments
 (0)