diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 15:59:15 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 16:39:21 +0200 |
commit | 863486a6b71ed0e562a3965bed56465d007b1418 (patch) | |
tree | e93f6a687695af86d54237ec9f575d4ef104222d /vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go | |
parent | 49c1c7b4dc69ffb9ab52330e6dc52ccdd6351087 (diff) | |
download | terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.gz terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.zst terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.zip |
update vendor and go.modadd_contact_groups
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go index 0b5571a..c7008d8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go | |||
@@ -10,11 +10,6 @@ import ( | |||
10 | "github.com/aws/aws-sdk-go/aws/request" | 10 | "github.com/aws/aws-sdk-go/aws/request" |
11 | ) | 11 | ) |
12 | 12 | ||
13 | const ( | ||
14 | // DefaultPort is used when no port is specified | ||
15 | DefaultPort = "31000" | ||
16 | ) | ||
17 | |||
18 | // Reporter will gather metrics of API requests made and | 13 | // Reporter will gather metrics of API requests made and |
19 | // send those metrics to the CSM endpoint. | 14 | // send those metrics to the CSM endpoint. |
20 | type Reporter struct { | 15 | type Reporter struct { |
@@ -96,7 +91,7 @@ func getMetricException(err awserr.Error) metricException { | |||
96 | 91 | ||
97 | switch code { | 92 | switch code { |
98 | case "RequestError", | 93 | case "RequestError", |
99 | "SerializationError", | 94 | request.ErrCodeSerialization, |
100 | request.CanceledErrorCode: | 95 | request.CanceledErrorCode: |
101 | return sdkException{ | 96 | return sdkException{ |
102 | requestException{exception: code, message: msg}, | 97 | requestException{exception: code, message: msg}, |
@@ -123,7 +118,7 @@ func (rep *Reporter) sendAPICallMetric(r *request.Request) { | |||
123 | Type: aws.String("ApiCall"), | 118 | Type: aws.String("ApiCall"), |
124 | AttemptCount: aws.Int(r.RetryCount + 1), | 119 | AttemptCount: aws.Int(r.RetryCount + 1), |
125 | Region: r.Config.Region, | 120 | Region: r.Config.Region, |
126 | Latency: aws.Int(int(time.Now().Sub(r.Time) / time.Millisecond)), | 121 | Latency: aws.Int(int(time.Since(r.Time) / time.Millisecond)), |
127 | XAmzRequestID: aws.String(r.RequestID), | 122 | XAmzRequestID: aws.String(r.RequestID), |
128 | MaxRetriesExceeded: aws.Int(boolIntValue(r.RetryCount >= r.MaxRetries())), | 123 | MaxRetriesExceeded: aws.Int(boolIntValue(r.RetryCount >= r.MaxRetries())), |
129 | } | 124 | } |
@@ -190,8 +185,9 @@ func (rep *Reporter) start() { | |||
190 | } | 185 | } |
191 | } | 186 | } |
192 | 187 | ||
193 | // Pause will pause the metric channel preventing any new metrics from | 188 | // Pause will pause the metric channel preventing any new metrics from being |
194 | // being added. | 189 | // added. It is safe to call concurrently with other calls to Pause, but if |
190 | // called concurently with Continue can lead to unexpected state. | ||
195 | func (rep *Reporter) Pause() { | 191 | func (rep *Reporter) Pause() { |
196 | lock.Lock() | 192 | lock.Lock() |
197 | defer lock.Unlock() | 193 | defer lock.Unlock() |
@@ -203,8 +199,9 @@ func (rep *Reporter) Pause() { | |||
203 | rep.close() | 199 | rep.close() |
204 | } | 200 | } |
205 | 201 | ||
206 | // Continue will reopen the metric channel and allow for monitoring | 202 | // Continue will reopen the metric channel and allow for monitoring to be |
207 | // to be resumed. | 203 | // resumed. It is safe to call concurrently with other calls to Continue, but |
204 | // if called concurently with Pause can lead to unexpected state. | ||
208 | func (rep *Reporter) Continue() { | 205 | func (rep *Reporter) Continue() { |
209 | lock.Lock() | 206 | lock.Lock() |
210 | defer lock.Unlock() | 207 | defer lock.Unlock() |
@@ -219,10 +216,18 @@ func (rep *Reporter) Continue() { | |||
219 | rep.metricsCh.Continue() | 216 | rep.metricsCh.Continue() |
220 | } | 217 | } |
221 | 218 | ||
219 | // Client side metric handler names | ||
220 | const ( | ||
221 | APICallMetricHandlerName = "awscsm.SendAPICallMetric" | ||
222 | APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" | ||
223 | ) | ||
224 | |||
222 | // InjectHandlers will will enable client side metrics and inject the proper | 225 | // InjectHandlers will will enable client side metrics and inject the proper |
223 | // handlers to handle how metrics are sent. | 226 | // handlers to handle how metrics are sent. |
224 | // | 227 | // |
225 | // Example: | 228 | // InjectHandlers is NOT safe to call concurrently. Calling InjectHandlers |
229 | // multiple times may lead to unexpected behavior, (e.g. duplicate metrics). | ||
230 | // | ||
226 | // // Start must be called in order to inject the correct handlers | 231 | // // Start must be called in order to inject the correct handlers |
227 | // r, err := csm.Start("clientID", "127.0.0.1:8094") | 232 | // r, err := csm.Start("clientID", "127.0.0.1:8094") |
228 | // if err != nil { | 233 | // if err != nil { |