app_invocation_audit.py 1.1 KB

123456789101112131415161718192021
  1. from core_db import AuditMixin, Base, EntityMixin
  2. from sqlalchemy import Integer, String, Text
  3. from sqlalchemy.orm import Mapped, mapped_column
  4. class AppInvocationAudit(EntityMixin, AuditMixin, Base):
  5. __tablename__ = "app_invocation_audit"
  6. app_id: Mapped[str] = mapped_column(String(36), index=True)
  7. api_key_prefix: Mapped[str | None] = mapped_column(String(16), nullable=True)
  8. request_id: Mapped[str] = mapped_column(String(64), index=True)
  9. session_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
  10. run_request_id: Mapped[str | None] = mapped_column(String(36), nullable=True)
  11. target_type: Mapped[str] = mapped_column(String(32))
  12. target_id: Mapped[str] = mapped_column(String(36))
  13. invoke_type: Mapped[str] = mapped_column(String(16))
  14. status: Mapped[str] = mapped_column(String(32), index=True)
  15. duration_ms: Mapped[int] = mapped_column(Integer)
  16. error_code: Mapped[str | None] = mapped_column(String(64), nullable=True)
  17. error_message: Mapped[str | None] = mapped_column(Text, nullable=True)
  18. client_metadata_json: Mapped[str | None] = mapped_column(Text, nullable=True)