Skip to main content

Metrics & Analytics

AlertifyPro records every check result as a time-series of status and response_time_ms values. Use these endpoints to power dashboards, SLA reports, and trend analysis.


Service metrics​

GET /api/v1/services/{id}/metrics
Authorization: Bearer <token>

Query parameters:

ParameterFormatDefaultDescription
fromRFC3339Last 24 hoursStart of time range
toRFC3339NowEnd of time range
# Last 24 hours (default)
curl "http://localhost:3001/api/v1/services/svc-uuid/metrics" \
-H "Authorization: Bearer $WK_TOKEN"

# Custom range
curl "http://localhost:3001/api/v1/services/svc-uuid/metrics?from=2026-03-01T00:00:00Z&to=2026-03-02T00:00:00Z" \
-H "Authorization: Bearer $WK_TOKEN"

Returns a time-series array of check metrics including status, response_time_ms, and status_code.


Service uptime​

GET /api/v1/services/{id}/uptime

Query parameters:

ParameterFormatDefaultDescription
fromRFC333930 days agoStart of period
toRFC3339NowEnd of period
# Default last 30 days
curl "http://localhost:3001/api/v1/services/svc-uuid/uptime" \
-H "Authorization: Bearer $WK_TOKEN"

Response when uptime data is available:

{
"service_id": "uuid",
"period_start": "2026-02-01T00:00:00Z",
"period_end": "2026-03-02T00:00:00Z",
"uptime_percentage": 99.82,
"total_checks": 43200,
"failed_checks": 78
}

Response when no historical data has been computed yet:

{
"service_id": "uuid",
"status": "GREEN",
"note": "no historical uptime report computed yet"
}

Service check log​

GET /api/v1/services/{id}/checks

Query parameters:

ParameterFormatDefaultDescription
sinceRFC3339Last 1 hourOnly return checks after this time
# Last 1 hour (default)
curl "http://localhost:3001/api/v1/services/svc-uuid/checks" \
-H "Authorization: Bearer $WK_TOKEN"

# Custom window
curl "http://localhost:3001/api/v1/services/svc-uuid/checks?since=2026-03-01T00:00:00Z" \
-H "Authorization: Bearer $WK_TOKEN"

Each result includes status (GREEN/YELLOW/RED), response_time_ms, optional status_code, and checked_at timestamp.


Custom metric ingestion​

You can push your own numeric metrics into AlertifyPro:

POST /api/v1/metrics/custom
Authorization: Bearer <token>
Content-Type: application/json

{
"metric_definition_id": "<uuid>",
"value": 127.5,
"labels": { "region": "us-east-1" },
"source": "my-app"
}
FieldTypeRequiredDescription
metric_definition_idUUID✅Pre-configured metric definition
valuefloat✅Numeric metric value
labelsobjectNoKey-value labels
sourcestringNoSource system identifier