Class: Sidekiq::Metrics::Query::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/sidekiq/metrics/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



86
87
88
89
90
91
# File 'lib/sidekiq/metrics/query.rb', line 86

def initialize
  super
  self.buckets = []
  self.marks = []
  self.job_results = Hash.new { |h, k| h[k] = JobResult.new }
end

Instance Attribute Details

#bucketsObject

Returns the value of attribute buckets

Returns:

  • (Object)

    the current value of buckets



85
86
87
# File 'lib/sidekiq/metrics/query.rb', line 85

def buckets
  @buckets
end

#ends_atObject

Returns the value of attribute ends_at

Returns:

  • (Object)

    the current value of ends_at



85
86
87
# File 'lib/sidekiq/metrics/query.rb', line 85

def ends_at
  @ends_at
end

#job_resultsObject

Returns the value of attribute job_results

Returns:

  • (Object)

    the current value of job_results



85
86
87
# File 'lib/sidekiq/metrics/query.rb', line 85

def job_results
  @job_results
end

#marksObject

Returns the value of attribute marks

Returns:

  • (Object)

    the current value of marks



85
86
87
# File 'lib/sidekiq/metrics/query.rb', line 85

def marks
  @marks
end

#sizeObject

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



85
86
87
# File 'lib/sidekiq/metrics/query.rb', line 85

def size
  @size
end

#starts_atObject

Returns the value of attribute starts_at

Returns:

  • (Object)

    the current value of starts_at



85
86
87
# File 'lib/sidekiq/metrics/query.rb', line 85

def starts_at
  @starts_at
end

Instance Method Details

#prepend_bucket(time) ⇒ Object



93
94
95
96
97
# File 'lib/sidekiq/metrics/query.rb', line 93

def prepend_bucket(time)
  buckets.unshift time.strftime("%H:%M")
  self.ends_at ||= time
  self.starts_at = time
end