Use pedantic registry in other places too, to double check.

Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
bwplotka 2024-08-20 11:42:48 +01:00
parent 261fe84cd4
commit f2dd7b35fd
2 changed files with 8 additions and 8 deletions

View File

@ -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 {

View File

@ -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("/.*"),
@ -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 {
@ -100,7 +100,7 @@ func TestWithGoCollectorDefault(t *testing.T) {
}
func TestWithGoCollectorMemStatsMetricsDisabled(t *testing.T) {
reg := prometheus.NewRegistry()
reg := prometheus.NewPedanticRegistry()
reg.MustRegister(NewGoCollector(
WithGoCollectorMemStatsMetricsDisabled(),
))
@ -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...),
@ -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...),
@ -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())
@ -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(