File size: 1,744 Bytes
68b32d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import datetime
import uuid
from sqlalchemy import JSON, Boolean, Column, DateTime, Float, String, Text, func

from core.database import Base


# TEMPORARY: Commented out duplicate WorkflowExecutionLog class
# This class is already defined in core/models.py (line 4504)
# SQLAlchemy doesn't allow duplicate class names in the same declarative base
# TODO: Refactor to use single definition or import from core.models
#
# class WorkflowExecutionLog(Base):
#     """
#     Sidecar table for high-volume workflow execution metrics.
#     Decoupled from the main transactional data to allow for aggregation without locking.
#     """
#     __tablename__ = "analytics_workflow_logs"
#
#     id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
#
#     # Core linkage
#     execution_id = Column(String, index=True, nullable=False)
#     workflow_id = Column(String, index=True, nullable=False)
#     step_id = Column(String, index=True, nullable=False)
#     step_type = Column(String, nullable=False)
#
#     # Metrics
#     start_time = Column(DateTime(timezone=True), nullable=False)
#     end_time = Column(DateTime(timezone=True), nullable=False)
#     duration_ms = Column(Float, nullable=False)
#
#     # Outcome
#     status = Column(String, nullable=False) # completed, failed
#     error_code = Column(String, nullable=True)
#
#     # Detailed Data (Nullable to save space/meta only)
#     trigger_data = Column(JSON, nullable=True) # Inputs
#     results = Column(JSON, nullable=True)      # Outputs
#
#     # Lightweight Meta (No heavy inputs/outputs)
#     meta_info = Column(JSON, nullable=True) # { "token_usage": 150, "retries": 1 }
#
#     created_at = Column(DateTime(timezone=True), server_default=func.now())