Class: Sqreen::Ecosystem::Tracing::Sampler::MaxDurationMinutesPrimitive

Inherits:
Object
  • Object
show all
Defined in:
lib/sqreen/ecosystem/tracing/sampler.rb

Instance Method Summary collapse

Constructor Details

#initialize(time_in_minutes) ⇒ MaxDurationMinutesPrimitive

Returns a new instance of MaxDurationMinutesPrimitive.



93
94
95
96
# File 'lib/sqreen/ecosystem/tracing/sampler.rb', line 93

def initialize(time_in_minutes)
  @deadline = Sqreen.time + time_in_minutes * 60
  @passed = false # no locking needed
end

Instance Method Details

#triggers?Boolean

Returns:

  • (Boolean)


98
99
100
101
102
103
104
105
# File 'lib/sqreen/ecosystem/tracing/sampler.rb', line 98

def triggers?
  return false if @passed
  if Sqreen.time > @deadline
    @passed = true
    return false
  end
  true
end