Skip to content

Commit f2dd7b3

Browse files
committed
Use pedantic registry in other places too, to double check.
Signed-off-by: bwplotka <[email protected]>
1 parent 261fe84 commit f2dd7b3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

prometheus/collectors/dbstats_collector_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
)
2222

2323
func TestDBStatsCollector(t *testing.T) {
24-
reg := prometheus.NewRegistry()
24+
reg := prometheus.NewPedanticRegistry()
2525
{
2626
db := new(sql.DB)
2727
if err := reg.Register(NewDBStatsCollector(db, "db_A")); err != nil {

prometheus/collectors/go_collector_latest_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var memstatMetrics = []string{
6363
}
6464

6565
func TestGoCollectorMarshalling(t *testing.T) {
66-
reg := prometheus.NewRegistry()
66+
reg := prometheus.NewPedanticRegistry()
6767
reg.MustRegister(NewGoCollector(
6868
WithGoCollectorRuntimeMetrics(GoRuntimeMetricsRule{
6969
Matcher: regexp.MustCompile("/.*"),
@@ -80,7 +80,7 @@ func TestGoCollectorMarshalling(t *testing.T) {
8080
}
8181

8282
func TestWithGoCollectorDefault(t *testing.T) {
83-
reg := prometheus.NewRegistry()
83+
reg := prometheus.NewPedanticRegistry()
8484
reg.MustRegister(NewGoCollector())
8585
result, err := reg.Gather()
8686
if err != nil {
@@ -100,7 +100,7 @@ func TestWithGoCollectorDefault(t *testing.T) {
100100
}
101101

102102
func TestWithGoCollectorMemStatsMetricsDisabled(t *testing.T) {
103-
reg := prometheus.NewRegistry()
103+
reg := prometheus.NewPedanticRegistry()
104104
reg.MustRegister(NewGoCollector(
105105
WithGoCollectorMemStatsMetricsDisabled(),
106106
))
@@ -157,7 +157,7 @@ func TestGoCollectorAllowList(t *testing.T) {
157157
},
158158
} {
159159
t.Run(test.name, func(t *testing.T) {
160-
reg := prometheus.NewRegistry()
160+
reg := prometheus.NewPedanticRegistry()
161161
reg.MustRegister(NewGoCollector(
162162
WithGoCollectorMemStatsMetricsDisabled(),
163163
WithGoCollectorRuntimeMetrics(test.rules...),
@@ -219,7 +219,7 @@ func TestGoCollectorDenyList(t *testing.T) {
219219
},
220220
} {
221221
t.Run(test.name, func(t *testing.T) {
222-
reg := prometheus.NewRegistry()
222+
reg := prometheus.NewPedanticRegistry()
223223
reg.MustRegister(NewGoCollector(
224224
WithGoCollectorMemStatsMetricsDisabled(),
225225
WithoutGoCollectorRuntimeMetrics(test.matchers...),
@@ -242,7 +242,7 @@ func TestGoCollectorDenyList(t *testing.T) {
242242
}
243243

244244
func ExampleGoCollector() {
245-
reg := prometheus.NewRegistry()
245+
reg := prometheus.NewPedanticRegistry()
246246

247247
// Register the GoCollector with the default options. Only the base metrics, default runtime metrics and memstats are enabled.
248248
reg.MustRegister(NewGoCollector())
@@ -252,7 +252,7 @@ func ExampleGoCollector() {
252252
}
253253

254254
func ExampleGoCollector_WithAdvancedGoMetrics() {
255-
reg := prometheus.NewRegistry()
255+
reg := prometheus.NewPedanticRegistry()
256256

257257
// Enable Go metrics with pre-defined rules. Or your custom rules.
258258
reg.MustRegister(

0 commit comments

Comments
 (0)