Class: Karafka::Web::Ui::Models::Status::Checks::MaterializingLag
- Defined in:
- lib/karafka/web/ui/models/status/checks/materializing_lag.rb
Overview
Note:
Since both states and metrics are reported together, checking one of them is sufficient.
Checks if there is significant lag in the reporting of aggregated data.
If there’s a large gap between when data is reported and when it’s materialized, the Web UI will show stale information. This often indicates over-saturation on the consumer that materializes states.
The maximum acceptable lag is twice the tracking interval.
Class Method Summary collapse
-
.halted_details ⇒ Hash
Details with zero lag for halted state.
Instance Method Summary collapse
-
#call ⇒ Status::Step
Executes the materializing lag check.
Methods inherited from Base
depends_on, independent!, independent?, #initialize
Constructor Details
This class inherits a constructor from Karafka::Web::Ui::Models::Status::Checks::Base
Class Method Details
Instance Method Details
#call ⇒ Status::Step
Executes the materializing lag check.
Compares the current state’s dispatch time with the current time.
35 36 37 38 39 40 41 42 |
# File 'lib/karafka/web/ui/models/status/checks/materializing_lag.rb', line 35 def call max_lag = (Web.config.tracking.interval * 2) / 1_000 lag = Time.now.to_f - context.current_state.dispatched_at status = (lag > max_lag) ? :failure : :success step(status, { lag: lag, max_lag: max_lag }) end |