TRACE EVENTS
Connect spans with one trace ID and route label.
A trace is a group of ordinary TrafficWar events. Share one trace_id and label across the request and describe each tier with its normal event fields.
Example multi-tier trace
const trace_id = crypto.randomUUID();
const label = "/checkout";
trafficwar.capture([
{ event: "database", label, trace_id, source: "db-primary",
operation_type: "postgres.select", span_kind: "client", latency_ms: 12.4 },
{ event: "s3", label, trace_id, source: "receipts.ovh-s3",
operation_type: "s3.put_object", span_kind: "client", latency_ms: 18.3 },
{ event: "http", label, trace_id, source: "checkout-api",
operation_type: "route.handler", span_kind: "server", latency_ms: 96.1 },
{ event: "http", label, trace_id, source: "web", http_method: "POST",
operation_type: "http.request", span_kind: "client", latency_ms: 184.2,
status_code: 200 },
]);Keep the hierarchy valid
Emit dependency spans before the backend and edge span when sending one array. Inclusive durations should nest: dependency time must not exceed backend time, and backend time must not exceed the edge request.
S3 source convention
For S3, source is a provider alias such as ovh-s3, aws-s3, or minio. Use bucket.provider, such as receipts.ovh-s3, only when separate bucket stations are useful. The operation_type remains the operation dot.