mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #112992 from logicalhan/clean-legacy-cp-metrics
fix metric labels in cloud-provider metrics since it breaks static analysis
This commit is contained in:
commit
c56629803d
@ -39,8 +39,8 @@ var (
|
|||||||
"source", // Operation source(optional)
|
"source", // Operation source(optional)
|
||||||
}
|
}
|
||||||
|
|
||||||
apiMetrics = registerAPIMetrics(metricLabels...)
|
apiMetrics = registerAPIMetrics()
|
||||||
operationMetrics = registerOperationMetrics(metricLabels...)
|
operationMetrics = registerOperationMetrics()
|
||||||
)
|
)
|
||||||
|
|
||||||
// apiCallMetrics is the metrics measuring the performance of a single API call
|
// apiCallMetrics is the metrics measuring the performance of a single API call
|
||||||
@ -109,7 +109,7 @@ func (mc *MetricContext) CountFailedOperation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// registerAPIMetrics registers the API metrics.
|
// registerAPIMetrics registers the API metrics.
|
||||||
func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
func registerAPIMetrics() *apiCallMetrics {
|
||||||
metrics := &apiCallMetrics{
|
metrics := &apiCallMetrics{
|
||||||
latency: metrics.NewHistogramVec(
|
latency: metrics.NewHistogramVec(
|
||||||
&metrics.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
@ -119,7 +119,7 @@ func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
|||||||
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 10, 15, 25, 50, 120, 300, 600, 1200},
|
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 10, 15, 25, 50, 120, 300, 600, 1200},
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
errors: metrics.NewCounterVec(
|
errors: metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
@ -128,7 +128,7 @@ func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
|||||||
Help: "Number of errors for an Azure API call",
|
Help: "Number of errors for an Azure API call",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
rateLimitedCount: metrics.NewCounterVec(
|
rateLimitedCount: metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
@ -137,7 +137,7 @@ func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
|||||||
Help: "Number of rate limited Azure API calls",
|
Help: "Number of rate limited Azure API calls",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
throttledCount: metrics.NewCounterVec(
|
throttledCount: metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
@ -146,7 +146,7 @@ func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
|||||||
Help: "Number of throttled Azure API calls",
|
Help: "Number of throttled Azure API calls",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// registerOperationMetrics registers the operation metrics.
|
// registerOperationMetrics registers the operation metrics.
|
||||||
func registerOperationMetrics(attributes ...string) *operationCallMetrics {
|
func registerOperationMetrics() *operationCallMetrics {
|
||||||
metrics := &operationCallMetrics{
|
metrics := &operationCallMetrics{
|
||||||
operationLatency: metrics.NewHistogramVec(
|
operationLatency: metrics.NewHistogramVec(
|
||||||
&metrics.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
@ -169,7 +169,7 @@ func registerOperationMetrics(attributes ...string) *operationCallMetrics {
|
|||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
Buckets: []float64{0.1, 0.2, 0.5, 1, 10, 20, 30, 40, 50, 60, 100, 200, 300},
|
Buckets: []float64{0.1, 0.2, 0.5, 1, 10, 20, 30, 40, 50, 60, 100, 200, 300},
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
operationFailureCount: metrics.NewCounterVec(
|
operationFailureCount: metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
@ -178,7 +178,7 @@ func registerOperationMetrics(attributes ...string) *operationCallMetrics {
|
|||||||
Help: "Number of failed Azure service operations",
|
Help: "Number of failed Azure service operations",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ var (
|
|||||||
"version", // API version.
|
"version", // API version.
|
||||||
}
|
}
|
||||||
|
|
||||||
apiMetrics = registerAPIMetrics(metricLabels...)
|
apiMetrics = registerAPIMetrics()
|
||||||
)
|
)
|
||||||
|
|
||||||
type metricContext struct {
|
type metricContext struct {
|
||||||
@ -84,7 +84,7 @@ func newGenericMetricContext(prefix, request, region, zone, version string) *met
|
|||||||
}
|
}
|
||||||
|
|
||||||
// registerApiMetrics adds metrics definitions for a category of API calls.
|
// registerApiMetrics adds metrics definitions for a category of API calls.
|
||||||
func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
func registerAPIMetrics() *apiCallMetrics {
|
||||||
metrics := &apiCallMetrics{
|
metrics := &apiCallMetrics{
|
||||||
latency: metrics.NewHistogramVec(
|
latency: metrics.NewHistogramVec(
|
||||||
&metrics.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
@ -92,7 +92,7 @@ func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
|||||||
Help: "Latency of a GCE API call",
|
Help: "Latency of a GCE API call",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
errors: metrics.NewCounterVec(
|
errors: metrics.NewCounterVec(
|
||||||
&metrics.CounterOpts{
|
&metrics.CounterOpts{
|
||||||
@ -100,7 +100,7 @@ func registerAPIMetrics(attributes ...string) *apiCallMetrics {
|
|||||||
Help: "Number of errors for an API call",
|
Help: "Number of errors for an API call",
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
attributes,
|
metricLabels,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user