Class: ElasticAPM::Transport::Serializers::ErrorSerializer Private

Inherits:
Serializer
  • Object
show all
Defined in:
lib/elastic_apm/transport/serializers/error_serializer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Serializer

#config

Instance Method Summary collapse

Methods inherited from Serializer

#initialize

Constructor Details

This class inherits a constructor from ElasticAPM::Transport::Serializers::Serializer

Instance Method Details

#build(error) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Metrics/MethodLength



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elastic_apm/transport/serializers/error_serializer.rb', line 13

def build(error)
  base = {
    id: error.id,
    transaction_id: error.transaction_id,
    transaction: error.transaction,
    trace_id: error.trace_id,
    parent_id: error.parent_id,

    culprit: error.culprit,
    timestamp: error.timestamp,
    context: context_serializer.build(error.context)
  }

  if (exception = error.exception)
    base[:exception] = build_exception exception
  end

  if (log = error.log)
    base[:log] = build_log log
  end

  { error: base }
end

#context_serializerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/elastic_apm/transport/serializers/error_serializer.rb', line 8

def context_serializer
  @context_serializer ||= ContextSerializer.new(config)
end