Information about the CPU usage.
| 34 | |
| 35 | |
| 36 | class CpuInfo(BaseModel): |
| 37 | """Information about the CPU usage.""" |
| 38 | |
| 39 | model_config = ConfigDict(validate_by_name=True, validate_by_alias=True) |
| 40 | |
| 41 | used_ratio: Annotated[float, Field(alias='usedRatio')] |
| 42 | """The ratio of CPU currently in use, represented as a float between 0 and 1.""" |
| 43 | |
| 44 | # Workaround for Pydantic and type checkers when using Annotated with default_factory |
| 45 | if TYPE_CHECKING: |
| 46 | created_at: datetime = datetime.now(timezone.utc) |
| 47 | """The time at which the measurement was taken.""" |
| 48 | else: |
| 49 | created_at: Annotated[ |
| 50 | datetime, |
| 51 | Field( |
| 52 | alias='createdAt', |
| 53 | default_factory=lambda: datetime.now(timezone.utc), |
| 54 | ), |
| 55 | ] |
| 56 | """The time at which the measurement was taken.""" |
| 57 | |
| 58 | |
| 59 | class MemoryUsageInfo(BaseModel): |
no outgoing calls