File tree Expand file tree Collapse file tree 4 files changed +7
-32
lines changed
staging/src/k8s.io/component-base/metrics Expand file tree Collapse file tree 4 files changed +7
-32
lines changed Original file line number Diff line number Diff line change @@ -328,7 +328,7 @@ func (s *Server) InstallDefaultHandlers(enableCAdvisorJSONEndpoints bool) {
328
328
// prober metrics are exposed under a different endpoint
329
329
330
330
p := compbasemetrics .NewKubeRegistry ()
331
- compbasemetrics .RegisterProcessStartTime (p .RawRegister )
331
+ _ = compbasemetrics .RegisterProcessStartTime (p .Register )
332
332
p .MustRegister (prober .ProberResults )
333
333
s .restfulCont .Handle (proberMetricsPath ,
334
334
compbasemetrics .HandlerFor (p , compbasemetrics.HandlerOpts {ErrorHandling : compbasemetrics .ContinueOnError }),
Original file line number Diff line number Diff line change @@ -65,15 +65,6 @@ func RawMustRegister(cs ...prometheus.Collector) {
65
65
defaultRegistry .RawMustRegister (cs ... )
66
66
}
67
67
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
-
77
68
// CustomRegister registers a custom collector but uses the global registry.
78
69
func CustomRegister (c metrics.StableCollector ) error {
79
70
err := defaultRegistry .CustomRegister (c )
Original file line number Diff line number Diff line change @@ -20,29 +20,24 @@ import (
20
20
"os"
21
21
"time"
22
22
23
- "github.com/prometheus/client_golang/prometheus"
24
23
"github.com/prometheus/procfs"
25
24
26
25
"k8s.io/klog"
27
26
)
28
27
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 ,
33
33
},
34
34
[]string {},
35
35
)
36
36
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
-
42
37
// RegisterProcessStartTime registers the process_start_time_seconds to
43
38
// a prometheus registry. This metric needs to be included to ensure counter
44
39
// data fidelity.
45
- func RegisterProcessStartTime (registrationFunc func (prometheus. Collector ) error ) error {
40
+ func RegisterProcessStartTime (registrationFunc func (Registerable ) error ) error {
46
41
start , err := getProcessStart ()
47
42
if err != nil {
48
43
klog .Errorf ("Could not get process start time, %v" , err )
Original file line number Diff line number Diff line change @@ -113,8 +113,6 @@ type Registerable interface {
113
113
// KubeRegistry is an interface which implements a subset of prometheus.Registerer and
114
114
// prometheus.Gatherer interfaces
115
115
type KubeRegistry interface {
116
- // Deprecated
117
- RawRegister (prometheus.Collector ) error
118
116
// Deprecated
119
117
RawMustRegister (... prometheus.Collector )
120
118
CustomRegister (c StableCollector ) error
@@ -193,15 +191,6 @@ func (kr *kubeRegistry) CustomMustRegister(cs ...StableCollector) {
193
191
kr .PromRegistry .MustRegister (collectors ... )
194
192
}
195
193
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
-
205
194
// RawMustRegister takes a native prometheus.Collector and registers the collector
206
195
// to the registry. This bypasses metrics safety checks, so should only be used
207
196
// to register custom prometheus collectors.
You can’t perform that action at this time.
0 commit comments