| 123456789101112131415161718192021222324 |
- from datetime import datetime
- from core_db import AuditMixin, Base, EntityMixin, VersionMixin
- from core_shared import JSONValue
- from sqlalchemy import DateTime, Integer, String, Text
- from sqlalchemy.dialects.sqlite import JSON
- from sqlalchemy.orm import Mapped, mapped_column
- class TraceSpan(EntityMixin, AuditMixin, VersionMixin, Base):
- __tablename__ = "trace_span"
- run_id: Mapped[str] = mapped_column(String(36), index=True)
- node_run_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
- parent_span_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
- span_type: Mapped[str] = mapped_column(String(64), index=True)
- name: Mapped[str] = mapped_column(String(128))
- status: Mapped[str] = mapped_column(String(32), default="running", index=True)
- started_time: Mapped[datetime] = mapped_column(DateTime)
- ended_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
- duration_ms: Mapped[int | None] = mapped_column(Integer, nullable=True)
- attributes_json: Mapped[dict[str, JSONValue] | None] = mapped_column(JSON, nullable=True)
- error_code: Mapped[str | None] = mapped_column(String(64), nullable=True)
- error_message: Mapped[str | None] = mapped_column(Text, nullable=True)
|