class Periskop::Client::ExceptionWithContext
ExceptionWithContext
represents a reported exception with HTTP context
Constants
- MAX_TRACES
- NUM_HASH_CHARS
Attributes
exception_instance[RW]
http_context[RW]
Public Class Methods
new(exception_instance, http_context, severity)
click to toggle source
# File lib/periskop/client/models.rb, line 94 def initialize(exception_instance, http_context, severity) @exception_instance = exception_instance @http_context = http_context @severity = severity @uuid = SecureRandom.uuid @timestamp = Time.now.utc.iso8601 end
Public Instance Methods
aggregation_key()
click to toggle source
Generates the aggregation key with a hash using the last MAX_TRACES
# File lib/periskop/client/models.rb, line 103 def aggregation_key stacktrace_head = @exception_instance.stacktrace.first(MAX_TRACES).join('') error_hash = Digest::MD5.hexdigest(stacktrace_head)[0..NUM_HASH_CHARS - 1] "#{@exception_instance.class}@#{error_hash}" end
as_json(_options = {})
click to toggle source
# File lib/periskop/client/models.rb, line 109 def as_json(_options = {}) { error: @exception_instance, http_context: @http_context, severity: @severity, uuid: @uuid, timestamp: @timestamp } end
to_json(*options)
click to toggle source
# File lib/periskop/client/models.rb, line 119 def to_json(*options) as_json(*options).to_json(*options) end