Skip to main content

Telemetry Configuration

Enable OpenTelemetry traces and Prometheus metrics for full visibility into your gateway.

Options

config:
telemetry:
enabled: true
serviceName: tainha-gateway
exporterEndpoint: localhost:4317
FieldTypeDefaultDescription
enabledboolfalseEnable metrics + traces
serviceNamestringtainha-gatewayService name in OTEL and Prometheus
exporterEndpointstringOTLP gRPC endpoint for trace export

What You Get

When enabled: true:

GET /metrics — Prometheus Endpoint

Exposes metrics in Prometheus format:

MetricTypeDescription
http.server.request.countCounterRequests by method, route, status
http.server.request.durationHistogramLatency in seconds
http.server.active_requestsUpDownCounterIn-flight requests
http.server.rate_limit.hitsCounterRate-limited requests

OTLP Traces

If exporterEndpoint is set, traces are exported via OTLP gRPC to Jaeger, Grafana Tempo, or any OTLP-compatible backend.

Each request creates a trace with child spans:

Structured Logs

All gateway logs are JSON via slog, including request IDs for correlation:

{"time":"2025-01-15T10:30:00Z","level":"INFO","msg":"request received","path":"/api/products","method":"GET","requestId":"a1b2c3d4"}

Zero Overhead When Disabled

When enabled: false (default):

  • No metrics middleware is registered
  • No /metrics endpoint
  • No trace spans are created
  • No OTLP connection is established

See Observability for Prometheus scrape config, Grafana queries, and Jaeger setup.