Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5abe207e
Commit
5abe207e
authored
Apr 30, 2018
by
Fabio Bertinatto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add metric for throttled requests in AWS
parent
81bf821d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
15 deletions
+29
-15
aws.go
pkg/cloudprovider/providers/aws/aws.go
+0
-10
aws_metrics.go
pkg/cloudprovider/providers/aws/aws_metrics.go
+20
-0
retry_handler.go
pkg/cloudprovider/providers/aws/retry_handler.go
+9
-5
No files found.
pkg/cloudprovider/providers/aws/aws.go
View file @
5abe207e
...
...
@@ -44,7 +44,6 @@ import (
"github.com/aws/aws-sdk-go/service/kms"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/record"
...
...
@@ -4329,12 +4328,3 @@ func setNodeDisk(
}
volumeMap
[
volumeID
]
=
check
}
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
)
}
}
pkg/cloudprovider/providers/aws/aws_metrics.go
View file @
5abe207e
...
...
@@ -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
)
}
pkg/cloudprovider/providers/aws/retry_handler.go
View file @
5abe207e
...
...
@@ -69,16 +69,19 @@ func (c *CrossRequestRetryDelay) BeforeSign(r *request.Request) {
}
}
// Return a user-friendly string describing the request, for use in log messages
func
describeRequest
(
r
*
request
.
Request
)
string
{
service
:=
r
.
ClientInfo
.
ServiceName
// Return the operation name, for use in log messages and metrics
func
operationName
(
r
*
request
.
Request
)
string
{
name
:=
"?"
if
r
.
Operation
!=
nil
{
name
=
r
.
Operation
.
Name
}
return
name
}
return
service
+
"::"
+
name
// Return a user-friendly string describing the request, for use in log messages
func
describeRequest
(
r
*
request
.
Request
)
string
{
service
:=
r
.
ClientInfo
.
ServiceName
return
service
+
"::"
+
operationName
(
r
)
}
// Added to the AfterRetry chain; called after any error
...
...
@@ -92,6 +95,7 @@ func (c *CrossRequestRetryDelay) AfterRetry(r *request.Request) {
}
if
awsError
.
Code
()
==
"RequestLimitExceeded"
{
c
.
backoff
.
ReportError
()
recordAWSThrottlesMetric
(
operationName
(
r
))
glog
.
Warningf
(
"Got RequestLimitExceeded error on AWS request (%s)"
,
describeRequest
(
r
))
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment