set up otel-collector and implement sending to logfire

This commit is contained in:
aayushwhiz 2024-12-04 21:15:50 -08:00
parent a0c159c9ba
commit 92ab6597ef
3 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,44 @@
services:
weather_forecast_service:
build:
context: ../shared/weather_forecast_service
environment:
- OLTP_HOST=http://otel-collector:4317
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "18083:80"
chatbot_ui:
build:
context: ../shared/chatbot_ui
ports:
- "18080:8080"
environment:
# this is only because we are running the sample app in the same docker container environment as archgw
- CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./arch_config.yaml:/app/arch_config.yaml
otel-collector:
build:
context: ./otel-collector
ports:
- "4317:4317"
- "4318:4318"
volumes:
- ./otel-collector/otel-collector-config.yaml:/etc/otel-collector-config.yaml
env_file:
- .env
prometheus:
build:
context: ../shared/prometheus
grafana:
build:
context: ../shared/grafana
ports:
- "3000:3000"

View file

@ -0,0 +1,5 @@
FROM otel/opentelemetry-collector:latest
COPY otel-collector-config.yaml /etc/otel-collector-config.yaml
ENTRYPOINT ["/otelcol", "--config=/etc/otel-collector-config.yaml"]

View file

@ -0,0 +1,24 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
otlphttp:
endpoint: "https://logfire-api.pydantic.dev"
headers:
Authorization: "${LOGFIRE_API_KEY}"
processors:
batch:
timeout: 5s
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]