class StatsD::Instrument::DogStatsDDatagram
The Datagram class parses and inspects a StatsD
datagrams
@note This class is part of the new Client implementation that is intended
to become the new default in the next major release of this library.
Constants
- EVENT_PARSER
|k:my-key|p:low|s:source|t:success|
- PARSER
- SERVICE_CHECK_PARSER
Public Instance Methods
aggregation_key()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 31 def aggregation_key parsed_datagram[:aggregation_key] end
alert_type()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 43 def alert_type parsed_datagram[:alert_type] end
hostname()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 23 def hostname parsed_datagram[:hostname] end
message()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 47 def message parsed_datagram[:message] end
name()
click to toggle source
Calls superclass method
StatsD::Instrument::Datagram#name
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 8 def name @name ||= case type when :_e then parsed_datagram[:name].gsub('\n', "\n") else super end end
priority()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 39 def priority parsed_datagram[:priority] end
source_type_name()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 35 def source_type_name parsed_datagram[:source_type_name] end
timestamp()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 27 def timestamp Time.at(Integer(parsed_datagram[:timestamp])).utc end
value()
click to toggle source
Calls superclass method
StatsD::Instrument::Datagram#value
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 15 def value @value ||= case type when :_sc then Integer(parsed_datagram[:value]) when :_e then parsed_datagram[:value].gsub('\n', "\n") else super end end
Protected Instance Methods
parsed_datagram()
click to toggle source
# File lib/statsd/instrument/dogstatsd_datagram.rb, line 53 def parsed_datagram @parsed ||= if (match_info = PARSER.match(@source)) match_info else raise ArgumentError, "Invalid DogStatsD datagram: #{@source}" end end