Class: AnalyticsOps::Health::Runner
- Inherits:
-
Object
- Object
- AnalyticsOps::Health::Runner
- Defined in:
- lib/analytics_ops/health.rb,
sig/analytics_ops.rbs
Overview
Evaluates bounded report results and configuration drift.
Instance Method Summary collapse
- #call ⇒ Result
-
#initialize(desired_state:, reports:, plan:, date_ranges:) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(desired_state:, reports:, plan:, date_ranges:) ⇒ Runner
Returns a new instance of Runner.
99 100 101 102 103 104 105 |
# File 'lib/analytics_ops/health.rb', line 99 def initialize(desired_state:, reports:, plan:, date_ranges:) @desired_state = desired_state @reports = reports @plan = plan @date_ranges = date_ranges @settings = DEFAULTS.merge(desired_state.health || {}) end |
Instance Method Details
#call ⇒ Result
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/analytics_ops/health.rb', line 107 def call validate_inputs! findings = [] totals = period_totals findings.concat(traffic_findings(totals)) findings.concat(acquisition_findings(totals)) findings.concat(expected_event_findings) findings.concat() findings.concat(drift_findings) if findings.empty? findings << Finding.new( severity: "ok", code: "checks_passed", message: "No configured analytics health problem was detected", actual: nil, expected: nil ) end Result.new( profile: @desired_state.profile, property_id: @desired_state.property_id, date_ranges: @date_ranges, findings:, summary: { "current" => totals.fetch("current"), "previous" => totals.fetch("previous") } ) end |