Module: PartnerService::Reservations::Exports::ProgressTracker::PerformanceMonitor
- Defined in:
- app/services/partner_service/reservations/exports/progress_tracker.rb
Overview
Performance monitoring for export operations
Instance Method Summary collapse
-
#track_phase_performance(phase, start_time, end_time, additional_metrics = {}) ⇒ Object
Track performance metrics for export phases.
-
#track_throughput(items_processed, duration_seconds, item_type = 'items') ⇒ Object
Calculate and log throughput metrics.
Instance Method Details
#track_phase_performance(phase, start_time, end_time, additional_metrics = {}) ⇒ Object
Track performance metrics for export phases
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'app/services/partner_service/reservations/exports/progress_tracker.rb', line 107 def track_phase_performance(phase, start_time, end_time, additional_metrics = {}) duration = end_time - start_time metrics = { phase: phase.to_s, duration_seconds: duration.round(3), start_time: start_time.iso8601, end_time: end_time.iso8601, }.merge(additional_metrics) # Log performance metrics BUSINESS_LOGGER.info('Export phase performance', { attachment_id: @export_tracker&.&.id, restaurant_id: @export_tracker&.&.restaurant_id, report_type: @export_tracker&.&.report_type, }.merge(metrics)) # Store metrics for analysis store_performance_metrics(metrics) end |
#track_throughput(items_processed, duration_seconds, item_type = 'items') ⇒ Object
Calculate and log throughput metrics
133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'app/services/partner_service/reservations/exports/progress_tracker.rb', line 133 def track_throughput(items_processed, duration_seconds, item_type = 'items') return if duration_seconds <= 0 throughput = items_processed / duration_seconds BUSINESS_LOGGER.info('Export throughput', { attachment_id: @export_tracker&.&.id, items_processed: items_processed, duration_seconds: duration_seconds.round(3), throughput_per_second: throughput.round(2), item_type: item_type, }) end |