File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 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):
122122 raise
123123
124124 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' )))
125127 output .append ('# TYPE {0}{1} gauge\n ' .format (metric .name , suffix ))
126128 output .extend (lines )
127129 return '' .join (output ).encode ('utf-8' )
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ def test_counter(self):
5656 self .assertEqual (b"""# HELP cc_total A counter
5757# TYPE cc_total counter
5858cc_total 1.0
59+ # HELP cc_created A counter
5960# TYPE cc_created gauge
6061cc_created 123.456
6162""" , generate_latest (self .registry ))
@@ -66,6 +67,7 @@ def test_counter_total(self):
6667 self .assertEqual (b"""# HELP cc_total A counter
6768# TYPE cc_total counter
6869cc_total 1.0
70+ # HELP cc_created A counter
6971# TYPE cc_created gauge
7072cc_created 123.456
7173""" , generate_latest (self .registry ))
@@ -82,6 +84,7 @@ def test_summary(self):
8284# TYPE ss summary
8385ss_count{a="c",b="d"} 1.0
8486ss_sum{a="c",b="d"} 17.0
87+ # HELP ss_created A summary
8588# TYPE ss_created gauge
8689ss_created{a="c",b="d"} 123.456
8790""" , generate_latest (self .registry ))
@@ -109,6 +112,7 @@ def test_histogram(self):
109112hh_bucket{le="+Inf"} 1.0
110113hh_count 1.0
111114hh_sum 0.05
115+ # HELP hh_created A histogram
112116# TYPE hh_created gauge
113117hh_created 123.456
114118""" , generate_latest (self .registry ))
@@ -119,8 +123,10 @@ def test_gaugehistogram(self):
119123# TYPE gh histogram
120124gh_bucket{le="1.0"} 4.0
121125gh_bucket{le="+Inf"} 5.0
126+ # HELP gh_gcount help
122127# TYPE gh_gcount gauge
123128gh_gcount 5.0
129+ # HELP gh_gsum help
124130# TYPE gh_gsum gauge
125131gh_gsum 7.0
126132""" , generate_latest (self .registry ))
You can’t perform that action at this time.
0 commit comments