Skip to content

Commit 52514ac

Browse files
authored
Enable double write on US and EU stack (#50)
1 parent 6eacc10 commit 52514ac

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ services:
5050
healthcheck:
5151
test: arq src.worker.WorkerSettings --check
5252

53+
otel-collector:
54+
image: otel/opentelemetry-collector-contrib:0.101.0
55+
command: ["--config=/etc/otel-collector-config.yaml"]
56+
volumes:
57+
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
58+
ports:
59+
- "4318:4318"
60+
- "4317:4317"
61+
# healthcheck port
62+
- "13133:13133"
63+
environment:
64+
US_WRITE_TOKEN: $US_WRITE_TOKEN
65+
EU_WRITE_TOKEN: $EU_WRITE_TOKEN
66+
5367
postgres:
5468
image: ankane/pgvector:latest
5569
container_name: logfire-demo-postgres

otel-collector-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
receivers:
2+
otlp:
3+
protocols:
4+
http:
5+
endpoint: "0.0.0.0:4318"
6+
7+
exporters:
8+
debug:
9+
otlphttp/us:
10+
endpoint: https://api-us.pydantic.info
11+
compression: none
12+
tls:
13+
insecure: true
14+
headers:
15+
Authorization: "Bearer ${US_WRITE_TOKEN}"
16+
otlphttp/eu:
17+
endpoint: https://api-eu.pydantic.info
18+
compression: none
19+
tls:
20+
insecure: true
21+
headers:
22+
Authorization: "Bearer ${EU_WRITE_TOKEN}"
23+
processors:
24+
batch:
25+
timeout: 1s
26+
send_batch_size: 32768
27+
28+
extensions:
29+
health_check:
30+
endpoint: "0.0.0.0:13133"
31+
32+
service:
33+
extensions: [health_check]
34+
pipelines:
35+
traces:
36+
receivers: [otlp]
37+
processors: [batch]
38+
exporters: [debug, otlphttp/us, otlphttp/eu]
39+
metrics:
40+
receivers: [otlp]
41+
processors: [batch]
42+
exporters: [debug, otlphttp/us, otlphttp/eu]

src/__main__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def scrubbing_callback(match: logfire.ScrubMatch):
3636
return match.value
3737

3838
logfire.configure(
39+
advanced=logfire.AdvancedOptions(base_url='http://otel-collector:4318'),
40+
token='does-not-matter', # as we send data to otel collector, token is here to prevent errors
3941
service_name=service,
4042
code_source=logfire.CodeSource(
4143
repository='https://github.com/pydantic/logfire-demo',

0 commit comments

Comments
 (0)