Class: ElasticAPM::Transport::Serializers::SpanSerializer::ContextSerializer Private

Inherits:
ElasticAPM::Transport::Serializers::Serializer show all
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.

Instance Attribute Summary

Attributes inherited from ElasticAPM::Transport::Serializers::Serializer

#config

Instance Method Summary collapse

Methods inherited from ElasticAPM::Transport::Serializers::Serializer

#initialize

Constructor Details

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

Instance Method Details

#build(context) ⇒ 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.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/elastic_apm/transport/serializers/span_serializer.rb', line 54

def build(context)
  return unless context

  base = {}

  base[:tags] = mixed_object(context.labels) if context.labels.any?
  base[:sync] = context.sync unless context.sync.nil?
  base[:db] = build_db(context.db) if context.db
  base[:http] = build_http(context.http) if context.http

  if context.destination
    base[:destination] = build_destination(context.destination)
  end

  if context.message
    base[:message] = build_message(context.message)
  end

  if context.service
    base[:service] = build_service(context.service)
  end

  if context.links && !context.links.empty?
    base[:links] = build_links(context.links)
  end

  base
end