API Reference
Performance

Performance Monitoring

Statly Observe supports distributed tracing and performance metric ingestion via the same endpoints as error tracking.

Ingesting Spans

To track performance, send events with level: "span" and a span object.

Endpoint

POST /api/v1/observe/ingest

Request Body (Span)

{
  "message": "Span: GET /api/users",
  "level": "span",
  "timestamp": 1705312200000,
  "span": {
    "traceId": "t-123456",
    "spanId": "s-789012",
    "parentId": "s-000000",
    "name": "GET /api/users",
    "durationMs": 45.2,
    "status": "ok"
  },
  "environment": "production"
}

Field Definitions

FieldTypeDescription
traceIdstringUnique identifier for the entire trace
spanIdstringUnique identifier for this specific span
parentIdstringID of the calling span (optional)
namestringDescriptive name of the operation
durationMsnumberExecution time in milliseconds
statusstringok or error

Querying Performance Stats

Aggregated performance metrics can be retrieved via the stats API.

Endpoint

GET /api/v1/stats/performance

Auth

Requires API Key with status:read scope.

Response

{
  "avgLatency": 42.5,
  "p95Latency": 120.8,
  "totalSpans": 15420,
  "errorRate": 0.45,
  "latencyHistory": [
    { "date": "2024-01-10", "avg": 40.2, "p95": 115.0 },
    { "date": "2024-01-11", "avg": 44.8, "p95": 126.5 }
  ]
}