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
| Field | Type | Description |
|---|---|---|
traceId | string | Unique identifier for the entire trace |
spanId | string | Unique identifier for this specific span |
parentId | string | ID of the calling span (optional) |
name | string | Descriptive name of the operation |
durationMs | number | Execution time in milliseconds |
status | string | ok 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 }
]
}