OTLP Ingestion & Full-Stack APM
Native OpenTelemetry traces, metrics, logs, tail sampling, service maps, flamegraphs, RUM, and synthetics.
SpydDB natively ingests OpenTelemetry traces, metrics, and logs over both OTLP/gRPC and OTLP/HTTP, storing telemetry inside indexed multi-model collections with zero external collector databases or APM sidecars required.
1. Native OTLP Endpoints#
- OTLP/gRPC (
grpc_bind, default:4317):opentelemetry.proto.collector.trace.v1.TraceService/Exportopentelemetry.proto.collector.metrics.v1.MetricsService/Exportopentelemetry.proto.collector.logs.v1.LogsService/Export
- OTLP/HTTP (
http_bind, default:8080):POST /v1/tracesPOST /v1/metricsPOST /v1/logs- Accepts both
application/x-protobufandapplication/json, withContent-Encoding: gzipbounded decompression and standard Bearer/JWT authentication (Authorization: Bearer <token>).
Bootstrap all telemetry collections and indexes explicitly at setup time if needed:
curl -fsS -X POST --cacert tls/ca.crt https://localhost:8080/v1/apm/bootstrap \
-H "Authorization: Bearer $SPYD_TOKEN"2. Canonical Telemetry Collections#
| Collection | Contents & Indexes |
|---|---|
otel_traces | Distributed spans with trace/span IDs, service, duration, status, and full-text index on (operation, status_message) |
otel_metrics | Gauges, cumulative/delta counters, histograms, and summaries |
otel_logs | Severity, trace_id, span_id, message body, attributes, plus full-text BM25 index |
otel_service_edges | Automatically maintained service-to-service & downstream DB/RPC dependency edges with calls, errors, latency |
otel_error_groups | Normalized exception stack-trace SHA-256 fingerprints with occurrence counters & triage state (open/resolved/ignored) |
otel_profiles | Folded stack CPU/memory flamegraph samples linked by service and optional trace_id |
otel_rum | Real User Monitoring Web Vitals (LCP, INP, CLS, FCP, TTFB) and frontend errors |
otel_synthetics_monitors / otel_synthetics_runs | Scheduled HTTP/HTTPS/TCP uptime monitors and probe history |
Query telemetry directly with SpydQL:
-- Top slowest failing spans matched via full-text search
otel_traces
| where status == "error" and match(status_message, "timeout")
| pick trace_id, service, operation, duration_ms, status_message
| sort duration_ms desc
| take 253. Sending Telemetry from Application SDKs#
Node.js / TypeScript OpenTelemetry SDK#
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
const exporter = new OTLPTraceExporter({
url: "https://localhost:8080/v1/traces",
headers: {
Authorization: `Bearer ${process.env.SPYD_OTLP_TOKEN}`,
},
});Python OpenTelemetry SDK#
import os
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
exporter = OTLPSpanExporter(
endpoint="https://localhost:8080/v1/traces",
headers={"Authorization": f"Bearer {os.environ['SPYD_OTLP_TOKEN']}"},
certificate_file="tls/ca.crt",
)OpenTelemetry Collector Pipeline (otel-collector.yaml)#
exporters:
otlphttp/spyddb:
endpoint: https://spyddb.internal:8080
tls:
ca_file: /etc/spyd/tls/ca.crt
headers:
Authorization: "Bearer ${SPYD_OTLP_TOKEN}"
service:
pipelines:
traces:
exporters: [otlphttp/spyddb]
metrics:
exporters: [otlphttp/spyddb]
logs:
exporters: [otlphttp/spyddb]4. Tail-Based Sampling (GET / PUT /v1/apm/sampling)#
Configure deterministic error/slow-trace retention in server.json or update dynamically via HTTP:
{
"tail_sampling": {
"enabled": true,
"keep_errors": true,
"min_latency_ms": 250,
"baseline_rate": 0.1,
"max_buffered_traces": 4096
}
}curl -sS -X PUT --cacert tls/ca.crt https://localhost:8080/v1/apm/sampling \
-H "Authorization: Bearer $SPYD_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled":true,"keep_errors":true,"min_latency_ms":200,"baseline_rate":0.25,"max_buffered_traces":8192}'5. APM Query APIs (services, traces, service-map, errors, profiles, RUM, synthetics)#
GET /v1/apm/services— RED metrics per service (requests,errors,error_rate_pct,avg_ms,p50_ms,p95_ms,p99_ms)GET /v1/apm/timeseries— Time-bucketed RED seriesGET /v1/apm/traces&GET /v1/apm/traces/{trace_id}— Waterfall span hierarchy (offset_ms,depth), correlated logs, and correlated profilesGET /v1/apm/service-map— Topology graph nodes & directed dependency edgesGET /v1/apm/errors&POST /v1/apm/errors/{fingerprint}/status— Error triage workflow (open,resolved,ignored)POST /v1/profiles&GET /v1/apm/profiles— Folded flamegraph submission and aggregationPOST /v1/apm/rum&GET /v1/apm/rum— Browser Web Vitals (p75) ingestion and inspectionGET/POST /v1/apm/synthetics,DELETE /v1/apm/synthetics/{id},POST /v1/apm/synthetics/run— Uptime probe management (synthetics_interval_secs)
6. Scheduled Synthetic Monitoring (HTTP/HTTPS & TCP Probes)#
SpydDB includes a built-in synthetic monitoring runner (synthetics_interval_secs in server.json) that executes active HTTP/HTTPS and TCP connect probes from within the server and records historical latency and status outcomes into otel_synthetics_runs:
# Register an HTTP endpoint probe with status & body assertion
curl -sS -X POST --cacert tls/ca.crt https://localhost:8080/v1/apm/synthetics \
-H "Authorization: Bearer $SPYD_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "checkout-health",
"kind": "http",
"target": "https://api.example.com/healthz",
"method": "GET",
"expected_status": 200,
"assert_body_contains": "ok",
"interval_secs": 30,
"timeout_ms": 2500,
"enabled": true
}'
# Register a TCP socket connect probe
curl -sS -X POST --cacert tls/ca.crt https://localhost:8080/v1/apm/synthetics \
-H "Authorization: Bearer $SPYD_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "spydwire-primary-tcp",
"kind": "tcp",
"target": "10.0.4.12:5433",
"interval_secs": 15,
"timeout_ms": 1000,
"enabled": true
}'
# Trigger all active monitors immediately on demand
curl -sS -X POST --cacert tls/ca.crt https://localhost:8080/v1/apm/synthetics/run \
-H "Authorization: Bearer $SPYD_TOKEN"Query probe latency trends and failures directly in SpydQL:
otel_synthetics_runs
| where monitor_name == "checkout-health" and status != "up"
| pick ts_us, status, http_status, latency_ms, error
| sort ts_us desc
| take 50