Implement comprehensive monitoring and observability features for Vibe Piper pipelines
Implement metrics collection, logging, error tracking, health checks, and profiling for pipeline observability.
src/vibe_piper/ package structuremkdir -p src/vibe_piper/monitoring
MetricType enum (COUNTER, GAUGE, HISTOGRAM, TIMER, SUMMARY)Metric dataclass (name, value, type, timestamp, labels, unit)MetricsSnapshot dataclass with filtering methodsMetricsCollector class with:start_execution() / end_execution() for pipeline-level metricsrecord_metric() for custom metricsrecord_asset_execution() for AssetResult integrationrecord_execution_result() for ExecutionResult integrationget_snapshot() / to_dict() for export_lockLogLevel enum (TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL)JSONFormatter for machine-parsable logsColoredFormatter for console outputStructuredLogger wrapper with context supportlog_execution() context manager for pipeline tracingconfigure_logging() for setupHealthStatus enum (HEALTHY, DEGRADED, UNHEALTHY, UNKNOWN)HealthCheckResult dataclassHealthChecker class with:register_check() / unregister_check() for dynamic checksrun_check() / run_all_checks() for executionget_overall_health() for aggregate statuscreate_disk_space_check(), create_memory_check()ErrorSeverity enum (LOW, MEDIUM, HIGH, CRITICAL)ErrorCategory enum (VALIDATION, CONNECTION, TRANSFORMATION, IO, TIMEOUT, SYSTEM, UNKNOWN)ErrorRecord dataclass with aggregation supportErrorAggregator class with:add_error() for recording errorsget_summary() for analyticsProfileData dataclassProfiler class with:@profile decoratorget_stats() / get_history() for analysisprofile_execution() context manager# Edit src/vibe_piper/__init__.py
# Add monitoring imports to __all__
uv run mypy src/vibe_piper/monitoring/
uv run ruff check src/vibe_piper/monitoring/ --fix
uv run ruff format src/vibe_piper/monitoring/
mkdir -p tests/monitoring
Create tests for:
test_metrics.py: MetricsCollector, MetricsSnapshot, Metrictest_logging.py: LogLevel, formatters, StructuredLogger, log_executiontest_health.py: HealthChecker, health check functionstest_errors.py: ErrorAggregator, ErrorRecordtest_profiling.py: Profiler, ProfileDatarecord_execution_result()get_logger()from vibe_piper.monitoring import (
MetricsCollector,
StructuredLogger,
HealthChecker,
ErrorAggregator,
configure_logging,
)
# Configure logging
configure_logging(level=LogLevel.INFO, format_type="json")
# Collect metrics
metrics = MetricsCollector()
metrics.start_execution("my_pipeline", "run_123")
metrics.record_metric("custom_metric", 42)
metrics.end_execution()
# Health checks
health_checker = HealthChecker()
health_checker.register_check("disk", create_disk_space_check("/tmp"))
results = health_checker.run_all_checks()
type: ignore[import-untyped] for untyped depsdatetime.utcnow()uv run pytest tests/monitoring/ -v
uv run mypy src/vibe_piper/monitoring/ strict
This section is preserved when the skill is updated. Put human notes, caveats, and exceptions here.