Skip to content

Commit c7a65ca

Browse files
authored
Merge pull request kubernetes#85446 from RainbowMango/pr_remove_RawRegister
Remove the derprecated API RawRegister from stability framework
2 parents bbd48e9 + 214228f commit c7a65ca

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
@@ -113,8 +113,6 @@ type Registerable interface {
113113
// KubeRegistry is an interface which implements a subset of prometheus.Registerer and
114114
// prometheus.Gatherer interfaces
115115
type KubeRegistry interface {
116-
// Deprecated
117-
RawRegister(prometheus.Collector) error
118116
// Deprecated
119117
RawMustRegister(...prometheus.Collector)
120118
CustomRegister(c StableCollector) error
@@ -193,15 +191,6 @@ func (kr *kubeRegistry) CustomMustRegister(cs ...StableCollector) {
193191
kr.PromRegistry.MustRegister(collectors...)
194192
}
195193

196-
// RawRegister takes a native prometheus.Collector and registers the collector
197-
// to the registry. This bypasses metrics safety checks, so should only be used
198-
// to register custom prometheus collectors.
199-
//
200-
// Deprecated
201-
func (kr *kubeRegistry) RawRegister(c prometheus.Collector) error {
202-
return kr.PromRegistry.Register(c)
203-
}
204-
205194
// RawMustRegister takes a native prometheus.Collector and registers the collector
206195
// to the registry. This bypasses metrics safety checks, so should only be used
207196
// to register custom prometheus collectors.

0 commit comments

Comments
 (0)