Package A of the instrumentation plan (research/observability/2026-10-28-instrumentation-portal-registry-db.md, backlog t36). Werkmeister copies this shape afterwards.
What
internal/telemetry:
Setup — OTLP/HTTP tracer provider from the standard env. OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS and OTEL_SERVICE_NAME are already set on tenant-registry-stage/-prod (orca-platform), so merging is enough to start traces on stage. Unset endpoint = off (only the W3C propagator). Resource: service.name, service.version (/version), vcs.ref.head.revision, deployment.environment from APP_ENV; OTEL_RESOURCE_ATTRIBUTES overrides. Flush with a 5 s timeout on SIGTERM.
Server spans — one per request, named after the matched ServeMux pattern (GET /v1/tenants/{id}, GET unmatched), incoming traceparent continued, status code recorded, 5xx = error. /healthz and /readyz are skipped.
Client spans — http.DefaultTransport is wrapped, so Keycloak, ERP, LiteLLM, OIDC/JWKS and the product client are covered; traceparent is injected.
SQL spans — a pgx QueryTracer on the pool: db <OPERATION>, statement text with $n placeholders (max 2000 chars), errors (not ErrNoRows).
Client and SQL spans only inside a request: the outbox/reconcile/mail loops poll every few seconds and would otherwise flood SigNoz with single-span traces.
slog — LogHandler adds trace_id/span_id to lines logged with a request context; the access log now logs with it.
Privacy
No raw paths (slugs are names), no query strings, no bodies, no SQL parameters, no client addresses in spans; outbound spans carry the host only (paths hold ERP document names and Keycloak user ids). Hence own small wrappers instead of otelhttp/otelpgx, which record url.full, the raw path and the client address. Tests check that the raw path, query and SQL parameters never reach an attribute.
Access log change:"path": r.URL.Path → "route": <pattern> (same reason). The remote field stays as it is.
Dependencies
otel / sdk / otlptracehttp v1.41.0 — the version already in go.mod as indirect (a plain @latest dragged in unrelated majors, e.g. jsonpointer 1.0 under kin-openapi). Transitive bumps: grpc 1.79.1, protobuf 1.36.11, otlp proto 1.9.0.
Checks
go vet, gofmt, go test ./... green; internal/telemetry 98.9 % (race), added to the CI test list.
CI test command locally: 69.7 % vs 69.4 % on main (both without Docker, so the Postgres store tests are skipped here; CI runs them).
Local smoke test against a fake OTLP receiver: POST /v1/traces (protobuf) with the auth header; access-log lines carry route and trace_id; /healthz untraced.
After merge (stage)
SigNoz → Services: tenant-registry-stage appears with operations named after routes; a trace from a portal action shows the server span with db SELECT … and Keycloak/ERP children. The portal does not propagate yet (package C), so its calls start new traces here.
Package A of the instrumentation plan (`research/observability/2026-10-28-instrumentation-portal-registry-db.md`, backlog t36). Werkmeister copies this shape afterwards.
## What
`internal/telemetry`:
- **Setup** — OTLP/HTTP tracer provider from the standard env. `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_SERVICE_NAME` are **already set** on tenant-registry-stage/-prod (orca-platform), so merging is enough to start traces on stage. Unset endpoint = off (only the W3C propagator). Resource: service.name, service.version (`/version`), `vcs.ref.head.revision`, `deployment.environment` from `APP_ENV`; `OTEL_RESOURCE_ATTRIBUTES` overrides. Flush with a 5 s timeout on SIGTERM.
- **Server spans** — one per request, named after the matched ServeMux pattern (`GET /v1/tenants/{id}`, `GET unmatched`), incoming `traceparent` continued, status code recorded, 5xx = error. `/healthz` and `/readyz` are skipped.
- **Client spans** — `http.DefaultTransport` is wrapped, so Keycloak, ERP, LiteLLM, OIDC/JWKS and the product client are covered; `traceparent` is injected.
- **SQL spans** — a pgx `QueryTracer` on the pool: `db <OPERATION>`, statement text with `$n` placeholders (max 2000 chars), errors (not `ErrNoRows`).
- Client and SQL spans **only inside a request**: the outbox/reconcile/mail loops poll every few seconds and would otherwise flood SigNoz with single-span traces.
- **slog** — `LogHandler` adds `trace_id`/`span_id` to lines logged with a request context; the access log now logs with it.
## Privacy
No raw paths (slugs are names), no query strings, no bodies, no SQL parameters, no client addresses in spans; outbound spans carry the host only (paths hold ERP document names and Keycloak user ids). Hence own small wrappers instead of `otelhttp`/`otelpgx`, which record `url.full`, the raw path and the client address. Tests check that the raw path, query and SQL parameters never reach an attribute.
**Access log change:** `"path": r.URL.Path` → `"route": <pattern>` (same reason). The `remote` field stays as it is.
## Dependencies
otel / sdk / otlptracehttp **v1.41.0** — the version already in go.mod as indirect (a plain `@latest` dragged in unrelated majors, e.g. jsonpointer 1.0 under kin-openapi). Transitive bumps: grpc 1.79.1, protobuf 1.36.11, otlp proto 1.9.0.
## Checks
- `go vet`, `gofmt`, `go test ./...` green; `internal/telemetry` 98.9 % (race), added to the CI test list.
- CI test command locally: 69.7 % vs 69.4 % on main (both without Docker, so the Postgres store tests are skipped here; CI runs them).
- Local smoke test against a fake OTLP receiver: `POST /v1/traces` (protobuf) with the auth header; access-log lines carry `route` and `trace_id`; `/healthz` untraced.
## After merge (stage)
SigNoz → Services: `tenant-registry-stage` appears with operations named after routes; a trace from a portal action shows the server span with `db SELECT …` and Keycloak/ERP children. The portal does not propagate yet (package C), so its calls start new traces here.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
internal/telemetry: OTLP/HTTP tracer provider from the OTEL_* env
(already set on stage and prod; unset = off), W3C propagation, one server
span per request named after the ServeMux pattern, client spans on the
default transport (Keycloak, ERP, LiteLLM, OIDC) and a pgx QueryTracer.
Client and DB spans only inside a request, so the background loops add
no traces. No raw paths, query strings, bodies, SQL parameters or client
addresses in spans; outbound spans carry the host only.
slog lines logged with a request context get trace_id/span_id; the
access log names the route instead of the raw path (slugs are names).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
trivy on the PR: otel/sdk v1.41.0 CVE-2026-39883 (fixed 1.43.0); grpc
v1.79.1 CVE-2026-33186 (critical), CVE-2026-84304, CVE-2026-84445 and
GHSA-hrxh-6v49-42gf (fixed by 1.83.2). jsonpointer 1.0.0 comes with the
otel bump; kin-openapi (contract test only) passes with it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Package A of the instrumentation plan (
research/observability/2026-10-28-instrumentation-portal-registry-db.md, backlog t36). Werkmeister copies this shape afterwards.What
internal/telemetry:OTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_HEADERSandOTEL_SERVICE_NAMEare already set on tenant-registry-stage/-prod (orca-platform), so merging is enough to start traces on stage. Unset endpoint = off (only the W3C propagator). Resource: service.name, service.version (/version),vcs.ref.head.revision,deployment.environmentfromAPP_ENV;OTEL_RESOURCE_ATTRIBUTESoverrides. Flush with a 5 s timeout on SIGTERM.GET /v1/tenants/{id},GET unmatched), incomingtraceparentcontinued, status code recorded, 5xx = error./healthzand/readyzare skipped.http.DefaultTransportis wrapped, so Keycloak, ERP, LiteLLM, OIDC/JWKS and the product client are covered;traceparentis injected.QueryTraceron the pool:db <OPERATION>, statement text with$nplaceholders (max 2000 chars), errors (notErrNoRows).LogHandleraddstrace_id/span_idto lines logged with a request context; the access log now logs with it.Privacy
No raw paths (slugs are names), no query strings, no bodies, no SQL parameters, no client addresses in spans; outbound spans carry the host only (paths hold ERP document names and Keycloak user ids). Hence own small wrappers instead of
otelhttp/otelpgx, which recordurl.full, the raw path and the client address. Tests check that the raw path, query and SQL parameters never reach an attribute.Access log change:
"path": r.URL.Path→"route": <pattern>(same reason). Theremotefield stays as it is.Dependencies
otel / sdk / otlptracehttp v1.41.0 — the version already in go.mod as indirect (a plain
@latestdragged in unrelated majors, e.g. jsonpointer 1.0 under kin-openapi). Transitive bumps: grpc 1.79.1, protobuf 1.36.11, otlp proto 1.9.0.Checks
go vet,gofmt,go test ./...green;internal/telemetry98.9 % (race), added to the CI test list.POST /v1/traces(protobuf) with the auth header; access-log lines carryrouteandtrace_id;/healthzuntraced.After merge (stage)
SigNoz → Services:
tenant-registry-stageappears with operations named after routes; a trace from a portal action shows the server span withdb SELECT …and Keycloak/ERP children. The portal does not propagate yet (package C), so its calls start new traces here.🤖 Generated with Claude Code
https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4