Class: Datadog::Tracing::Metadata::Metastruct
- Inherits:
-
Object
- Object
- Datadog::Tracing::Metadata::Metastruct
- Extended by:
- Forwardable
- Defined in:
- lib/datadog/tracing/metadata/metastruct.rb
Overview
This class is a data structure that is used to store complex metadata, such as an array of objects.
It is serialized to MessagePack format when sent to the agent.
Instance Method Summary collapse
-
#initialize ⇒ Metastruct
constructor
A new instance of Metastruct.
- #pretty_print(q) ⇒ Object
- #to_msgpack(packer = nil) ⇒ Object
Constructor Details
#initialize ⇒ Metastruct
Returns a new instance of Metastruct.
17 18 19 |
# File 'lib/datadog/tracing/metadata/metastruct.rb', line 17 def initialize @metastruct = {} end |
Instance Method Details
#pretty_print(q) ⇒ Object
28 29 30 31 32 |
# File 'lib/datadog/tracing/metadata/metastruct.rb', line 28 def pretty_print(q) q.seplist @metastruct.each do |key, value| q.text "#{key} => #{value}" end end |
#to_msgpack(packer = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/datadog/tracing/metadata/metastruct.rb', line 21 def to_msgpack(packer = nil) # JRuby doesn't pass the packer packer ||= MessagePack::Packer.new packer.write(@metastruct.transform_values(&:to_msgpack)) end |