Spaces:
Paused
Paused
Download src/models/infrastructure_metric.py from arimatch1/crewhub-api-2: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/spaces/arimatch1/crewhub-api-2/resolve/main/src/models/infrastructure_metric.py
- Command line
-
hf download hf://spaces/arimatch1/crewhub-api-2/src/models/infrastructure_metric.py
-
curl -L -o infrastructure_metric.py https://huggingface.co/spaces/arimatch1/crewhub-api-2/resolve/main/src/models/infrastructure_metric.py
1.13 kB
| # Copyright (c) 2026 CrewHub. All rights reserved. | |
| # Proprietary and confidential. See LICENSE for details. | |
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import DateTime, Float, Index, JSON, String, Uuid, func | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from src.database import Base | |
| class InfrastructureMetric(Base): | |
| __tablename__ = "infrastructure_metrics" | |
| id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4) | |
| collected_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), server_default=func.now(), nullable=False | |
| ) | |
| metric_name: Mapped[str] = mapped_column(String(64), nullable=False) | |
| metric_value: Mapped[float] = mapped_column(Float, nullable=False) | |
| metric_limit: Mapped[float | None] = mapped_column(Float, nullable=True) | |
| metadata_json: Mapped[dict | None] = mapped_column(JSON, nullable=True) | |
| __table_args__ = ( | |
| Index("ix_infra_metrics_name_collected", "metric_name", "collected_at"), | |
| ) | |
| def __repr__(self) -> str: | |
| return f"<InfrastructureMetric({self.metric_name}={self.metric_value})>" | |