MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Alerting

Alerting

The AlertingController manages alert rules and active alerts for the observability system. Alert rules define conditions based on metrics, logs, or traces that trigger notifications when thresholds are breached.


Alert Rules

Create Alert Rule

Endpoint: POST /api/v1/observability/alerts/rules

curl -X POST http://localhost:8088/api/v1/observability/alerts/rules \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "X-Tenant-ID: 550e8400" \
  -d '{
    "name": "High Error Rate",
    "description": "Alert when error rate exceeds 5%",
    "query": "rate(http_requests_total{status=~\"5..\"}[5m]) / rate(http_requests_total[5m]) > 0.05",
    "duration": "5m",
    "severity": "critical",
    "labels": {"team": "backend"},
    "annotations": {"summary": "Error rate is above 5%"},
    "notificationChannels": ["email", "slack"]
  }'

List Alert Rules

Endpoint: GET /api/v1/observability/alerts/rules

Update Alert Rule

Endpoint: PUT /api/v1/observability/alerts/rules/:ruleId

Delete Alert Rule

Endpoint: DELETE /api/v1/observability/alerts/rules/:ruleId


AlertRule Structure

FieldTypeDescription
idStringRule identifier
nameStringRule name
descriptionStringRule description
queryStringPromQL expression that defines the alert condition
durationStringHow long the condition must be true before firing
severityStringinfo, warning, critical
labelsMapAdditional labels for routing
annotationsMapHuman-readable context
notificationChannelsListChannels to notify on alert
enabledbooleanWhether the rule is active

Active Alerts

List Active Alerts

Endpoint: GET /api/v1/observability/alerts/active

Returns all currently firing alerts for the tenant.

Acknowledge Alert

Endpoint: POST /api/v1/observability/alerts/:alertId/acknowledge

Resolve Alert

Endpoint: POST /api/v1/observability/alerts/:alertId/resolve


Alert Structure

FieldTypeDescription
idStringAlert instance ID
ruleNameStringOriginating rule name
severityStringAlert severity
statusStringfiring, acknowledged, resolved
startsAtInstantWhen the alert started firing
endsAtInstantWhen the alert was resolved
valuedoubleCurrent metric value
labelsMapAlert labels
annotationsMapAlert annotations

Alert History

Endpoint: GET /api/v1/observability/alerts/history

Returns historical alerts for trend analysis and post-incident review.


Notification Channels

Alerts can be delivered through multiple channels:

ChannelDescription
emailEmail notifications to configured recipients
slackSlack webhook notifications
pagerdutyPagerDuty incident creation
webhookCustom HTTP webhook