13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/prometheus_client_addons/prometheus/client/formats/text_extended.rb', line 13
def self.marshal(registry)
lines = []
registry.metrics.each do |metric|
if metric.is_a?(MultiMetric)
metric.multi_values.each do |name, values|
lines << format(self::TYPE_LINE, name, metric.multi_name_type[name])
lines << format(self::HELP_LINE, name, escape(metric.multi_name_docstring[name]))
values.each do |label_set, value|
_metric = FakeGauge.new(name, metric.multi_name_docstring[name], metric.base_labels)
representation(_metric, label_set, value) { |l| lines << l }
end
end
else
lines << format(self::TYPE_LINE, metric.name, metric.type)
lines << format(self::HELP_LINE, metric.name, escape(metric.docstring))
metric.values.each do |label_set, value|
representation(metric, label_set, value) { |l| lines << l }
end
end
end
(lines << nil).join(self::DELIMITER)
end
|