Class: ElasticAPM::Transport::Serializers::SpanSerializer Private
- Inherits:
-
Serializer
- Object
- Serializer
- ElasticAPM::Transport::Serializers::SpanSerializer
- Defined in:
- lib/elastic_apm/transport/serializers/span_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.
Defined Under Namespace
Classes: ContextSerializer
Instance Attribute Summary collapse
- #context_serializer ⇒ Object readonly private
Attributes inherited from Serializer
Instance Method Summary collapse
-
#build(span) ⇒ Object
private
rubocop:disable Metrics/MethodLength, Metrics/AbcSize.
-
#initialize(config) ⇒ SpanSerializer
constructor
private
A new instance of SpanSerializer.
Constructor Details
#initialize(config) ⇒ SpanSerializer
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.
Returns a new instance of SpanSerializer.
8 9 10 11 12 |
# File 'lib/elastic_apm/transport/serializers/span_serializer.rb', line 8 def initialize(config) super @context_serializer = ContextSerializer.new(config) end |
Instance Attribute Details
#context_serializer ⇒ Object (readonly)
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.
14 15 16 |
# File 'lib/elastic_apm/transport/serializers/span_serializer.rb', line 14 def context_serializer @context_serializer end |
Instance Method Details
#build(span) ⇒ 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
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/elastic_apm/transport/serializers/span_serializer.rb', line 17 def build(span) { span: { id: span.id, transaction_id: span.transaction_id, parent_id: span.parent_id, name: keyword_field(span.name), type: keyword_field(span.type), duration: ms(span.duration), context: context_serializer.build(span.context), stacktrace: span.stacktrace.to_a, timestamp: span., trace_id: span.trace_id } } end |