File tree 2 files changed +8
-0
lines changed 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,8 @@ def sample_line(line):
122
122
raise
123
123
124
124
for suffix, lines in sorted(om_samples.items()):
125
+ output.append('# HELP {0}{1} {2}\n'.format(metric.name, suffix,
126
+ metric.documentation.replace('\\', r'\\').replace('\n', r'\n')))
125
127
output.append('# TYPE {0}{1} gauge\n'.format(metric.name, suffix))
126
128
output.extend(lines)
127
129
return ''.join(output).encode('utf-8')
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ def test_counter(self):
56
56
self.assertEqual(b"""# HELP cc_total A counter
57
57
# TYPE cc_total counter
58
58
cc_total 1.0
59
+ # HELP cc_created A counter
59
60
# TYPE cc_created gauge
60
61
cc_created 123.456
61
62
""", generate_latest(self.registry))
@@ -66,6 +67,7 @@ def test_counter_total(self):
66
67
self.assertEqual(b"""# HELP cc_total A counter
67
68
# TYPE cc_total counter
68
69
cc_total 1.0
70
+ # HELP cc_created A counter
69
71
# TYPE cc_created gauge
70
72
cc_created 123.456
71
73
""", generate_latest(self.registry))
@@ -82,6 +84,7 @@ def test_summary(self):
82
84
# TYPE ss summary
83
85
ss_count{a="c",b="d"} 1.0
84
86
ss_sum{a="c",b="d"} 17.0
87
+ # HELP ss_created A summary
85
88
# TYPE ss_created gauge
86
89
ss_created{a="c",b="d"} 123.456
87
90
""", generate_latest(self.registry))
@@ -109,6 +112,7 @@ def test_histogram(self):
109
112
hh_bucket{le="+Inf"} 1.0
110
113
hh_count 1.0
111
114
hh_sum 0.05
115
+ # HELP hh_created A histogram
112
116
# TYPE hh_created gauge
113
117
hh_created 123.456
114
118
""", generate_latest(self.registry))
@@ -119,8 +123,10 @@ def test_gaugehistogram(self):
119
123
# TYPE gh histogram
120
124
gh_bucket{le="1.0"} 4.0
121
125
gh_bucket{le="+Inf"} 5.0
126
+ # HELP gh_gcount help
122
127
# TYPE gh_gcount gauge
123
128
gh_gcount 5.0
129
+ # HELP gh_gsum help
124
130
# TYPE gh_gsum gauge
125
131
gh_gsum 7.0
126
132
""", generate_latest(self.registry))
You can’t perform that action at this time.
0 commit comments