Class: Karafka::Web::Tracking::Helpers::Ttls::Windows

Inherits:
Struct
  • Object
show all
Defined in:
lib/karafka/web/tracking/helpers/ttls/windows.rb

Overview

Object used to track process metrics in time windows. Those are shared, meaning they do not refer to particular metric type but allow us to store whatever we want.

We have following time windows: - m1 - one minute big - m5 - five minute big

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTtls::Windows



16
17
18
19
20
21
# File 'lib/karafka/web/tracking/helpers/ttls/windows.rb', line 16

def initialize
  super(
    Ttls::Hash.new(60 * 1_000),
    Ttls::Hash.new(5 * 60 * 1_000)
  )
end

Instance Attribute Details

#m1Object

Returns the value of attribute m1

Returns:

  • (Object)

    the current value of m1



14
15
16
# File 'lib/karafka/web/tracking/helpers/ttls/windows.rb', line 14

def m1
  @m1
end

#m5Object

Returns the value of attribute m5

Returns:

  • (Object)

    the current value of m5



14
15
16
# File 'lib/karafka/web/tracking/helpers/ttls/windows.rb', line 14

def m5
  @m5
end

Instance Method Details

#clearObject

Clears the TTLs windows



24
25
26
# File 'lib/karafka/web/tracking/helpers/ttls/windows.rb', line 24

def clear
  values.each(&:clear)
end