-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysis.py
More file actions
81 lines (69 loc) · 2.46 KB
/
analysis.py
File metadata and controls
81 lines (69 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"""
Analysis report response models.
Copyright (c) 2026 Stefan Kumarasinghe.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. See http://www.apache.org/licenses/LICENSE-2.0 for details.
"""
from __future__ import annotations
from pydantic import Field
from engine.causal.bayesian import BayesianScore
from engine.causal.granger import GrangerResult
from engine.changepoint.cusum import ChangePoint
from engine.correlation.signals import LogMetricLink
from engine.enums import Severity
from engine.forecast.degradation import DegradationSignal
from engine.forecast.trajectory import TrajectoryForecast
from engine.ml.clustering import AnomalyCluster
from engine.ml.ranking import RankedCause
from .anomalies import MetricAnomaly
from .base import NpModel
from .logs import LogBurst, LogPattern
from .rca import RootCause
from .slo import SloBurnAlert
from .traces import ErrorPropagation, ServiceLatency
class MetricSeriesDistributionStats(NpModel):
series_key: str = ""
metric_name: str
sample_count: int
mean: float
std: float
min: float
max: float
median: float
q1: float
q3: float
iqr: float
mad: float
skewness: float
kurtosis: float
coefficient_of_variation: float
class AnalysisQuality(NpModel):
anomaly_density: dict[str, float] = Field(default_factory=dict)
suppression_counts: dict[str, int] = Field(default_factory=dict)
gating_profile: str
confidence_calibration_version: str
class AnalysisReport(NpModel):
tenant_id: str
start: int
end: int
duration_seconds: int
metric_anomalies: list[MetricAnomaly]
log_bursts: list[LogBurst]
log_patterns: list[LogPattern]
service_latency: list[ServiceLatency]
error_propagation: list[ErrorPropagation]
slo_alerts: list[SloBurnAlert] = []
root_causes: list[RootCause]
ranked_causes: list[RankedCause] = []
change_points: list[ChangePoint] = []
log_metric_links: list[LogMetricLink] = []
forecasts: list[TrajectoryForecast] = []
degradation_signals: list[DegradationSignal] = []
anomaly_clusters: list[AnomalyCluster] = []
granger_results: list[GrangerResult] = []
bayesian_scores: list[BayesianScore] = []
analysis_warnings: list[str] = []
overall_severity: Severity
summary: str
quality: AnalysisQuality | None = None
metric_series_statistics: list[MetricSeriesDistributionStats] = Field(default_factory=list)