feat: troppa roba davvero
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class HealthCheckEntry(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
target: str = Field(..., description="Logical target name")
|
||||
host: str = Field(..., description="Resolved host checked at runtime")
|
||||
port: int = Field(..., description="Resolved port checked at runtime")
|
||||
protocol: str = Field(..., description="Protocol used for the check")
|
||||
healthy: bool = Field(..., description="Whether the check succeeded")
|
||||
error: str | None = Field(default=None, description="Optional failure reason")
|
||||
duration_ms: float | None = Field(
|
||||
default=None,
|
||||
description=(
|
||||
"Measured response latency in milliseconds when benchmarking "
|
||||
"is enabled"
|
||||
),
|
||||
)
|
||||
details: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class HealthSnapshot(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
proxy_port: int = Field(..., description="Proxy port this snapshot belongs to")
|
||||
timestamp: datetime = Field(..., description="When the snapshot was produced")
|
||||
enabled: bool = Field(..., description="Whether healthchecks are enabled")
|
||||
overall: str = Field(..., description="Overall health status")
|
||||
checks: list[HealthCheckEntry] = Field(default_factory=list)
|
||||
|
||||
|
||||
class HealthHistoryResponse(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
proxy_port: int
|
||||
latest: HealthSnapshot | None = None
|
||||
history: list[HealthSnapshot] = Field(default_factory=list)
|
||||
Reference in New Issue
Block a user