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
31
32
33
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 31
def aggregation_key
parsed_datagram[:aggregation_key]
end
|
#alert_type ⇒ Object
43
44
45
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 43
def alert_type
parsed_datagram[:alert_type]
end
|
#hostname ⇒ Object
23
24
25
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 23
def hostname
parsed_datagram[:hostname]
end
|
#message ⇒ Object
47
48
49
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 47
def message
parsed_datagram[:message]
end
|
#name ⇒ Object
8
9
10
11
12
13
|
# 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 ⇒ Object
39
40
41
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 39
def priority
parsed_datagram[:priority]
end
|
#source_type_name ⇒ Object
35
36
37
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 35
def source_type_name
parsed_datagram[:source_type_name]
end
|
#timestamp ⇒ Object
27
28
29
|
# File 'lib/statsd/instrument/dogstatsd_datagram.rb', line 27
def timestamp
Time.at(Integer(parsed_datagram[:timestamp])).utc
end
|
#value ⇒ Object
15
16
17
18
19
20
21
|
# 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
|