lib/ddtelemetry/printer.rb in ddtelemetry-1.0.0a2 vs lib/ddtelemetry/printer.rb in ddtelemetry-1.0.0a3
- old
+ new
@@ -10,10 +10,14 @@
DDTelemetry::Table.new(table_for_counter(counter)).to_s
end
private
+ def label_to_s(label)
+ label.to_a.sort.map { |pair| pair.join('=') }.join(' ')
+ end
+
def table_for_summary(summary)
headers = ['', 'count', 'min', '.50', '.90', '.95', 'max', 'tot']
rows = summary.labels.map do |label|
stats = summary.get(label)
@@ -24,20 +28,20 @@
p90 = stats.quantile(0.90)
p95 = stats.quantile(0.95)
tot = stats.sum
max = stats.max
- [label.to_s, count.to_s] + [min, p50, p90, p95, max, tot].map { |r| format('%4.2f', r) }
+ [label_to_s(label), count.to_s] + [min, p50, p90, p95, max, tot].map { |r| format('%4.2f', r) }
end
[headers] + rows
end
def table_for_counter(counter)
headers = ['', 'count']
rows = counter.labels.map do |label|
- [label.to_s, counter.get(label).to_s]
+ [label_to_s(label), counter.get(label).to_s]
end
[headers] + rows
end
end