Skip to content

Commit 8dc86ff

Browse files
committed
Configure tracing stack
1 parent 20823a2 commit 8dc86ff

File tree

2 files changed

+66
-14
lines changed

2 files changed

+66
-14
lines changed

docker-compose.yaml

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
version: '3.8'
22
services:
3+
4+
jaeger:
5+
image: jaegertracing/all-in-one
6+
ports:
7+
- "16686:16686"
8+
9+
otel-collector:
10+
image: otel/opentelemetry-collector-contrib
11+
depends_on:
12+
- jaeger
13+
volumes:
14+
- ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
15+
316
redis:
417
image: redis
518

6-
celery_worker:
19+
celery-worker:
720
build:
821
dockerfile: Dockerfile
922
context: .
1023
target: celery_app
1124
environment:
12-
OTEL_SERVICE_NAME: "bootstrap-fastapi"
13-
OTEL_TRACES_EXPORTER: "none"
14-
OTEL_METRICS_EXPORTER: "none"
15-
OTEL_LOGS_EXPORTER: "none"
25+
OTEL_SERVICE_NAME: "bootstrap-fastapi-worker"
26+
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4317"
1627
volumes:
1728
- '.:/app'
1829
depends_on:
1930
- redis
31+
- otel-collector
2032
command:
2133
- opentelemetry-instrument
2234
- celery
@@ -32,24 +44,39 @@ services:
3244
dockerfile: Dockerfile
3345
context: .
3446
target: dev
47+
environment:
48+
OTEL_SERVICE_NAME: "bootstrap-fastapi-dev"
49+
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4317"
3550
ports:
3651
- '8000:8000'
3752
volumes:
3853
- '.:/app'
3954
depends_on:
4055
- redis
41-
- celery_worker
56+
- celery-worker
57+
command:
58+
- opentelemetry-instrument
59+
- uvicorn
60+
- http_app:create_app
61+
- --host
62+
- 0.0.0.0
63+
- --port
64+
- "8000"
65+
- --factory
66+
- --reload
4267

4368
http:
4469
build:
4570
dockerfile: Dockerfile
4671
context: .
4772
target: http_app
73+
depends_on:
74+
- redis
75+
- celery-worker
76+
- otel-collector
4877
environment:
49-
OTEL_SERVICE_NAME: "bootstrap-fastapi"
50-
OTEL_TRACES_EXPORTER: "console"
51-
OTEL_METRICS_EXPORTER: "console"
52-
OTEL_LOGS_EXPORTER: "none"
78+
OTEL_SERVICE_NAME: "bootstrap-fastapi-http"
79+
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4317"
5380
ports:
5481
- '8001:8000'
5582
volumes:
@@ -60,11 +87,13 @@ services:
6087
dockerfile: Dockerfile
6188
context: .
6289
target: grpc_app
90+
depends_on:
91+
- redis
92+
- celery-worker
93+
- otel-collector
6394
environment:
64-
OTEL_SERVICE_NAME: "bootstrap-fastapi"
65-
OTEL_TRACES_EXPORTER: "console"
66-
OTEL_METRICS_EXPORTER: "console"
67-
OTEL_LOGS_EXPORTER: "none"
95+
OTEL_SERVICE_NAME: "bootstrap-fastapi-grpc"
96+
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4317"
6897
ports:
6998
- "9999:9999"
7099
volumes:

otel-collector-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
receivers:
2+
otlp:
3+
protocols:
4+
grpc:
5+
exporters:
6+
logging:
7+
loglevel: debug
8+
otlp:
9+
endpoint: jaeger:4317
10+
tls:
11+
insecure: true
12+
jaeger:
13+
endpoint: jaeger:14250
14+
tls:
15+
insecure: true
16+
processors:
17+
batch:
18+
service:
19+
pipelines:
20+
traces:
21+
receivers: [otlp]
22+
exporters: [jaeger]
23+
processors: [batch]

0 commit comments

Comments
 (0)