class Datadog::Statsd::Serialization::Serializer

Attributes

event_serializer[R]
service_check_serializer[R]
stat_serializer[R]

Public Class Methods

new(prefix: nil, global_tags: []) click to toggle source
# File lib/datadog/statsd/serialization/serializer.rb, line 9
def initialize(prefix: nil, global_tags: [])
  @stat_serializer = StatSerializer.new(prefix, global_tags: global_tags)
  @service_check_serializer = ServiceCheckSerializer.new(global_tags: global_tags)
  @event_serializer = EventSerializer.new(global_tags: global_tags)
end

Public Instance Methods

global_tags() click to toggle source
# File lib/datadog/statsd/serialization/serializer.rb, line 30
def global_tags
  stat_serializer.global_tags
end
to_event(title, text, options = EMPTY_OPTIONS) click to toggle source

using *args would make new allocations

# File lib/datadog/statsd/serialization/serializer.rb, line 26
def to_event(title, text, options = EMPTY_OPTIONS)
  event_serializer.format(title, text, options)
end
to_service_check(name, status, options = EMPTY_OPTIONS) click to toggle source

using *args would make new allocations

# File lib/datadog/statsd/serialization/serializer.rb, line 21
def to_service_check(name, status, options = EMPTY_OPTIONS)
  service_check_serializer.format(name, status, options)
end
to_stat(name, delta, type, tags: [], sample_rate: 1) click to toggle source

using *args would make new allocations

# 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: tags, sample_rate: sample_rate)
end