Class: MonitoringProtocols::CommonData
Instance Method Summary
collapse
Methods inherited from DataStruct
#<=>, attributes, #initialize, #list_keys, #merge_data_from!, properties, #selected_field?, #to_a, #to_msgpack
Instance Method Details
#convert_content ⇒ Object
49
50
51
|
# File 'lib/monitoring_protocols/struct.rb', line 49
def convert_content
[self]
end
|
#measure_id(sep = '-') ⇒ Object
38
39
40
|
# File 'lib/monitoring_protocols/struct.rb', line 38
def measure_id(sep = '-')
[host, app_name, res_name, metric_name].join(sep)
end
|
#time=(val) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/monitoring_protocols/struct.rb', line 29
def time=(val)
case val
when Time then @time = val
when Numeric then @time = Time.at(val).getutc()
else
raise "invalid type for time: #{val}"
end
end
|
#to_h ⇒ Object
43
44
45
46
47
|
# File 'lib/monitoring_protocols/struct.rb', line 43
def to_h
super.merge(
time: time ? time.iso8601 : nil
)
end
|