Skip to content

Commit b10a436

Browse files
author
Jarret Lavallee
committed
Convert system metrics into float
Prior to this commit, the system metrics values were strings. This commit changes them to be floats. This adds compatibility with the existing json2timeseries parsing script as it looks for numeric values.
1 parent 96b75d1 commit b10a436

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

files/generate_system_metrics

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ module SystemMetrics
109109
#combine the arrays into a hash starting from the deal with the unmatched columns in the front
110110
data_hash = Hash[headers_line.reverse.zip(averages_line.reverse).reverse]
111111
# remove anything that doesn't have a number for an average like "Average:" or "all"
112-
data_hash.select{ |k,v| v =~ /\A[-+]?[0-9]*\.?[0-9]+\Z/ }
112+
data_hash.select!{ |k,v| v =~ /\A[-+]?[0-9]*\.?[0-9]+\Z/ }
113+
data_hash.transform_values!(&:to_f)
113114
end
114115

115116
# Convert the inputted sar output into json and raise errors if the sar output is invalid

0 commit comments

Comments
 (0)