Skip to content

PR 1: telemetry with OpenTelemetry and Dash0 - #3

Merged
riponcm merged 2 commits into
mainfrom
pr1/telemetry
Nov 9, 2026
Merged

riponcm merged 2 commits into
mainfrom
pr1/telemetry

Conversation

@riponcm

@riponcm riponcm commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Telemetry from the first hour (see docs/plan.md, row 1). Design notes are in docs/architecture.md.

What

  • API: OpenTelemetry traces, metrics and logs over OTLP/HTTP. Export turns on only when OTEL_EXPORTER_OTLP_ENDPOINT is set, so tests and fresh clones run without a backend.
  • Every request traced by the FastAPI instrumentation; the Elasticsearch 9 client traces its own calls as child spans (the contrib instrumentor disables itself on 9.x, so it is not used).
  • Logs carry trace and span IDs, so a log line links to its trace.
  • .env loaded into the process environment because the OTLP exporters read OTEL_* from there, not from app settings.
  • POST /api/debug/break (demo only, off unless ENABLE_DEBUG_ENDPOINTS=true): sends Elasticsearch a query it rejects, so Dash0 has a real error to find.
  • Browser: Dash0 web SDK for page views, web vitals, fetch calls and errors. /api calls are same-origin, so the trace header joins the browser and API spans into one trace. The browser token is ingest-only.

Verified locally

  • Browser export to Dash0: /v1/traces and /v1/logs returned 200.
  • API export with the server token: SUCCESS; traces for /api/health and the failing /api/debug/break (with the Elasticsearch search span and its exception) visible in Dash0.
  • Backend: ruff, 4 tests. Frontend: lint, type check and build.

LLM spans (tokens and cost) arrive with the first LLM call in PR 8.

- Traces, metrics and logs over OTLP/HTTP; export only when the endpoint is set
- Every API request traced; the Elasticsearch 9 client traces its own calls as child spans
- .env loaded into the process environment so the OTLP exporters see OTEL_*
- Demo-only POST /api/debug/break (off by default) triggers a real Elasticsearch error
- Dash0 web SDK: page views, web vitals, fetch and errors, trace header on /api calls
- One .env at the repo root for both halves; only VITE_* reaches the browser
- Telemetry section and first key decisions in docs/architecture.md
@riponcm
riponcm enabled auto-merge November 9, 2026 19:15
Comment thread backend/uv.lock Resolved
The first resolve downgraded FastAPI (0.162.2 -> 0.141.1) and the OTel API
(1.45.2 -> 1.43.0) instead of moving the instrumentation to 0.66b2. Add version
floors so it cannot slip back, and switch to the logging handler from
opentelemetry-instrumentation-logging, since the SDK one is deprecated.
@gitar-bot

gitar-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · API and browser telemetry exports traces, logs, fetches, and errors to Dash0, which could expose sensitive request details.

Adds OpenTelemetry tracing, metrics and logs to the FastAPI API with OTLP/HTTP export gated on OTEL_EXPORTER_OTLP_ENDPOINT, plus Dash0 browser monitoring. The lockfile downgrade of FastAPI and the OTel API that was flagged has been resolved, and no open issues remain.

✅ 1 closed
✅ Quality: Lockfile quietly downgrades FastAPI 0.162.2→0.141.1 and OTel API

📄 backend/uv.lock:278-290 📄 backend/uv.lock:458-466 📄 backend/pyproject.toml:12-14
Adding the OTel packages caused the resolver to move FastAPI back from 0.162.2 to 0.141.1, and opentelemetry-api back from 1.45.2 to 1.43.0. The cause is the new pins: opentelemetry-sdk>=1.43.0 and opentelemetry-instrumentation-fastapi>=0.64b0, where 0.64b0 is locked to API 1.43. That rolls the web framework back by about 20 minor releases, and neither the PR description nor the docs mention it. It is also an unrelated change bundled into the telemetry PR. Pick SDK, exporter and instrumentation versions that match the already-locked opentelemetry-api 1.45.x, so FastAPI keeps its current version. If the downgrade is on purpose, set an explicit lower bound and say so in the PR.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@riponcm
riponcm merged commit 737f214 into main Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant