pulsemesh-open-telemetry-vi.../src/pulsemesh_open_telemetry_vi.../anomaly.py

21 lines
397 B
Python

from __future__ import annotations
from dataclasses import dataclass, asdict
from typing import Dict, Any
import json
@dataclass
class AnomalySignal:
timestamp: float
anomaly_type: str
location: str
severity: str
confidence: float
def to_dict(self) -> Dict[str, Any]:
return asdict(self)
def to_json(self) -> str:
return json.dumps(self.to_dict())