Skip to content

Commit

Permalink
Use pedantic registry in other places too, to double check.
Browse files Browse the repository at this point in the history
Signed-off-by: bwplotka <[email protected]>
  • Loading branch information
bwplotka committed Aug 20, 2024
1 parent 261fe84 commit f2dd7b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion prometheus/collectors/dbstats_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

func TestDBStatsCollector(t *testing.T) {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()
{
db := new(sql.DB)
if err := reg.Register(NewDBStatsCollector(db, "db_A")); err != nil {
Expand Down
14 changes: 7 additions & 7 deletions prometheus/collectors/go_collector_latest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var memstatMetrics = []string{
}

func TestGoCollectorMarshalling(t *testing.T) {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()
reg.MustRegister(NewGoCollector(
WithGoCollectorRuntimeMetrics(GoRuntimeMetricsRule{
Matcher: regexp.MustCompile("/.*"),
Expand All @@ -80,7 +80,7 @@ func TestGoCollectorMarshalling(t *testing.T) {
}

func TestWithGoCollectorDefault(t *testing.T) {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()
reg.MustRegister(NewGoCollector())
result, err := reg.Gather()
if err != nil {
Expand All @@ -100,7 +100,7 @@ func TestWithGoCollectorDefault(t *testing.T) {
}

func TestWithGoCollectorMemStatsMetricsDisabled(t *testing.T) {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()
reg.MustRegister(NewGoCollector(
WithGoCollectorMemStatsMetricsDisabled(),
))
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestGoCollectorAllowList(t *testing.T) {
},
} {
t.Run(test.name, func(t *testing.T) {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()
reg.MustRegister(NewGoCollector(
WithGoCollectorMemStatsMetricsDisabled(),
WithGoCollectorRuntimeMetrics(test.rules...),
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestGoCollectorDenyList(t *testing.T) {
},
} {
t.Run(test.name, func(t *testing.T) {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()
reg.MustRegister(NewGoCollector(
WithGoCollectorMemStatsMetricsDisabled(),
WithoutGoCollectorRuntimeMetrics(test.matchers...),
Expand All @@ -242,7 +242,7 @@ func TestGoCollectorDenyList(t *testing.T) {
}

func ExampleGoCollector() {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()

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

func ExampleGoCollector_WithAdvancedGoMetrics() {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()

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

0 comments on commit f2dd7b3

Please sign in to comment.