mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
add some documentation around the metrics stability migration changes for clarity
This commit is contained in:
parent
3a50917795
commit
6f70f781df
@ -30,11 +30,19 @@ const (
|
|||||||
statusFailUnknown = "fail-unknown"
|
statusFailUnknown = "fail-unknown"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* By default, all the following metrics are defined as falling under
|
||||||
|
* ALPHA stability level https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/20190404-kubernetes-control-plane-metrics-stability.md#stability-classes)
|
||||||
|
*
|
||||||
|
* Promoting the stability level of the metric is a responsibility of the component owner, since it
|
||||||
|
* involves explicitly acknowledging support for the metric across multiple releases, in accordance with
|
||||||
|
* the metric stability policy.
|
||||||
|
*/
|
||||||
var storageOperationMetric = metrics.NewHistogramVec(
|
var storageOperationMetric = metrics.NewHistogramVec(
|
||||||
&metrics.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Name: "storage_operation_duration_seconds",
|
Name: "storage_operation_duration_seconds",
|
||||||
Help: "Storage operation duration",
|
Help: "Storage operation duration",
|
||||||
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 10, 15, 25, 50, 120, 300, 600},
|
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 10, 15, 25, 50, 120, 300, 600},
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
[]string{"volume_plugin", "operation_name"},
|
[]string{"volume_plugin", "operation_name"},
|
||||||
@ -42,8 +50,8 @@ var storageOperationMetric = metrics.NewHistogramVec(
|
|||||||
|
|
||||||
var storageOperationErrorMetric = metrics.NewCounterVec(
|
var storageOperationErrorMetric = metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
Name: "storage_operation_errors_total",
|
Name: "storage_operation_errors_total",
|
||||||
Help: "Storage operation errors",
|
Help: "Storage operation errors",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
[]string{"volume_plugin", "operation_name"},
|
[]string{"volume_plugin", "operation_name"},
|
||||||
@ -51,8 +59,8 @@ var storageOperationErrorMetric = metrics.NewCounterVec(
|
|||||||
|
|
||||||
var storageOperationStatusMetric = metrics.NewCounterVec(
|
var storageOperationStatusMetric = metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
Name: "storage_operation_status_count",
|
Name: "storage_operation_status_count",
|
||||||
Help: "Storage operation return statuses count",
|
Help: "Storage operation return statuses count",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
[]string{"volume_plugin", "operation_name", "status"},
|
[]string{"volume_plugin", "operation_name", "status"},
|
||||||
@ -60,9 +68,9 @@ var storageOperationStatusMetric = metrics.NewCounterVec(
|
|||||||
|
|
||||||
var storageOperationEndToEndLatencyMetric = metrics.NewHistogramVec(
|
var storageOperationEndToEndLatencyMetric = metrics.NewHistogramVec(
|
||||||
&metrics.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Name: "volume_operation_total_seconds",
|
Name: "volume_operation_total_seconds",
|
||||||
Help: "Storage operation end to end duration in seconds",
|
Help: "Storage operation end to end duration in seconds",
|
||||||
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 10, 15, 25, 50, 120, 300, 600},
|
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 10, 15, 25, 50, 120, 300, 600},
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
[]string{"plugin_name", "operation_name"},
|
[]string{"plugin_name", "operation_name"},
|
||||||
@ -73,6 +81,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func registerMetrics() {
|
func registerMetrics() {
|
||||||
|
// legacyregistry is the internal k8s wrapper around the prometheus
|
||||||
|
// global registry, used specifically for metric stability enforcement
|
||||||
legacyregistry.MustRegister(storageOperationMetric)
|
legacyregistry.MustRegister(storageOperationMetric)
|
||||||
legacyregistry.MustRegister(storageOperationErrorMetric)
|
legacyregistry.MustRegister(storageOperationErrorMetric)
|
||||||
legacyregistry.MustRegister(storageOperationStatusMetric)
|
legacyregistry.MustRegister(storageOperationStatusMetric)
|
||||||
|
@ -32,6 +32,6 @@ var (
|
|||||||
// RegisterBuildInfo registers the build and version info in a metadata metric in prometheus
|
// RegisterBuildInfo registers the build and version info in a metadata metric in prometheus
|
||||||
func RegisterBuildInfo(r KubeRegistry) {
|
func RegisterBuildInfo(r KubeRegistry) {
|
||||||
info := version.Get()
|
info := version.Get()
|
||||||
buildInfo.WithLabelValues(info.Major, info.Minor, info.GitVersion, info.GitCommit, info.GitTreeState, info.BuildDate, info.GoVersion, info.Compiler, info.Platform).Set(1)
|
|
||||||
r.MustRegister(buildInfo)
|
r.MustRegister(buildInfo)
|
||||||
|
buildInfo.WithLabelValues(info.Major, info.Minor, info.GitVersion, info.GitCommit, info.GitTreeState, info.BuildDate, info.GoVersion, info.Compiler, info.Platform).Set(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user