Class: Eco::API::UseCases::GraphQL::Compat::Parity::Harness::Recorder
- Defined in:
- lib/eco/api/usecases/graphql/compat/parity/harness.rb
Overview
Collects a run's KPIs + per-page update payloads, then bakes a RunResult.
Instance Attribute Summary collapse
-
#kpis ⇒ Object
Returns the value of attribute kpis.
Instance Method Summary collapse
-
#initialize(label) ⇒ Recorder
constructor
A new instance of Recorder.
-
#kpi(name, value) ⇒ Object
Set a single canonical/native KPI counter by name.
-
#record_update(page_id, payload) ⇒ Object
Record what a run WOULD send for
page_id. - #to_run_result ⇒ Object
Constructor Details
#initialize(label) ⇒ Recorder
Returns a new instance of Recorder.
77 78 79 80 81 |
# File 'lib/eco/api/usecases/graphql/compat/parity/harness.rb', line 77 def initialize(label) @label = label @kpis = {} @updates = {} end |
Instance Attribute Details
#kpis ⇒ Object
Returns the value of attribute kpis.
75 76 77 |
# File 'lib/eco/api/usecases/graphql/compat/parity/harness.rb', line 75 def kpis @kpis end |
Instance Method Details
#kpi(name, value) ⇒ Object
Set a single canonical/native KPI counter by name.
91 92 93 94 |
# File 'lib/eco/api/usecases/graphql/compat/parity/harness.rb', line 91 def kpi(name, value) @kpis[name.to_sym] = value self end |
#record_update(page_id, payload) ⇒ Object
Record what a run WOULD send for page_id. Later ids for the same page
overwrite (the last state wins — matching a real save of the final page).
85 86 87 88 |
# File 'lib/eco/api/usecases/graphql/compat/parity/harness.rb', line 85 def record_update(page_id, payload) @updates[page_id.to_s] = payload self end |