Skip to content

Commit

Permalink
round values to 3 digits after the dot
Browse files Browse the repository at this point in the history
  • Loading branch information
avsej committed Dec 12, 2024
1 parent f2d12ed commit 0b8bd68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client-ruby/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def export
counters.each do |bucket, level_2|
level_2.each do |host, level_3|
level_3.each do |metric, value|
report << "#{metric}{agent=#{@agent.inspect},bucket=#{bucket.inspect},node=#{host.inspect}} #{value.round} #{scrapping_timestamp}"
report << "#{metric}{agent=#{@agent.inspect},bucket=#{bucket.inspect},node=#{host.inspect}} #{value.round(3)} #{scrapping_timestamp}"
end
end
end
Expand All @@ -150,9 +150,9 @@ def export
level_3.each do |metric, histogram|
histogram.each do |label, value|
report << if label.is_a?(Numeric)
"#{metric}_bucket{le=#{histogram_label(label).inspect},agent=#{@agent.inspect},bucket=#{bucket.inspect},node=#{host.inspect}} #{value.round} #{scrapping_timestamp}"
"#{metric}_bucket{le=#{histogram_label(label).inspect},agent=#{@agent.inspect},bucket=#{bucket.inspect},node=#{host.inspect}} #{value.round(3)} #{scrapping_timestamp}"
else
"#{metric}_#{label}{agent=#{@agent.inspect},bucket=#{bucket.inspect},node=#{host.inspect}} #{value.round}"
"#{metric}_#{label}{agent=#{@agent.inspect},bucket=#{bucket.inspect},node=#{host.inspect}} #{value.round(3)}"
end
end
end
Expand Down

0 comments on commit 0b8bd68

Please sign in to comment.