- Added monitoring metrics for project creation success and error handling in `ProjectRepository`. - Implemented similar monitoring for scenario creation in `ScenarioRepository`. - Refactored `run_monte_carlo` function in `simulation.py` to include timing and success/error metrics. - Introduced new CSS styles for headers, alerts, and navigation buttons in `main.css` and `projects.css`. - Created a new JavaScript file for navigation logic to handle chevron buttons. - Updated HTML templates to include new navigation buttons and improved styling for buttons. - Added tests for reporting service and routes to ensure proper functionality and access control. - Removed unused imports and optimized existing test files for better clarity and performance.
38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
"""Add performance_metrics table"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "20251111_01"
|
|
down_revision = "20251111_00"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"performance_metrics",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("timestamp", sa.DateTime(), nullable=True),
|
|
sa.Column("metric_name", sa.String(), nullable=True),
|
|
sa.Column("value", sa.Float(), nullable=True),
|
|
sa.Column("labels", sa.String(), nullable=True),
|
|
sa.Column("endpoint", sa.String(), nullable=True),
|
|
sa.Column("method", sa.String(), nullable=True),
|
|
sa.Column("status_code", sa.Integer(), nullable=True),
|
|
sa.Column("duration_seconds", sa.Float(), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(op.f("ix_performance_metrics_timestamp"), "performance_metrics", ["timestamp"], unique=False)
|
|
op.create_index(op.f("ix_performance_metrics_metric_name"), "performance_metrics", ["metric_name"], unique=False)
|
|
op.create_index(op.f("ix_performance_metrics_endpoint"), "performance_metrics", ["endpoint"], unique=False)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(op.f("ix_performance_metrics_endpoint"), table_name="performance_metrics")
|
|
op.drop_index(op.f("ix_performance_metrics_metric_name"), table_name="performance_metrics")
|
|
op.drop_index(op.f("ix_performance_metrics_timestamp"), table_name="performance_metrics")
|
|
op.drop_table("performance_metrics") |