From fcd8cfb9fc2c8dcd89a0f8b373cc96bc53af8091 Mon Sep 17 00:00:00 2001 From: Aayush <82300923+aayushwhiz@users.noreply.github.com> Date: Tue, 21 Jan 2025 17:15:27 -0800 Subject: [PATCH] add in honeycomb support for weather-forecast demo (#345) --- demos/shared/honeycomb/Dockerfile | 5 ++ .../honeycomb/otel-collector-config.yaml | 24 ++++++++++ .../docker-compose-honeycomb.yaml | 46 +++++++++++++++++++ demos/weather_forecast/run_demo.sh | 41 +++++++++++------ 4 files changed, 101 insertions(+), 15 deletions(-) create mode 100644 demos/shared/honeycomb/Dockerfile create mode 100644 demos/shared/honeycomb/otel-collector-config.yaml create mode 100644 demos/weather_forecast/docker-compose-honeycomb.yaml diff --git a/demos/shared/honeycomb/Dockerfile b/demos/shared/honeycomb/Dockerfile new file mode 100644 index 00000000..eec82c08 --- /dev/null +++ b/demos/shared/honeycomb/Dockerfile @@ -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"] diff --git a/demos/shared/honeycomb/otel-collector-config.yaml b/demos/shared/honeycomb/otel-collector-config.yaml new file mode 100644 index 00000000..e261be84 --- /dev/null +++ b/demos/shared/honeycomb/otel-collector-config.yaml @@ -0,0 +1,24 @@ +receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + http: + endpoint: 0.0.0.0:4318 + +exporters: + otlp: + endpoint: "api.honeycomb.io:443" + headers: + "x-honeycomb-team": "${HONEYCOMB_API_KEY}" + +processors: + batch: + timeout: 5s + +service: + pipelines: + traces: + receivers: [otlp] + processors: [batch] + exporters: [otlp] diff --git a/demos/weather_forecast/docker-compose-honeycomb.yaml b/demos/weather_forecast/docker-compose-honeycomb.yaml new file mode 100644 index 00000000..9f81fa69 --- /dev/null +++ b/demos/weather_forecast/docker-compose-honeycomb.yaml @@ -0,0 +1,46 @@ +services: + weather_forecast_service: + build: + context: ./ + 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: ../shared/honeycomb/ + ports: + - "4317:4317" + - "4318:4318" + volumes: + - ../shared/honeycomb/otel-collector-config.yaml:/etc/otel-collector-config.yaml + env_file: + - .env + environment: + - HONEYCOMB_API_KEY + + prometheus: + build: + context: ../shared/prometheus + + grafana: + build: + context: ../shared/grafana + ports: + - "3000:3000" diff --git a/demos/weather_forecast/run_demo.sh b/demos/weather_forecast/run_demo.sh index e764c9fa..a6f846fe 100644 --- a/demos/weather_forecast/run_demo.sh +++ b/demos/weather_forecast/run_demo.sh @@ -11,18 +11,21 @@ load_env() { # Function to determine the docker-compose file based on the argument get_compose_file() { case "$1" in - jaeger) - echo "docker-compose-jaeger.yaml" - ;; - logfire) - echo "docker-compose-logfire.yaml" - ;; - signoz) - echo "docker-compose-signoz.yaml" - ;; - *) - echo "docker-compose.yaml" - ;; + jaeger) + echo "docker-compose-jaeger.yaml" + ;; + logfire) + echo "docker-compose-logfire.yaml" + ;; + signoz) + echo "docker-compose-signoz.yaml" + ;; + honeycomb) + echo "docker-compose-honeycomb.yaml" + ;; + *) + echo "docker-compose.yaml" + ;; esac } @@ -44,12 +47,16 @@ start_demo() { echo "Error: LOGFIRE_API_KEY environment variable is required for Logfire." exit 1 fi + if [ "$1" == "honeycomb" ] && [ -z "$HONEYCOMB_API_KEY" ]; then + echo "Error: HONEYCOMB_API_KEY environment variable is required for Honeycomb." + exit 1 + fi # Create .env file echo "Creating .env file..." - echo "OPENAI_API_KEY=$OPENAI_API_KEY" > .env + echo "OPENAI_API_KEY=$OPENAI_API_KEY" >.env if [ "$1" == "logfire" ]; then - echo "LOGFIRE_API_KEY=$LOGFIRE_API_KEY" >> .env + echo "LOGFIRE_API_KEY=$LOGFIRE_API_KEY" >>.env fi echo ".env file created with required API keys." fi @@ -60,6 +67,10 @@ start_demo() { echo "Error: LOGFIRE_API_KEY environment variable is required for Logfire." exit 1 fi + if [ "$1" == "honeycomb" ] && [ -z "$HONEYCOMB_API_KEY" ]; then + echo "Error: HONEYCOMB_API_KEY environment variable is required for Honeycomb." + exit 1 + fi # Step 4: Start Arch echo "Starting Arch with arch_config.yaml..." @@ -67,7 +78,7 @@ start_demo() { # Step 5: Start Network Agent with the chosen Docker Compose file echo "Starting Network Agent with $COMPOSE_FILE..." - docker compose -f "$COMPOSE_FILE" up -d # Run in detached mode + docker compose -f "$COMPOSE_FILE" up -d # Run in detached mode } # Function to stop the demo