Class: Datadog::Statsd::Serialization::Serializer
- Inherits:
-
Object
- Object
- Datadog::Statsd::Serialization::Serializer
- Defined in:
- lib/datadog/statsd/serialization/serializer.rb
Instance Method Summary collapse
- #global_tags ⇒ Object
-
#initialize(prefix: nil, global_tags: []) ⇒ Serializer
constructor
A new instance of Serializer.
-
#to_event(title, text, options = EMPTY_OPTIONS) ⇒ Object
using *args would make new allocations.
-
#to_service_check(name, status, options = EMPTY_OPTIONS) ⇒ Object
using *args would make new allocations.
-
#to_stat(name, delta, type, tags: [], sample_rate: 1) ⇒ Object
using *args would make new allocations.
Constructor Details
#initialize(prefix: nil, global_tags: []) ⇒ Serializer
Returns a new instance of Serializer.
9 10 11 12 13 |
# File 'lib/datadog/statsd/serialization/serializer.rb', line 9 def initialize(prefix: nil, global_tags: []) @stat_serializer = StatSerializer.new(prefix, global_tags: ) @service_check_serializer = ServiceCheckSerializer.new(global_tags: ) @event_serializer = EventSerializer.new(global_tags: ) end |
Instance Method Details
#global_tags ⇒ Object
30 31 32 |
# File 'lib/datadog/statsd/serialization/serializer.rb', line 30 def stat_serializer. end |
#to_event(title, text, options = EMPTY_OPTIONS) ⇒ Object
using *args would make new allocations
26 27 28 |
# File 'lib/datadog/statsd/serialization/serializer.rb', line 26 def to_event(title, text, = EMPTY_OPTIONS) event_serializer.format(title, text, ) end |
#to_service_check(name, status, options = EMPTY_OPTIONS) ⇒ Object
using *args would make new allocations
21 22 23 |
# File 'lib/datadog/statsd/serialization/serializer.rb', line 21 def to_service_check(name, status, = EMPTY_OPTIONS) service_check_serializer.format(name, status, ) end |
#to_stat(name, delta, type, tags: [], sample_rate: 1) ⇒ Object
using *args would make new allocations
16 17 18 |
# File 'lib/datadog/statsd/serialization/serializer.rb', line 16 def to_stat(name, delta, type, tags: [], sample_rate: 1) stat_serializer.format(name, delta, type, tags: , sample_rate: sample_rate) end |