Class: XRay::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-xray-sdk/model/metadata.rb

Overview

Metadata are key-value pairs with values of any type, including objects and lists, but that are not indexed. Use metadata to record data you want to store in the trace but don’t need to use for searching traces.

Instance Method Summary collapse

Constructor Details

#initialize(entity) ⇒ Metadata

Returns a new instance of Metadata.



9
10
11
12
# File 'lib/aws-xray-sdk/model/metadata.rb', line 9

def initialize(entity)
  @data = {}
  @entity = entity
end

Instance Method Details

#sub_meta(namespace) ⇒ Object



14
15
16
17
# File 'lib/aws-xray-sdk/model/metadata.rb', line 14

def sub_meta(namespace)
  @data[namespace] = SubMeta.new(@entity) unless @data[namespace]
  @data[namespace]
end

#to_hObject



19
20
21
22
23
24
25
# File 'lib/aws-xray-sdk/model/metadata.rb', line 19

def to_h
  @data.keys.each_with_object({}) do |key, h|
    h[key] = @data[key].to_h
    h
  end

end