forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to tests/telemetry.rsClear filter

2026-09-07

🔒 fix: telemetry privacy sweep, in-flight gauge guards, request-id validation, tenant gauge on createAhmet Kaan Gümüş · ae0957a
🔒 fix: telemetry privacy sweep, in-flight gauge guards, request-id validation, tenant gauge on create

- No account name reaches an exported log record: the admin seed
  (domain/user.rs), the ADMIN_USERNAME refusal and the builder seed
  (domain/builder.rs) log the event without the `username` field.
- The forbidden-key list moves to tests/common (`FORBIDDEN_TELEMETRY_KEYS`,
  `is_forbidden_key`), gains `username`/`email` and the header prefixes, and
  is used by both the HTTP-edge and the AI-bridge guard tests. The telemetry
  suite now also exports tracing EVENTS through an in-memory log exporter and
  holds log records to the same rule.
- `http.server.active_requests` and `ai_requests_inflight` are closed by a
  `Drop` guard, so a dropped request future (client hang-up, outer timeout)
  no longer leaks the gauge upwards. A cancelled request is recorded as 499.
- A caller-supplied `x-request-id` is only kept when it is at most 64 chars of
  `[A-Za-z0-9._-]`; anything else is dropped and a UUID is minted, so a client
  cannot write free text onto `http.request.id` of every span.
- `tenant_cache_size` is reported by `Tenants::create` and by the bootstrap
  insert, not only by the lazy-dial path.
- The keepalive logs its first `up` verdict, which its comment already claimed.

Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s
✨ feat: real /health, error and panic telemetryAhmet Kaan Gümüş · c00f83a
✨ feat: real /health, error and panic telemetry

`/health` (and its `/` mirror) now answers what the process can actually do —
`{status, db, ai:{enabled,workers}}`, 200 when the database is up and 503 with
`"db":"down"` when it is not. It is exempt from the db guard alongside
`/limits`: a probe refused by the outage it exists to report names nothing.

Every `AppError` arm now records a stable snake_case class on the request span
(`error.type`) and counts itself into `errors_total` with that class and the
status. One log line per refusal, by severity: 5xx at error! with the
underlying error (which the arm's own Display hides), 429 and the reconnect
503 at warn!, the caller's 4xx at debug! — no path, no user, no body anywhere.
`record_response` no longer overwrites `error.type` with the status code.

Panics are no longer a dropped connection: a process-wide hook logs
`exception.type/message/stacktrace` and counts `panics_total`, and a
`CatchPanicLayer` inside the trace layer answers the same `{"error":"internal
server error"}` 500 every other internal error answers, tagging its span
`panic`.

Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s
✨ feat: OpenTelemetry bootstrap — OTLP traces/metrics/logs, request spans, request idsAhmet Kaan Gümüş · 057a7fa
✨ feat: OpenTelemetry bootstrap — OTLP traces/metrics/logs, request spans, request ids

Telemetry is off unless OTEL_EXPORTER_OTLP_ENDPOINT is set, mirroring the
AI bridge's "off unless configured" shape. With it unset the process logs
exactly as before; every instrument binds to the noop meter provider, so
call sites never branch on whether telemetry is on.

Privacy is the design constraint (KVKK): a span carries the method, the
route TEMPLATE, the status, a random request id and the school slug —
never a user, an IP, a URL path, a body, a header or a cookie.
tests/telemetry.rs fails the build if a forbidden attribute key appears.

New variables (all documented in .env.example):
  OTEL_EXPORTER_OTLP_ENDPOINT   presence turns export on
  OTEL_EXPORTER_OTLP_PROTOCOL   grpc (default) | http/protobuf
  OTEL_EXPORTER_OTLP_HEADERS    read by the SDK
  OTEL_SERVICE_NAME             read by the SDK, defaults hezarfen_backend
  OTEL_TRACES_SAMPLER(_ARG)     read by the SDK, parent-based always-on
  LOG_FORMAT                    pretty (default) | json; anything else refuses to boot
  DEPLOY_ENV                    deployment.environment.name

Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s