Class: XRay::Annotations
- Inherits:
-
Object
- Object
- XRay::Annotations
- Includes:
- Logging
- Defined in:
- lib/aws-xray-sdk/model/annotations.rb
Overview
Annotations are simple key-value pairs that are indexed for use with filter expressions. Use annotations to record data that you want to use to group traces in the console, or when calling the GetTraceSummaries API.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(k, v) ⇒ Object
-
#initialize(entity) ⇒ Annotations
constructor
A new instance of Annotations.
- #to_h ⇒ Object
- #update(h) ⇒ Object
Methods included from Logging
Constructor Details
#initialize(entity) ⇒ Annotations
Returns a new instance of Annotations.
11 12 13 14 |
# File 'lib/aws-xray-sdk/model/annotations.rb', line 11 def initialize(entity) @entity = entity @data = {} end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/aws-xray-sdk/model/annotations.rb', line 16 def [](key) @data[key] end |
#[]=(k, v) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/aws-xray-sdk/model/annotations.rb', line 22 def []=(k, v) raise EntityClosedError if @entity.closed? if key_supported?(k) && value_supported?(v) @data[k] = v else logger.warn %(Dropping annotation with key #{k} due to invalid characters.) end end |
#to_h ⇒ Object
38 39 40 |
# File 'lib/aws-xray-sdk/model/annotations.rb', line 38 def to_h sanitize_values(@data) end |
#update(h) ⇒ Object
32 33 34 35 36 |
# File 'lib/aws-xray-sdk/model/annotations.rb', line 32 def update(h) raise EntityClosedError if @entity.closed? filtered = filter_annotations(h) @data.merge!(filtered) end |