Skip to content

Commit

Permalink
fix(examples): fix React Load plugin example (open-telemetry#800)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
  • Loading branch information
3 people authored Dec 30, 2021
1 parent 2c4a834 commit fff013c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/react-load/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ npm run build
npm start
```

By default, the application runs on port 5000.
By default, the application runs on port 3000.

Open Zipkin page at <http://localhost:9411/zipkin/> - you should be able to see the spans in zipkin

Expand All @@ -39,7 +39,7 @@ Take note of the parent-child relationships.

### First load

Upon loading, <http://localhost:5000> mounting spans will be exported
Upon loading, <http://localhost:3000> mounting spans will be exported
<p align="center"><img src="./images/mounting.png?raw=true"/></p>
<p align="center"><img src="./images/zipkin-mounting.png?raw=true"/></p>

Expand Down
10 changes: 6 additions & 4 deletions examples/react-load/react/docker/collector-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
receivers:
otlp:
endpoint: 0.0.0.0:55678
protocols:
http:
endpoint: 0.0.0.0:55678
cors_allowed_origins: http://localhost:3000

exporters:
zipkin:
url: "http://zipkin-all-in-one:9411/api/v2/spans"
endpoint: "http://zipkin-all-in-one:9411/api/v2/spans"

processors:
batch:
queued_retry:

service:
pipelines:
traces:
receivers: [otlp]
exporters: [zipkin]
processors: [batch, queued_retry]
processors: [batch]
4 changes: 2 additions & 2 deletions examples/react-load/react/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ services:

# Collector
collector:
image: omnition/opentelemetry-collector-contrib:0.2.8
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
image: otel/opentelemetry-collector-contrib:0.40.0
command: ["--config=/conf/collector-config.yaml"]
volumes:
- ./collector-config.yaml:/conf/collector-config.yaml
ports:
Expand Down
4 changes: 3 additions & 1 deletion examples/react-load/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"ts-loader": "^6.0.4"
},
"dependencies": {
"@opentelemetry/api": "^1.0.4",
"@opentelemetry/context-zone": "^0.25.0",
"@opentelemetry/core": "^0.25.0",
"@opentelemetry/exporter-collector": "^0.25.0",
Expand All @@ -46,7 +47,8 @@
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.1",
"reactstrap": "^8.5.1"
"reactstrap": "^8.5.1",
"serve": "^13.0.2"
},
"browserslist": {
"production": [
Expand Down
8 changes: 7 additions & 1 deletion examples/react-load/react/src/web-tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import { BaseOpenTelemetryComponent } from '@opentelemetry/plugin-react-load';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';
import { diag, DiagConsoleLogger } from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'

export default (serviceName) => {
const provider = new WebTracerProvider();
const provider = new WebTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: "react-load-example"
}),
});

const exporter = new CollectorTraceExporter({
url: 'http://localhost:55678/v1/trace',
Expand Down

0 comments on commit fff013c

Please sign in to comment.