Skip to content

Commit

Permalink
Add go.mod and setup Go module
Browse files Browse the repository at this point in the history
Note that AWS SDK for Go (v1) version 1.21.6 is where CloudWatch Logs
added the LogGroupNames field to clouwatchlogs.StartQueryInput.
Previously you could only query one log group at a time.

See:

- aws/aws-sdk-go#2718
- https://github.com/aws/aws-sdk-go/releases/tag/v1.21.6

As of this checkpoint, `$ go test` is passing on go1.16.4 windows/amd64
and go go1.15.12 linux/amd64 but I haven't tested either on Go 1.13
(the expected minimum required version) or on MacOS.
  • Loading branch information
vcschapp committed Jul 15, 2021
1 parent c994c4b commit 39f9410
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/gogama/incite

go 1.13

require (
github.com/aws/aws-sdk-go v1.21.6
github.com/stretchr/testify v1.7.0
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
)
24 changes: 24 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
github.com/aws/aws-sdk-go v1.21.6 h1:3GuIm55Uls52aQIDGBnSEZbk073jpasfQyeM5eZU61Q=
github.com/aws/aws-sdk-go v1.21.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
25 changes: 10 additions & 15 deletions incite.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,22 +554,17 @@ func (m *mgr) startNextChunk() error { // Assert: Lock is acquired.
}

func isTemporary(err error) bool {
switch x := err.(type) {
case *cloudwatchlogs.DataAlreadyAcceptedException, *cloudwatchlogs.InvalidOperationException,
*cloudwatchlogs.InvalidParameterException, *cloudwatchlogs.InvalidSequenceTokenException,
*cloudwatchlogs.MalformedQueryException, *cloudwatchlogs.OperationAbortedException,
*cloudwatchlogs.ResourceAlreadyExistsException, *cloudwatchlogs.ResourceNotFoundException,
*cloudwatchlogs.UnrecognizedClientException:
return false
case *cloudwatchlogs.LimitExceededException, *cloudwatchlogs.ServiceUnavailableException:
return true
case awserr.RequestFailure:
// Omit 'e' suffix on 'throttl' to match Throttled and Throttling.
return strings.Contains(strings.ToLower(x.Code()), "throttl") ||
strings.Contains(strings.ToLower(x.Message()), "rate exceeded")
default:
return false
if x, ok := err.(awserr.RequestFailure); ok {
switch x.Code() {
case cloudwatchlogs.ErrCodeLimitExceededException, cloudwatchlogs.ErrCodeServiceUnavailableException:
return true
default:
// Omit 'e' suffix on 'throttl' to match Throttled and Throttling.
return strings.Contains(strings.ToLower(x.Code()), "throttl") ||
strings.Contains(strings.ToLower(x.Message()), "rate exceeded")
}
}
return false
}

func (m *mgr) pollNextChunk() int {
Expand Down

0 comments on commit 39f9410

Please sign in to comment.