lib/karafka/web/tracking/consumers/contracts/job.rb in karafka-web-0.5.2 vs lib/karafka/web/tracking/consumers/contracts/job.rb in karafka-web-0.6.0
- old
+ new
@@ -4,11 +4,11 @@
module Web
module Tracking
module Consumers
module Contracts
# Contract for the job reporting details
- class Job < BaseContract
+ class Job < Tracking::Contracts::Base
configure
required(:consumer) { |val| val.is_a?(String) }
required(:consumer_group) { |val| val.is_a?(String) }
required(:started_at) { |val| val.is_a?(Float) && val >= 0 }
@@ -17,9 +17,12 @@
required(:first_offset) { |val| val.is_a?(Integer) && (val >= 0 || val == -1001) }
required(:last_offset) { |val| val.is_a?(Integer) && (val >= 0 || val == -1001) }
required(:committed_offset) { |val| val.is_a?(Integer) }
required(:type) { |val| %w[consume revoked shutdown].include?(val) }
required(:tags) { |val| val.is_a?(Karafka::Core::Taggable::Tags) }
+ # -1 can be here for workless flows
+ required(:consumption_lag) { |val| val.is_a?(Integer) && (val >= 0 || val == -1) }
+ required(:processing_lag) { |val| val.is_a?(Integer) && (val >= 0 || val == -1) }
end
end
end
end
end