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.



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

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



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

def buckets
  @buckets
end

#ends_atObject

Returns the value of attribute ends_at

Returns:

  • (Object)

    the current value of ends_at



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

def ends_at
  @ends_at
end

#job_resultsObject

Returns the value of attribute job_results

Returns:

  • (Object)

    the current value of job_results



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

def job_results
  @job_results
end

#marksObject

Returns the value of attribute marks

Returns:

  • (Object)

    the current value of marks



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

def marks
  @marks
end

#sizeObject

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



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

def size
  @size
end

#starts_atObject

Returns the value of attribute starts_at

Returns:

  • (Object)

    the current value of starts_at



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

def starts_at
  @starts_at
end

Instance Method Details

#prepend_bucket(time) ⇒ Object



95
96
97
98
99
# File 'lib/sidekiq/metrics/query.rb', line 95

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