8000 reduced go metrics to default minimum. · cert-manager/cert-manager@ae99a23 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae99a23

Browse files
committed
reduced go metrics to default minimum.
1 parent 531b1f1 commit ae99a23

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pkg/metrics/metrics.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ package metrics
2828
import (
2929
"net"
3030
"net/http"
31-
"regexp"
3231
"time"
3332

3433
"github.com/go-logr/logr"
@@ -190,12 +189,9 @@ func New(log logr.Logger, c clock.Clock) *Metrics {
190189

191190
// Create Registry and register the recommended collectors
192191
registry := prometheus.NewRegistry()
193-
registry.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))
194192
registry.MustRegister(
195-
collectors.NewGoCollector(
196-
collectors.WithGoCollectorRuntimeMetrics(collectors.MetricsAll),
197-
collectors.WithoutGoCollectorRuntimeMetrics(regexp.MustCompile("^/godebug/.*")),
198-
),
193+
collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}),
194+
collectors.NewGoCollector(),
199195
)
200196
// Create server and register Prometheus metrics handler
201197
m := &Metrics{

test/integration/certificates/metrics_controller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ func TestMetricsController(t *testing.T) {
145145
return err
146146
}
147147

148-
if strings.TrimSpace(string(output)) != strings.TrimSpace(expectedOutput) {
148+
trimmedOutput := strings.SplitN(string(output), "# HELP go_gc_duration_seconds", 2)[0]
149+
if strings.TrimSpace(trimmedOutput) != strings.TrimSpace(expectedOutput) {
149150
return fmt.Errorf("got unexpected metrics output\nexp:\n%s\ngot:\n%s\n",
150151
expectedOutput, output)
151152
}

0 commit comments

Comments
 (0)
0