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

Anomaly Detection

The AnomalyDetectionController provides ML-based anomaly detection for metrics, logs, and traces. It identifies unusual patterns that may indicate performance degradation, security incidents, or infrastructure issues.


Anomaly Detection Configuration

AnomalyDetectionConfig Structure

FieldTypeDescription
idStringConfiguration identifier
nameStringDetection rule name
metricQueryStringPromQL query to monitor
algorithmStringDetection algorithm (zscore, mad, isolation_forest)
sensitivitydoubleSensitivity threshold (0.0 to 1.0)
trainingWindowStringHistorical window for baseline (e.g., 7d, 30d)
evaluationIntervalStringHow often to evaluate (e.g., 5m, 1h)
enabledbooleanWhether detection is active

Configure Detection

Endpoint: POST /api/v1/observability/anomalies/configs

curl -X POST http://localhost:8088/api/v1/observability/anomalies/configs \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "X-Tenant-ID: 550e8400" \
  -d '{
    "name": "API Latency Anomaly",
    "metricQuery": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))",
    "algorithm": "zscore",
    "sensitivity": 0.8,
    "trainingWindow": "14d",
    "evaluationInterval": "5m"
  }'

List Configurations

Endpoint: GET /api/v1/observability/anomalies/configs


Active Anomalies

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

Returns currently detected anomalies.

Anomaly Structure

FieldTypeDescription
idStringAnomaly identifier
configNameStringDetection config that found this
metricNameStringAffected metric
severityStringlow, medium, high, critical
scoredoubleAnomaly score (higher is more anomalous)
expectedValuedoubleWhat the model expected
actualValuedoubleWhat was observed
detectedAtInstantWhen the anomaly was detected
statusStringactive, acknowledged, resolved

Anomaly Reports

Endpoint: GET /api/v1/observability/anomalies/report

AnomalyReport Structure

FieldTypeDescription
periodStringReport time period
totalAnomaliesintTotal anomalies detected
bySeverityMapAnomaly count by severity
byMetricMapAnomaly count by metric
topAnomaliesListMost significant anomalies
trendStringincreasing, stable, decreasing

Detection Algorithms

AlgorithmDescriptionBest For
zscoreStandard deviation from meanNormally distributed metrics
madMedian Absolute DeviationMetrics with outliers
isolation_forestEnsemble-based isolationMulti-dimensional anomalies