mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-02 14:51:58 +00:00
Add metric for throttled requests in AWS
This commit is contained in:
@@ -32,9 +32,29 @@ var (
|
||||
Help: "AWS API errors",
|
||||
},
|
||||
[]string{"request"})
|
||||
|
||||
awsAPIThrottlesMetric = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: "cloudprovider_aws_api_throttled_requests_total",
|
||||
Help: "AWS API throttled requests",
|
||||
},
|
||||
[]string{"operation_name"})
|
||||
)
|
||||
|
||||
func recordAWSMetric(actionName string, timeTaken float64, err error) {
|
||||
if err != nil {
|
||||
awsAPIErrorMetric.With(prometheus.Labels{"request": actionName}).Inc()
|
||||
} else {
|
||||
awsAPIMetric.With(prometheus.Labels{"request": actionName}).Observe(timeTaken)
|
||||
}
|
||||
}
|
||||
|
||||
func recordAWSThrottlesMetric(operation string) {
|
||||
awsAPIThrottlesMetric.With(prometheus.Labels{"operation_name": operation}).Inc()
|
||||
}
|
||||
|
||||
func registerMetrics() {
|
||||
prometheus.MustRegister(awsAPIMetric)
|
||||
prometheus.MustRegister(awsAPIErrorMetric)
|
||||
prometheus.MustRegister(awsAPIThrottlesMetric)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user