class Periskop::Client::AggregatedException

AggregatedException represents the aggregation of a group of exceptions

Constants

MAX_ERRORS

Attributes

latest_errors[RW]
total_count[RW]

Public Class Methods

new(aggregation_key, severity) click to toggle source
# File lib/periskop/client/models.rb, line 130
def initialize(aggregation_key, severity)
  @aggregation_key = aggregation_key
  @latest_errors = []
  @total_count = 0
  @severity = severity
  @created_at = Time.now.utc.iso8601
end

Public Instance Methods

add_exception(exception_with_context) click to toggle source

Add exception to the list of latest errors up to MAX_ERRORS

# File lib/periskop/client/models.rb, line 139
def add_exception(exception_with_context)
  if @latest_errors.size >= MAX_ERRORS
    @latest_errors.shift
  end
  @latest_errors.push(exception_with_context)
  @total_count += 1
end
as_json(_options = {}) click to toggle source
# File lib/periskop/client/models.rb, line 147
def as_json(_options = {})
  {
    aggregation_key: @aggregation_key,
    created_at: @created_at,
    total_count: @total_count,
    severity: @severity,
    latest_errors: @latest_errors
  }
end
to_json(*options) click to toggle source
# File lib/periskop/client/models.rb, line 157
def to_json(*options)
  as_json(*options).to_json(*options)
end