Class: ElasticAPM::Transport::Serializers::TransactionSerializer Private

Inherits:
Serializer
  • Object
show all
Defined in:
lib/elastic_apm/transport/serializers/transaction_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(transaction) ⇒ 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, Metrics/AbcSize



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

def build(transaction)
  {
    transaction: {
      id: transaction.id,
      trace_id: transaction.trace_id,
      parent_id: transaction.parent_id,
      name: keyword_field(transaction.name),
      type: keyword_field(transaction.type),
      result: keyword_field(transaction.result.to_s),
      duration: ms(transaction.duration),
      timestamp: transaction.timestamp,
      sampled: transaction.sampled?,
      context: context_serializer.build(transaction.context),
      span_count: {
        started: transaction.started_spans,
        dropped: transaction.dropped_spans
      }
    }
  }
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/transaction_serializer.rb', line 8

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