#support

Fixing FastAPI App Not Showing in Docker-compose Issue

TLDR fahad needed assistance when their FastAPI application wasn't showing in docker-compose. Srikanth suggested removing "--reload" from the command, which resolved the issue.

Powered by Struct AI
Jul 04, 2023 (5 months ago)
fahad
Photo of md5-bbf0ac7435b8d8a33de4c7665168df87
fahad
05:43 PM
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 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
Jul 05, 2023 (5 months ago)
Srikanth
Photo of md5-ce04a9988e2fd758a659dc55be6f2543
Srikanth
01:49 AM
>
OTEL_EXPORTER_OTLP_ENDPOINT=

>
This is probably incorrect. Please make sure n/w stuff is correct.
fahad
Photo of md5-bbf0ac7435b8d8a33de4c7665168df87
fahad
12:23 PM
Acc to this documentation: https://signoz.io/blog/opentelemetry-fastapi/
if we run signoz in via docker-compose then
>
OTEL_EXPORTER_OTLP_ENDPOINT=

Srikanth
Photo of md5-ce04a9988e2fd758a659dc55be6f2543
Srikanth
01:19 PM
Can you remove --reload and check?
Jul 06, 2023 (5 months ago)
fahad
Photo of md5-bbf0ac7435b8d8a33de4c7665168df87
fahad
08:10 AM
thank you Srikanth, yes that was the issue.