Harden instrumentation, health checks and the admin server
CI / test (push) Failing after 43s

- Admin pprof is opt-in (AdminConfig.EnablePprof)
- Client spans drop the URL query string; HostFunc bounds the host label
- Config.HTTP/HTTPClient/GRPC configure the Observer's instrumentation
- A panic after a partial HTTP response counts as 500
- GaugeFunc, CounterFunc and RegisterDBStats panic on duplicates
- Abandoned client gRPC streams are recorded as Canceled
- OTEL_EXPORTER_OTLP_PROTOCOL selects the protocol when unset
- Health reports are cached for 1s; hung checks are not restarted
- Environment is exported as deployment.environment.name

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
M.ShakhmatovandClaude Fable 5.2 committed 2026-11-15 16:56:39 +03:00
1 parent 8647fdf1bb
commit c92fd9826b
21 files changed
+457 -101

No files matched your search

+5 -1
View File
@@ -7,10 +7,14 @@
- `TracerConfig.Protocol` (`ProtocolGRPC` / `ProtocolHTTP`), `TracerConfig.TLS`, `TracerConfig.Environment`, `TracerConfig.Disabled`, `TracerConfig.Exporter`.
- `Trace`, `RecordError`, `TraceID` helpers.
- `Endpoint` accepts URLs (`https://collector:4318`).
- Resource carries `service.instance.id` and host attributes.
- Resource carries `service.instance.id`, host attributes and `deployment.environment.name` (from `Environment`).
- `New` / `Observer` — one call wires logger, tracer, metrics, health checks and the admin server; `Config.WithEnv` applies `OBSX_*` overrides.
- `NewLogger`, `NewTraceHandler`; `NewHealth` (liveness/readiness, HTTP and `grpc.health.v1`).
- `NewHTTPMiddleware`, `NewHTTPTransport`, `NewGRPCInterceptors` — config-based instrumentation with fixed metric names (`http_server_*`, `http_client_*`, `grpc_*`).
- `Config.HTTP`, `Config.HTTPClient`, `Config.GRPC` configure the Observer's instrumentation; `HTTPClientConfig.HostFunc` bounds the `host` label.
- `OTEL_EXPORTER_OTLP_PROTOCOL` / `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` select the protocol when `TracerConfig.Protocol` is empty.
- Admin pprof is opt-in (`AdminConfig.EnablePprof`, `OBSX_ADMIN_ENABLE_PPROF`).
- Health reports are cached for one second and hung checks are not restarted; client spans omit the URL query string; abandoned client gRPC streams are recorded as `Canceled`.
- `deploy/` — Grafana dashboard and Prometheus alerts; `examples/service`.
- Metrics: idempotent registration, `Sub`, `GaugeFunc`, `CounterFunc`, `RegisterDBStats`, OpenMetrics handler with trace exemplars.