Skip to content

Commit 214228f

Browse files
committed
Remove the derprecated API RawRegister from stability framework
1 parent 81af5ba commit 214228f

File tree

4 files changed

+7
-32
lines changed

4 files changed

+7
-32
lines changed

pkg/kubelet/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func (s *Server) InstallDefaultHandlers(enableCAdvisorJSONEndpoints bool) {
328328
// prober metrics are exposed under a different endpoint
329329

330330
p := compbasemetrics.NewKubeRegistry()
331-
compbasemetrics.RegisterProcessStartTime(p.RawRegister)
331+
_ = compbasemetrics.RegisterProcessStartTime(p.Register)
332332
p.MustRegister(prober.ProberResults)
333333
s.restfulCont.Handle(proberMetricsPath,
334334
compbasemetrics.HandlerFor(p, compbasemetrics.HandlerOpts{ErrorHandling: compbasemetrics.ContinueOnError}),

staging/src/k8s.io/component-base/metrics/legacyregistry/registry.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,6 @@ func RawMustRegister(cs ...prometheus.Collector) {
6565
defaultRegistry.RawMustRegister(cs...)
6666
}
6767

68-
// RawRegister registers a prometheus collector but uses the global registry, this
69-
// bypasses the metric stability framework
70-
//
71-
// Deprecated
72-
func RawRegister(c prometheus.Collector) error {
73-
err := defaultRegistry.RawRegister(c)
74-
return err
75-
}
76-
7768
// CustomRegister registers a custom collector but uses the global registry.
7869
func CustomRegister(c metrics.StableCollector) error {
7970
err := defaultRegistry.CustomRegister(c)

staging/src/k8s.io/component-base/metrics/processstarttime.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,24 @@ import (
2020
"os"
2121
"time"
2222

23-
"github.com/prometheus/client_golang/prometheus"
2423
"github.com/prometheus/procfs"
2524

2625
"k8s.io/klog"
2726
)
2827

29-
var processStartTime = prometheus.NewGaugeVec(
30-
prometheus.GaugeOpts{
31-
Name: "process_start_time_seconds",
32-
Help: "Start time of the process since unix epoch in seconds.",
28+
var processStartTime = NewGaugeVec(
29+
&GaugeOpts{
30+
Name: "process_start_time_seconds",
31+
Help: "Start time of the process since unix epoch in seconds.",
32+
StabilityLevel: ALPHA,
3333
},
3434
[]string{},
3535
)
3636

37-
// Registerer is an interface expected by RegisterProcessStartTime in order to register the metric
38-
type Registerer interface {
39-
Register(prometheus.Collector) error
40-
}
41-
4237
// RegisterProcessStartTime registers the process_start_time_seconds to
4338
// a prometheus registry. This metric needs to be included to ensure counter
4439
// data fidelity.
45-
func RegisterProcessStartTime(registrationFunc func(prometheus.Collector) error) error {
40+
func RegisterProcessStartTime(registrationFunc func(Registerable) error) error {
4641
start, err := getProcessStart()
4742
if err != nil {
4843
klog.Errorf("Could not get process start time, %v", err)

staging/src/k8s.io/component-base/metrics/registry.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ type Registerable interface {
9797
// KubeRegistry is an interface which implements a subset of prometheus.Registerer and
9898
// prometheus.Gatherer interfaces
9999
type KubeRegistry interface {
100-
// Deprecated
101-
RawRegister(prometheus.Collector) error
102100
// Deprecated
103101
RawMustRegister(...prometheus.Collector)
104102
CustomRegister(c StableCollector) error
@@ -165,15 +163,6 @@ func (kr *kubeRegistry) CustomMustRegister(cs ...StableCollector) {
165163
kr.PromRegistry.MustRegister(collectors...)
166164
}
167165

168-
// RawRegister takes a native prometheus.Collector and registers the collector
169-
// to the registry. This bypasses metrics safety checks, so should only be used
170-
// to register custom prometheus collectors.
171-
//
172-
// Deprecated
173-
func (kr *kubeRegistry) RawRegister(c prometheus.Collector) error {
174-
return kr.PromRegistry.Register(c)
175-
}
176-
177166
// RawMustRegister takes a native prometheus.Collector and registers the collector
178167
// to the registry. This bypasses metrics safety checks, so should only be used
179168
// to register custom prometheus collectors.

0 commit comments

Comments
 (0)