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 @@ -97,8 +97,6 @@ type Registerable interface {
97
97
// KubeRegistry is an interface which implements a subset of prometheus.Registerer and
98
98
// prometheus.Gatherer interfaces
99
99
type KubeRegistry interface {
100
- // Deprecated
101
- RawRegister (prometheus.Collector ) error
102
100
// Deprecated
103
101
RawMustRegister (... prometheus.Collector )
104
102
CustomRegister (c StableCollector ) error
@@ -165,15 +163,6 @@ func (kr *kubeRegistry) CustomMustRegister(cs ...StableCollector) {
165
163
kr .PromRegistry .MustRegister (collectors ... )
166
164
}
167
165
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
-
177
166
// RawMustRegister takes a native prometheus.Collector and registers the collector
178
167
// to the registry. This bypasses metrics safety checks, so should only be used
179
168
// to register custom prometheus collectors.
You can’t perform that action at this time.
0 commit comments