From 8a4c1ec07e0658f97d3c396d2d3ea7118150f1d3 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 13 Mar 2026 12:24:21 +0530 Subject: [PATCH] chore: add comments --- app/services/reporting_events/metric_registry.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/services/reporting_events/metric_registry.rb b/app/services/reporting_events/metric_registry.rb index d0e981a89..7a2712824 100644 --- a/app/services/reporting_events/metric_registry.rb +++ b/app/services/reporting_events/metric_registry.rb @@ -1,5 +1,7 @@ # Raw reporting events and rollup rows do not share a single metric namespace; this registry keeps write and read paths aligned. +# TODO: Split this into separate registries for raw event mappings and report metric definitions. module ReportingEvents::MetricRegistry + # Maps report summary response keys to the metric definitions they read from. SUMMARY_METRICS = { resolutions_count: :resolved_conversations_count, avg_resolution_time: :avg_resolution_time, @@ -7,6 +9,7 @@ module ReportingEvents::MetricRegistry reply_time: :avg_reply_time }.freeze + # Expands each raw reporting event into the rollup metric payloads persisted for aggregation. EVENT_METRICS = { 'conversation_resolved' => lambda do |values| { @@ -20,6 +23,7 @@ module ReportingEvents::MetricRegistry 'conversation_bot_handoff' => ->(values) { { bot_handoffs_count: count_metric(values[:count]) } } }.freeze + # Describes which report metrics are supported and how each one is sourced and aggregated. REPORT_METRICS = { conversations_count: { aggregate: :count }.freeze, incoming_messages_count: { aggregate: :count }.freeze,