Skip to content

APM Traces & RED Metrics (`apm` — OTLP)

inputs.apm provides a lightweight local OTLP/HTTP (/v1/traces, /v1/metrics, supporting Protobuf / JSON / Gzip) and OTLP/gRPC receiver for OpenTelemetry SDKs:

  • Aggregates bounded RED (Requests, Errors, Duration) metrics in local memory and buffers slow/error traces separately from recent traffic (zero disk writes, anti-OOM).
  • On incident trigger, captures Top-K slow/error trace waterfalls, completes late-arriving child spans during the post-trigger window, and pulls matching application logs from local log_file instances via trace_id.
inputs:
apm:
- id: order_svc
http_listen: "127.0.0.1:4318" # OTLP/HTTP bind address (empty disables HTTP)
grpc_listen: "127.0.0.1:4317" # OTLP/gRPC bind address (empty disables gRPC)
service_name: "" # Optional: filter by resource service.name
interval: 5s # RED metrics flush interval (inherits global.interval)
slow_threshold_ms: 500 # Duration threshold for slow-trace priority bucket (default 500ms)
http_read_timeout: 15s # Total HTTP read deadline (default 15s)
max_priority_mb: 4 # Memory ceiling for slow/error trace bucket (default 4MB)
max_recent_mb: 2 # Memory ceiling for recent span bucket (default 2MB)
max_traces_per_snapshot: 10 # Max correlated traces included per snapshot (default 10)
Metric Unit Description
apm.<id>.req_count req Entry requests (SERVER/CONSUMER/Root spans) in the interval
apm.<id>.err_count req Error requests (ERROR status, HTTP 5xx, or exception event)
apm.<id>.err_rate_pct % Error rate percentage (0 – 100)
apm.<id>.latency_avg_ms ms Average latency
apm.<id>.latency_p95_ms ms P95 latency
apm.<id>.latency_p99_ms ms P99 latency
apm.<id>.latency_max_ms ms Maximum latency
apm.<id>.spans_ingested spans Total spans ingested in the interval
  • apm:<id>/apm_traces_summary (CSV table): trace_id, service, operation, start_ts, duration_ms, status, span_count, error
  • apm:<id>/apm_traces_detail (Indented trace waterfall): Parent-child span tree with durations, key HTTP/RPC/DB attributes, and exception stack traces.
alerts:
# Error rate above 5% over a 60s window
- id: order_apm_err_rate
severity: critical
expr: 'sum("apm.order_svc.req_count", 60) >= 10 && (sum("apm.order_svc.err_count", 60) / sum("apm.order_svc.req_count", 60)) > 0.05'
# P99 latency above 1000ms with host forensics attached
- id: order_apm_p99_slow
severity: warning
for: 15s
expr: 'last("apm.order_svc.latency_p99_ms") > 1000'
attach: ["host/default"]

[!NOTE] Concurrency & Payload Protection: All OTLP HTTP/gRPC instances share global.apm_max_inflight_requests (default 2) and enforce a 4 MiB per-message cap, returning HTTP 429 or gRPC ResourceExhausted when saturated. See Security & Resource Limits.