Issue with FastAPI App Not Showing Metrics via Docker Compose

TLDR fahad is having trouble viewing app and opentelemetry metrics when running their fastapi application via docker-compose. Nocnica suggests that the OTLP_ENDPOINT may be configured incorrectly.

Photo of fahad
fahad
Tue, 04 Jul 2023 17:44:23 UTC

Hi guys, when I run my fastapi application via docker run command, the signoz is able to show the app and opentelemetry metrics but when I run it via docker-compose the application doesn't appear there. can anyone help me in *this?* *Docker run command:* ```docker run -d --name test-1 --net clickhouse-setup_default --env-file env_files/.env -p 3000:3000 test-image``` *Docker compose file:* ```version: "3" services: web: restart: unless-stopped build: . command: bash -c "OTEL_RESOURCE_ATTRIBUTES=service.name=testapp OTEL_EXPORTER_OTLP_ENDPOINT= opentelemetry-instrument uvicorn app.main:app --host 0.0.0.0 --port 3000 --reload" volumes: - .:/code ports: - "3000:3000" env_file: - ./env_files/.env networks: - clickhouse-setup_default networks: clickhouse-setup_default: external: true```

Photo of Nocnica
Nocnica
Tue, 04 Jul 2023 20:11:36 UTC

that OTLP_ENDPOINT doesn't look right to me, explain to me how that's supposed to resolve, why don't we just feed it the IP of our endpoint? Are we getting anything logged at startup? The other team will likely have more idea, it's only week 3 for me :slightly_smiling_face: they'll be awake in a few hours <3

Photo of fahad
fahad
Wed, 05 Jul 2023 11:44:12 UTC

since signoz service is running in another docker-compose so I provided the container name instead of IP. Its working if I run with docker run command but not the case with docker-compose.