Files
buzz/test/otel-e2e/compose.otel-e2e.yml
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 deee33ba60 test(otel-e2e): fix Thufir-flagged correctness issues in E2E harness
Three correctness fixes (all IMPORTANT from Thufir's review) + one MINOR:

1. Per-run isolated collector output dir (mktemp -d): stale data from a
   prior run can no longer false-green the OTLP trace assertions. The dir
   is passed into compose via BUZZ_OTEL_OUTPUT_DIR env var (replaces the
   hard-coded /tmp/buzz-otel-e2e-output bind-mount). Cleaned on success;
   preserved on failure for inspection.

2. Delete test_otlp_metrics_tagged_service_name_buzz_relay: descoped per
   Tyler/Max decision — relay drops OTLP metrics export entirely; metrics
   go out the Prometheus :9102 scrape only; OTLP carries traces only.

3. Remove OTEL_SERVICE_NAME from enabled relay start so the harness
   exercises the relay's Finding-A fallback exactly as staging does.
   Replace blob.contains("buzz-relay") substring check with a structural
   has_resource_attr_in_spans() assertion that walks ResourceSpans[].
   resource.attributes[]{key, value.stringValue} — a span/scope name
   containing "buzz-relay" can no longer satisfy this check.

4. README: note Rust tests are harness internals, not standalone; update
   manual-run example to match new env var shape.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-06-30 14:14:45 -04:00

57 lines
2.0 KiB
YAML

# Compose overlay — OTEL E2E harness.
#
# Adds an otel-collector to the existing dev stack (docker-compose.yml). The
# relay itself runs on the HOST (matching the existing host.docker.internal
# Prometheus pattern), so only the collector and its shared output volume are
# declared here. This keeps the relay build/start cycle fast and avoids a
# slow full-image rebuild for each test run.
#
# Usage (via `just otel-e2e` which calls run.sh, or manually):
#
# docker compose -f docker-compose.yml -f test/otel-e2e/compose.otel-e2e.yml up -d
#
# Teardown:
#
# docker compose -f docker-compose.yml -f test/otel-e2e/compose.otel-e2e.yml down -v
#
# The relay is pointed at the collector via:
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# (the collector's gRPC port is published to the host).
#
# BUZZ_OTEL_OUTPUT_DIR must be set to a per-run directory created by run.sh
# (via mktemp -d) before docker compose up. This prevents stale data from a
# prior run from satisfying the OTLP trace assertions.
name: buzz
services:
otel-collector:
image: otel/opentelemetry-collector-contrib:0.115.1
container_name: buzz-otel-collector
command: ["--config=/etc/otelcol-config.yml"]
volumes:
- ./test/otel-e2e/otelcol-config.yml:/etc/otelcol-config.yml:ro
# Per-run bind-mount set by run.sh (BUZZ_OTEL_OUTPUT_DIR=$(mktemp -d)).
# The collector image is distroless — no shell available via docker exec,
# so assertions read from the host path directly.
- ${BUZZ_OTEL_OUTPUT_DIR}:/tmp/otelcol-output
ports:
# OTLP gRPC — relay (on host) dials this
- "4317:4317"
networks:
- buzz-net
healthcheck:
# Use the collector's own /metrics health endpoint (otelcol exposes it on :8888)
test: ["CMD", "/otelcol-contrib", "--version"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
deploy:
resources:
limits:
memory: 128m
labels:
com.buzz.service: "otel-collector"
com.buzz.env: "e2e"
restart: unless-stopped