Class: Datadog::Statsd::Serialization::TagSerializer
- Inherits:
-
Object
- Object
- Datadog::Statsd::Serialization::TagSerializer
- Defined in:
- lib/datadog/statsd/serialization/tag_serializer.rb
Instance Attribute Summary collapse
-
#global_tags ⇒ Object
readonly
Returns the value of attribute global_tags.
Instance Method Summary collapse
- #format(message_tags) ⇒ Object
-
#initialize(global_tags = [], env = ENV) ⇒ TagSerializer
constructor
A new instance of TagSerializer.
Constructor Details
#initialize(global_tags = [], env = ENV) ⇒ TagSerializer
Returns a new instance of TagSerializer.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/datadog/statsd/serialization/tag_serializer.rb', line 7 def initialize( = [], env = ENV) # Convert to hash = () # Merge with default tags = (env).merge() # Convert to tag list and set @global_tags = () if @global_tags.any? @global_tags_formatted = @global_tags.join(',') else @global_tags_formatted = nil end end |
Instance Attribute Details
#global_tags ⇒ Object (readonly)
Returns the value of attribute global_tags.
37 38 39 |
# File 'lib/datadog/statsd/serialization/tag_serializer.rb', line 37 def @global_tags end |
Instance Method Details
#format(message_tags) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/datadog/statsd/serialization/tag_serializer.rb', line 23 def format() if ! || .empty? return @global_tags_formatted end = if @global_tags_formatted [@global_tags_formatted, ()] else () end .join(',') end |