Skip to content

Commit dc79bd6

Browse files
committed
Improve various comments
Signed-off-by: beorn7 <[email protected]>
1 parent 39dbb24 commit dc79bd6

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

prometheus/testutil/lint.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"github.com/prometheus/client_golang/prometheus/testutil/promlint"
2121
)
2222

23-
// CollectAndLint registers the provided Collector with a newly created
24-
// pedantic Registry. It then does the same as GatherAndLint, gathering the
25-
// metrics from the pedantic Registry.
23+
// CollectAndLint registers the provided Collector with a newly created pedantic
24+
// Registry. It then calls GatherAndLint with that Registry and with the
25+
// provided metricNames.
2626
func CollectAndLint(c prometheus.Collector, metricNames ...string) ([]promlint.Problem, error) {
2727
reg := prometheus.NewPedanticRegistry()
2828
if err := reg.Register(c); err != nil {

prometheus/testutil/lint_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ func TestCollectAndLintBad(t *testing.T) {
6363
if len(problems) < 5 {
6464
// The exact nature of the lint problems found is tested within
6565
// the promlint package itself. Here we only want to make sure
66-
// that the collector successfully hit the linter and got enough
67-
// problems flagged.
66+
// that the collector successfully hits the linter and that at
67+
// least the five problems that the linter could recognize at
68+
// the time of writing this test are flagged.
6869
t.Error("Not enough lint problems found.")
6970
}
7071
}

prometheus/testutil/promlint/promlint.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ import (
2929
// A Linter is a Prometheus metrics linter. It identifies issues with metric
3030
// names, types, and metadata, and reports them to the caller.
3131
type Linter struct {
32+
// The linter will read metrics in the Prometheus text format from r and
33+
// then lint it, _and_ it will lint the metrics provided directly as
34+
// MetricFamily proto messages in mfs. Note, however, that the current
35+
// constructor functions New and NewWithMetricFamilies only ever set one
36+
// of them.
3237
r io.Reader
3338
mfs []*dto.MetricFamily
3439
}

prometheus/testutil/testutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ func CollectAndCount(c prometheus.Collector) int {
140140
}
141141

142142
// CollectAndCompare registers the provided Collector with a newly created
143-
// pedantic Registry. It then does the same as GatherAndCompare, gathering the
144-
// metrics from the pedantic Registry.
143+
// pedantic Registry. It then calls GatherAndCompare with that Registry and with
144+
// the provided metricNames.
145145
func CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames ...string) error {
146146
reg := prometheus.NewPedanticRegistry()
147147
if err := reg.Register(c); err != nil {

0 commit comments

Comments
 (0)