mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
migrate kube-proxy metrics to stability framework
This commit is contained in:
parent
8b4fd4104d
commit
0895ac212d
@ -20,10 +20,9 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/cmd/kube-proxy",
|
importpath = "k8s.io/kubernetes/cmd/kube-proxy",
|
||||||
deps = [
|
deps = [
|
||||||
"//cmd/kube-proxy/app:go_default_library",
|
"//cmd/kube-proxy/app:go_default_library",
|
||||||
"//pkg/client/metrics/prometheus:go_default_library",
|
|
||||||
"//pkg/version/prometheus:go_default_library",
|
|
||||||
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
|
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
|
||||||
"//staging/src/k8s.io/component-base/logs:go_default_library",
|
"//staging/src/k8s.io/component-base/logs:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/metrics/prometheus/restclient:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -61,9 +61,9 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||||
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
|
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
|
||||||
"//staging/src/k8s.io/component-base/config:go_default_library",
|
"//staging/src/k8s.io/component-base/config:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library",
|
||||||
"//staging/src/k8s.io/kube-proxy/config/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/kube-proxy/config/v1alpha1:go_default_library",
|
||||||
"//vendor/github.com/fsnotify/fsnotify:go_default_library",
|
"//vendor/github.com/fsnotify/fsnotify:go_default_library",
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"k8s.io/component-base/metrics/legacyregistry"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
goruntime "runtime"
|
goruntime "runtime"
|
||||||
@ -74,7 +75,6 @@ import (
|
|||||||
utilpointer "k8s.io/utils/pointer"
|
utilpointer "k8s.io/utils/pointer"
|
||||||
|
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
@ -549,7 +549,7 @@ func (s *ProxyServer) Run() error {
|
|||||||
proxyMux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
|
proxyMux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "%s", s.ProxyMode)
|
fmt.Fprintf(w, "%s", s.ProxyMode)
|
||||||
})
|
})
|
||||||
proxyMux.Handle("/metrics", prometheus.Handler())
|
proxyMux.Handle("/metrics", legacyregistry.Handler())
|
||||||
if s.EnableProfiling {
|
if s.EnableProfiling {
|
||||||
routes.Profiling{}.Install(proxyMux)
|
routes.Profiling{}.Install(proxyMux)
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,8 @@ import (
|
|||||||
|
|
||||||
cliflag "k8s.io/component-base/cli/flag"
|
cliflag "k8s.io/component-base/cli/flag"
|
||||||
"k8s.io/component-base/logs"
|
"k8s.io/component-base/logs"
|
||||||
|
_ "k8s.io/component-base/metrics/prometheus/restclient" // for client metric registration
|
||||||
"k8s.io/kubernetes/cmd/kube-proxy/app"
|
"k8s.io/kubernetes/cmd/kube-proxy/app"
|
||||||
_ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
|
|
||||||
_ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -5,7 +5,11 @@ go_library(
|
|||||||
srcs = ["metrics.go"],
|
srcs = ["metrics.go"],
|
||||||
importpath = "k8s.io/kubernetes/pkg/kubelet/dockershim/network/metrics",
|
importpath = "k8s.io/kubernetes/pkg/kubelet/dockershim/network/metrics",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = ["//vendor/github.com/prometheus/client_golang/prometheus:go_default_library"],
|
deps = [
|
||||||
|
"//staging/src/k8s.io/component-base/metrics:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library",
|
||||||
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
package metrics
|
package metrics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/component-base/metrics"
|
||||||
|
"k8s.io/component-base/metrics/legacyregistry"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -38,23 +40,25 @@ const (
|
|||||||
var (
|
var (
|
||||||
// NetworkPluginOperationsLatency collects operation latency numbers by operation
|
// NetworkPluginOperationsLatency collects operation latency numbers by operation
|
||||||
// type.
|
// type.
|
||||||
NetworkPluginOperationsLatency = prometheus.NewHistogramVec(
|
NetworkPluginOperationsLatency = metrics.NewHistogramVec(
|
||||||
prometheus.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: kubeletSubsystem,
|
Subsystem: kubeletSubsystem,
|
||||||
Name: NetworkPluginOperationsLatencyKey,
|
Name: NetworkPluginOperationsLatencyKey,
|
||||||
Help: "Latency in seconds of network plugin operations. Broken down by operation type.",
|
Help: "Latency in seconds of network plugin operations. Broken down by operation type.",
|
||||||
Buckets: prometheus.DefBuckets,
|
Buckets: prometheus.DefBuckets,
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
[]string{"operation_type"},
|
[]string{"operation_type"},
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeprecatedNetworkPluginOperationsLatency collects operation latency numbers by operation
|
// DeprecatedNetworkPluginOperationsLatency collects operation latency numbers by operation
|
||||||
// type.
|
// type.
|
||||||
DeprecatedNetworkPluginOperationsLatency = prometheus.NewSummaryVec(
|
DeprecatedNetworkPluginOperationsLatency = metrics.NewSummaryVec(
|
||||||
prometheus.SummaryOpts{
|
&metrics.SummaryOpts{
|
||||||
Subsystem: kubeletSubsystem,
|
Subsystem: kubeletSubsystem,
|
||||||
Name: DeprecatedNetworkPluginOperationsLatencyKey,
|
Name: DeprecatedNetworkPluginOperationsLatencyKey,
|
||||||
Help: "(Deprecated) Latency in microseconds of network plugin operations. Broken down by operation type.",
|
Help: "(Deprecated) Latency in microseconds of network plugin operations. Broken down by operation type.",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
[]string{"operation_type"},
|
[]string{"operation_type"},
|
||||||
)
|
)
|
||||||
@ -65,8 +69,8 @@ var registerMetrics sync.Once
|
|||||||
// Register all metrics.
|
// Register all metrics.
|
||||||
func Register() {
|
func Register() {
|
||||||
registerMetrics.Do(func() {
|
registerMetrics.Do(func() {
|
||||||
prometheus.MustRegister(NetworkPluginOperationsLatency)
|
legacyregistry.MustRegister(NetworkPluginOperationsLatency)
|
||||||
prometheus.MustRegister(DeprecatedNetworkPluginOperationsLatency)
|
legacyregistry.MustRegister(DeprecatedNetworkPluginOperationsLatency)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,11 @@ go_library(
|
|||||||
srcs = ["metrics.go"],
|
srcs = ["metrics.go"],
|
||||||
importpath = "k8s.io/kubernetes/pkg/proxy/metrics",
|
importpath = "k8s.io/kubernetes/pkg/proxy/metrics",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = ["//vendor/github.com/prometheus/client_golang/prometheus:go_default_library"],
|
deps = [
|
||||||
|
"//staging/src/k8s.io/component-base/metrics:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library",
|
||||||
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
package metrics
|
package metrics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/component-base/metrics"
|
||||||
|
"k8s.io/component-base/metrics/legacyregistry"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -27,32 +29,35 @@ const kubeProxySubsystem = "kubeproxy"
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// SyncProxyRulesLatency is the latency of one round of kube-proxy syncing proxy rules.
|
// SyncProxyRulesLatency is the latency of one round of kube-proxy syncing proxy rules.
|
||||||
SyncProxyRulesLatency = prometheus.NewHistogram(
|
SyncProxyRulesLatency = metrics.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_duration_seconds",
|
Name: "sync_proxy_rules_duration_seconds",
|
||||||
Help: "SyncProxyRules latency in seconds",
|
Help: "SyncProxyRules latency in seconds",
|
||||||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 15),
|
Buckets: prometheus.ExponentialBuckets(0.001, 2, 15),
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeprecatedSyncProxyRulesLatency is the latency of one round of kube-proxy syncing proxy rules.
|
// DeprecatedSyncProxyRulesLatency is the latency of one round of kube-proxy syncing proxy rules.
|
||||||
DeprecatedSyncProxyRulesLatency = prometheus.NewHistogram(
|
DeprecatedSyncProxyRulesLatency = metrics.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_latency_microseconds",
|
Name: "sync_proxy_rules_latency_microseconds",
|
||||||
Help: "(Deprecated) SyncProxyRules latency in microseconds",
|
Help: "(Deprecated) SyncProxyRules latency in microseconds",
|
||||||
Buckets: prometheus.ExponentialBuckets(1000, 2, 15),
|
Buckets: prometheus.ExponentialBuckets(1000, 2, 15),
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// SyncProxyRulesLastTimestamp is the timestamp proxy rules were last
|
// SyncProxyRulesLastTimestamp is the timestamp proxy rules were last
|
||||||
// successfully synced.
|
// successfully synced.
|
||||||
SyncProxyRulesLastTimestamp = prometheus.NewGauge(
|
SyncProxyRulesLastTimestamp = metrics.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
&metrics.GaugeOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_last_timestamp_seconds",
|
Name: "sync_proxy_rules_last_timestamp_seconds",
|
||||||
Help: "The last time proxy rules were successfully synced",
|
Help: "The last time proxy rules were successfully synced",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,8 +68,8 @@ var (
|
|||||||
// Note that the metrics is partially based on the time exported by the endpoints controller on
|
// Note that the metrics is partially based on the time exported by the endpoints controller on
|
||||||
// the master machine. The measurement may be inaccurate if there is a clock drift between the
|
// the master machine. The measurement may be inaccurate if there is a clock drift between the
|
||||||
// node and master machine.
|
// node and master machine.
|
||||||
NetworkProgrammingLatency = prometheus.NewHistogram(
|
NetworkProgrammingLatency = metrics.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "network_programming_duration_seconds",
|
Name: "network_programming_duration_seconds",
|
||||||
Help: "In Cluster Network Programming Latency in seconds",
|
Help: "In Cluster Network Programming Latency in seconds",
|
||||||
@ -74,56 +79,62 @@ var (
|
|||||||
prometheus.LinearBuckets(60, 5, 12), // 60s, 65s, 70s, ... 115s
|
prometheus.LinearBuckets(60, 5, 12), // 60s, 65s, 70s, ... 115s
|
||||||
prometheus.LinearBuckets(120, 30, 7), // 2min, 2.5min, 3min, ..., 5min
|
prometheus.LinearBuckets(120, 30, 7), // 2min, 2.5min, 3min, ..., 5min
|
||||||
),
|
),
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// EndpointChangesPending is the number of pending endpoint changes that
|
// EndpointChangesPending is the number of pending endpoint changes that
|
||||||
// have not yet been synced to the proxy.
|
// have not yet been synced to the proxy.
|
||||||
EndpointChangesPending = prometheus.NewGauge(
|
EndpointChangesPending = metrics.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
&metrics.GaugeOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_endpoint_changes_pending",
|
Name: "sync_proxy_rules_endpoint_changes_pending",
|
||||||
Help: "Pending proxy rules Endpoint changes",
|
Help: "Pending proxy rules Endpoint changes",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// EndpointChangesTotal is the number of endpoint changes that the proxy
|
// EndpointChangesTotal is the number of endpoint changes that the proxy
|
||||||
// has seen.
|
// has seen.
|
||||||
EndpointChangesTotal = prometheus.NewCounter(
|
EndpointChangesTotal = metrics.NewCounter(
|
||||||
prometheus.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_endpoint_changes_total",
|
Name: "sync_proxy_rules_endpoint_changes_total",
|
||||||
Help: "Cumulative proxy rules Endpoint changes",
|
Help: "Cumulative proxy rules Endpoint changes",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceChangesPending is the number of pending service changes that
|
// ServiceChangesPending is the number of pending service changes that
|
||||||
// have not yet been synced to the proxy.
|
// have not yet been synced to the proxy.
|
||||||
ServiceChangesPending = prometheus.NewGauge(
|
ServiceChangesPending = metrics.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
&metrics.GaugeOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_service_changes_pending",
|
Name: "sync_proxy_rules_service_changes_pending",
|
||||||
Help: "Pending proxy rules Service changes",
|
Help: "Pending proxy rules Service changes",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceChangesTotal is the number of service changes that the proxy has
|
// ServiceChangesTotal is the number of service changes that the proxy has
|
||||||
// seen.
|
// seen.
|
||||||
ServiceChangesTotal = prometheus.NewCounter(
|
ServiceChangesTotal = metrics.NewCounter(
|
||||||
prometheus.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_service_changes_total",
|
Name: "sync_proxy_rules_service_changes_total",
|
||||||
Help: "Cumulative proxy rules Service changes",
|
Help: "Cumulative proxy rules Service changes",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// IptablesRestoreFailuresTotal is the number of iptables restore failures that the proxy has
|
// IptablesRestoreFailuresTotal is the number of iptables restore failures that the proxy has
|
||||||
// seen.
|
// seen.
|
||||||
IptablesRestoreFailuresTotal = prometheus.NewCounter(
|
IptablesRestoreFailuresTotal = metrics.NewCounter(
|
||||||
prometheus.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_iptables_restore_failures_total",
|
Name: "sync_proxy_rules_iptables_restore_failures_total",
|
||||||
Help: "Cumulative proxy iptables restore failures",
|
Help: "Cumulative proxy iptables restore failures",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -133,15 +144,15 @@ var registerMetricsOnce sync.Once
|
|||||||
// RegisterMetrics registers kube-proxy metrics.
|
// RegisterMetrics registers kube-proxy metrics.
|
||||||
func RegisterMetrics() {
|
func RegisterMetrics() {
|
||||||
registerMetricsOnce.Do(func() {
|
registerMetricsOnce.Do(func() {
|
||||||
prometheus.MustRegister(SyncProxyRulesLatency)
|
legacyregistry.MustRegister(SyncProxyRulesLatency)
|
||||||
prometheus.MustRegister(DeprecatedSyncProxyRulesLatency)
|
legacyregistry.MustRegister(DeprecatedSyncProxyRulesLatency)
|
||||||
prometheus.MustRegister(SyncProxyRulesLastTimestamp)
|
legacyregistry.MustRegister(SyncProxyRulesLastTimestamp)
|
||||||
prometheus.MustRegister(NetworkProgrammingLatency)
|
legacyregistry.MustRegister(NetworkProgrammingLatency)
|
||||||
prometheus.MustRegister(EndpointChangesPending)
|
legacyregistry.MustRegister(EndpointChangesPending)
|
||||||
prometheus.MustRegister(EndpointChangesTotal)
|
legacyregistry.MustRegister(EndpointChangesTotal)
|
||||||
prometheus.MustRegister(ServiceChangesPending)
|
legacyregistry.MustRegister(ServiceChangesPending)
|
||||||
prometheus.MustRegister(ServiceChangesTotal)
|
legacyregistry.MustRegister(ServiceChangesTotal)
|
||||||
prometheus.MustRegister(IptablesRestoreFailuresTotal)
|
legacyregistry.MustRegister(IptablesRestoreFailuresTotal)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/pkg/proxy/winkernel",
|
importpath = "k8s.io/kubernetes/pkg/proxy/winkernel",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//staging/src/k8s.io/component-base/metrics:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library",
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
] + select({
|
] + select({
|
||||||
"@io_bazel_rules_go//go/platform:windows": [
|
"@io_bazel_rules_go//go/platform:windows": [
|
||||||
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
package winkernel
|
package winkernel
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/component-base/metrics"
|
||||||
|
"k8s.io/component-base/metrics/legacyregistry"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -26,31 +28,34 @@ import (
|
|||||||
const kubeProxySubsystem = "kubeproxy"
|
const kubeProxySubsystem = "kubeproxy"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
SyncProxyRulesLatency = prometheus.NewHistogram(
|
SyncProxyRulesLatency = metrics.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_duration_seconds",
|
Name: "sync_proxy_rules_duration_seconds",
|
||||||
Help: "SyncProxyRules latency in seconds",
|
Help: "SyncProxyRules latency in seconds",
|
||||||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 15),
|
Buckets: prometheus.ExponentialBuckets(0.001, 2, 15),
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
DeprecatedSyncProxyRulesLatency = prometheus.NewHistogram(
|
DeprecatedSyncProxyRulesLatency = metrics.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_latency_microseconds",
|
Name: "sync_proxy_rules_latency_microseconds",
|
||||||
Help: "(Deprecated) SyncProxyRules latency in microseconds",
|
Help: "(Deprecated) SyncProxyRules latency in microseconds",
|
||||||
Buckets: prometheus.ExponentialBuckets(1000, 2, 15),
|
Buckets: prometheus.ExponentialBuckets(1000, 2, 15),
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// SyncProxyRulesLastTimestamp is the timestamp proxy rules were last
|
// SyncProxyRulesLastTimestamp is the timestamp proxy rules were last
|
||||||
// successfully synced.
|
// successfully synced.
|
||||||
SyncProxyRulesLastTimestamp = prometheus.NewGauge(
|
SyncProxyRulesLastTimestamp = metrics.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
&metrics.GaugeOpts{
|
||||||
Subsystem: kubeProxySubsystem,
|
Subsystem: kubeProxySubsystem,
|
||||||
Name: "sync_proxy_rules_last_timestamp_seconds",
|
Name: "sync_proxy_rules_last_timestamp_seconds",
|
||||||
Help: "The last time proxy rules were successfully synced",
|
Help: "The last time proxy rules were successfully synced",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -59,9 +64,9 @@ var registerMetricsOnce sync.Once
|
|||||||
|
|
||||||
func RegisterMetrics() {
|
func RegisterMetrics() {
|
||||||
registerMetricsOnce.Do(func() {
|
registerMetricsOnce.Do(func() {
|
||||||
prometheus.MustRegister(SyncProxyRulesLatency)
|
legacyregistry.MustRegister(SyncProxyRulesLatency)
|
||||||
prometheus.MustRegister(DeprecatedSyncProxyRulesLatency)
|
legacyregistry.MustRegister(DeprecatedSyncProxyRulesLatency)
|
||||||
prometheus.MustRegister(SyncProxyRulesLastTimestamp)
|
legacyregistry.MustRegister(SyncProxyRulesLastTimestamp)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ type GaugeMetric interface {
|
|||||||
Dec()
|
Dec()
|
||||||
Add(float64)
|
Add(float64)
|
||||||
Write(out *dto.Metric) error
|
Write(out *dto.Metric) error
|
||||||
|
SetToCurrentTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObserverMetric captures individual observations.
|
// ObserverMetric captures individual observations.
|
||||||
|
1
vendor/modules.txt
vendored
1
vendor/modules.txt
vendored
@ -1663,6 +1663,7 @@ k8s.io/component-base/metrics/prometheus/clientgo
|
|||||||
k8s.io/component-base/metrics/prometheus/clientgo/leaderelection
|
k8s.io/component-base/metrics/prometheus/clientgo/leaderelection
|
||||||
k8s.io/component-base/metrics/prometheus/restclient
|
k8s.io/component-base/metrics/prometheus/restclient
|
||||||
k8s.io/component-base/metrics/prometheus/workqueue
|
k8s.io/component-base/metrics/prometheus/workqueue
|
||||||
|
k8s.io/component-base/metrics/prometheus/restclient
|
||||||
k8s.io/component-base/version
|
k8s.io/component-base/version
|
||||||
# k8s.io/cri-api v0.0.0 => ./staging/src/k8s.io/cri-api
|
# k8s.io/cri-api v0.0.0 => ./staging/src/k8s.io/cri-api
|
||||||
k8s.io/cri-api/pkg/apis
|
k8s.io/cri-api/pkg/apis
|
||||||
|
Loading…
Reference in New Issue
Block a user