Class: StatsD::Instrument::DogStatsDDatagram
- Inherits:
-
Datagram
- Object
- Datagram
- StatsD::Instrument::DogStatsDDatagram
show all
- Defined in:
- lib/statsd/instrument/dogstatsd_datagram.rb
Overview
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.
The Datagram class parses and inspects a StatsD datagrams
Instance Attribute Summary
Attributes inherited from Datagram
#source
Instance Method Summary
collapse
Methods inherited from Datagram
#eql?, #hash, #initialize, #inspect, #sample_rate, #tags, #type
Instance Method Details
#aggregation_key ⇒ Object
33
34
35
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 33
def aggregation_key
parsed_datagram[:aggregation_key]
end
|
#alert_type ⇒ Object
45
46
47
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 45
def alert_type
parsed_datagram[:alert_type]
end
|
#hostname ⇒ Object
25
26
27
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 25
def hostname
parsed_datagram[:hostname]
end
|
#message ⇒ Object
49
50
51
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 49
def message
parsed_datagram[:message]
end
|
#name ⇒ Object
10
11
12
13
14
15
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 10
def name
@name ||= case type
when :_e then parsed_datagram[:name].gsub('\n', "\n")
else super
end
end
|
#priority ⇒ Object
41
42
43
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 41
def priority
parsed_datagram[:priority]
end
|
#source_type_name ⇒ Object
37
38
39
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 37
def source_type_name
parsed_datagram[:source_type_name]
end
|
#timestamp ⇒ Object
29
30
31
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 29
def timestamp
Time.at(Integer(parsed_datagram[:timestamp])).utc
end
|
#value ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 17
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
|