Skip to content

Telemetry API (metrics, tracing, structured logs) #5

@EdmondDantes

Description

@EdmondDantes

Expose a first-class telemetry API so operators can observe the server in production.

Scope

  • Metrics — counters, gauges, histograms for: accepted connections, active connections per protocol, request rate, request duration, response status classes, bytes in/out, TLS handshake duration, HTTP/2 stream concurrency, HTTP/3 packet rates, CoDel pause events, queue depth.
  • Prometheus-compatible text exposition endpoint (opt-in).
  • Tracing — OpenTelemetry-compatible spans for accept → parse → dispatch → respond, with context propagation from traceparent header.
  • Structured logs — JSON-formatted access log with configurable fields.
  • PHP-side hooks: $server->onMetric(), $server->onSpan() so user code can emit custom telemetry on the same pipeline.
  • Zero-cost when telemetry is disabled (compile-time and runtime).

Acceptance

  • Prometheus scrapes the endpoint successfully and renders the standard server dashboard.
  • OTel collector receives spans with correct parent/child relationships.
  • No measurable throughput regression with telemetry off; <5% with metrics on.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions