File size: 4,537 Bytes
44067ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946b940
44067ef
 
 
946b940
44067ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# schemas/schemas.py
# Схемы для валидации выходных данных агентов анализа логов

parser_schema = {
    "type": "object",
    "properties": {
        "events": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "line_number": {"type": "integer"},
                    "timestamp": {"type": ["string", "null"]},
                    "level": {"type": "string"},
                    "message": {"type": "string"},
                    "type": {"type": "string"}
                },
                "required": ["line_number", "level", "message"]
            }
        },
        "errors": {
            "type": "array",
            "items": {"type": ["object", "string"]}
        },
        "warnings": {
            "type": "array",
            "items": {"type": ["object", "string"]}
        },
        "statistics": {
            "type": "object",
            "properties": {
                "total_lines": {"type": "integer"},
                "parsed_events": {"type": "integer"},
                "errors": {"type": "integer"},
                "warnings": {"type": "integer"},
                "info_messages": {"type": "integer"},
                "event_types": {"type": "object"},
                "time_range": {
                    "type": ["object", "null"],
                    "properties": {
                        "start": {"type": ["string", "null"]},
                        "end": {"type": ["string", "null"]}
                    }
                }
            },
            "required": ["total_lines", "parsed_events", "errors", "warnings"]
        }
    },
    "required": ["events", "errors", "warnings", "statistics"]
}

anomaly_schema = {
    "type": "object",
    "properties": {
        "anomalies": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "type": {"type": "string"},
                    "severity": {"type": "string"},
                    "description": {"type": "string"},
                    "count": {"type": ["integer", "null"]},
                    "error_message": {"type": ["string", "null"]},
                    "metadata": {"type": ["object", "null"]}
                },
                "required": ["type", "severity", "description"]
            }
        },
        "statistics": {
            "type": "object",
            "properties": {
                "total": {"type": "integer"},
                "by_type": {"type": "object"},
                "by_severity": {"type": "object"}
            }
        },
        "severity_summary": {"type": "object"}
    },
    "required": ["anomalies", "statistics", "severity_summary"]
}

rca_schema = {
    "type": "object",
    "properties": {
        "analysis": {
            "type": "object",
            "properties": {
                "root_causes": {
                    "type": "array",
                    "items": {"type": "string"}
                },
                "details": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "anomaly_type": {"type": "string"},
                            "severity": {"type": "string"},
                            "description": {"type": "string"},
                            "possible_causes": {
                                "type": "array",
                                "items": {"type": "string"}
                            }
                        }
                    }
                }
            }
        },
        "recommendations": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "priority": {"type": "string"},
                    "text": {"type": "string"},
                    "actions": {
                        "type": "array",
                        "items": {"type": "string"}
                    }
                },
                "required": ["priority", "text"]
            }
        },
        "general_recommendations": {
            "type": "array",
            "items": {"type": "string"}
        }
    },
    "required": ["analysis", "recommendations", "general_recommendations"]
}