Sha256: 36e74a1b805651b0e692421cdade3e0c2eff923e22a8f6a4ec333940de2a6002
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module ElasticAPM module Serializers # @api private class Errors < Serializer # rubocop:disable Metrics/MethodLength def build(error) base = { id: error.id, culprit: error.culprit, timestamp: micros_to_time(error.timestamp).utc.iso8601, context: error.context.to_h } if (exception = error.exception) base[:exception] = build_exception exception end if (transaction_id = error.transaction_id) base[:transaction] = { id: transaction_id } end base end # rubocop:enable Metrics/MethodLength def build_all(errors) { errors: Array(errors).map(&method(:build)) } end private def build_exception(exception) { message: exception.message, type: exception.type, module: exception.module, code: exception.code, attributes: exception.attributes, stacktrace: exception.stacktrace.to_a, handled: exception.handled } end end end end
Version data entries
7 entries across 7 versions & 1 rubygems