Class: ElasticAPM::Transport::Serializers::Container Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/transport/serializers.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 collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Container

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 Container.



68
69
70
71
72
73
74
# File 'lib/elastic_apm/transport/serializers.rb', line 68

def initialize(config)
  @transaction = Serializers::TransactionSerializer.new(config)
  @span = Serializers::SpanSerializer.new(config)
  @error = Serializers::ErrorSerializer.new(config)
  @metadata = Serializers::MetadataSerializer.new(config)
  @metricset = Serializers::MetricsetSerializer.new(config)
end

Instance Attribute Details

#errorObject (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.



76
77
78
# File 'lib/elastic_apm/transport/serializers.rb', line 76

def error
  @error
end

#metadataObject (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.



76
77
78
# File 'lib/elastic_apm/transport/serializers.rb', line 76

def 
  @metadata
end

#metricsetObject (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.



76
77
78
# File 'lib/elastic_apm/transport/serializers.rb', line 76

def metricset
  @metricset
end

#spanObject (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.



76
77
78
# File 'lib/elastic_apm/transport/serializers.rb', line 76

def span
  @span
end

#transactionObject (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.



76
77
78
# File 'lib/elastic_apm/transport/serializers.rb', line 76

def transaction
  @transaction
end

Instance Method Details

#serialize(resource) ⇒ 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.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/elastic_apm/transport/serializers.rb', line 78

def serialize(resource)
  case resource
  when Transaction
    transaction.build(resource)
  when Span
    span.build(resource)
  when Error
    error.build(resource)
  when Metricset
    metricset.build(resource)
  when Metadata
    .build(resource)
  else
    raise UnrecognizedResource, resource.inspect
  end
end