Commit Graph

2 Commits

Author SHA1 Message Date
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
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
fd59e6660f test(otel): add E2E harness for relay OTEL export surfaces
Adds a one-command local E2E that proves both observability export
surfaces introduced in PR #1398:

  (a) Prometheus /metrics: buzz_ws_connections_total,
      buzz_events_received_total, buzz_auth_attempts_total present with
      non-zero values; target_info absent (suppressed via PR #1398).

  (b) OTLP traces: ws.auth and ws.event spans arrive at the collector
      carrying conn_id attribute and service.name=buzz-relay resource.

  (c) OTLP metrics: collector receives data tagged service.name=buzz-relay.

  (d) OTLP-disabled control: with OTEL_EXPORTER_OTLP_ENDPOINT unset
      /metrics still serves correctly; collector receives nothing.

Architecture: relay runs on the host (matching the existing
host.docker.internal Prometheus pattern); an otel-collector container
added via compose overlay receives OTLP on :4317. The collector image is
distroless so the output dir is bind-mounted to the host rather than read
via docker exec. The Rust assertions in buzz-test-client read the host
path directly.

New files:
- test/otel-e2e/run.sh — main driver script
- test/otel-e2e/compose.otel-e2e.yml — compose overlay
- test/otel-e2e/otelcol-config.yml — collector config
- test/otel-e2e/README.md — prerequisites and usage
- crates/buzz-test-client/tests/e2e_otel.rs — Rust assertions (all #[ignore])
- Justfile: just otel-e2e target

No changes to crates/buzz-relay/src/**.

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