Skip to content

Commit

Permalink
Revert "Allow Retry Of EC2MetadataError For IMDS" (#56)
Browse files Browse the repository at this point in the history
This reverts commit 28d3e18.
  • Loading branch information
sky333999 authored Jul 18, 2023
1 parent 0f1881d commit 082d76a
Show file tree
Hide file tree
Showing 34 changed files with 38 additions and 220 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ jobs:
git diff --exit-code '.github/ISSUE_TEMPLATE' || (echo 'Dropdowns in issue templates are out of date, please run "make generate-gh-issue-templates" and commit the changes in this PR.' && exit 1)
unittest-matrix:
strategy:
fail-fast: false
matrix:
go-version: ["1.20", 1.19] # 1.20 is interpreted as 1.2 without quotes
group:
Expand Down
2 changes: 1 addition & 1 deletion cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ require (
github.com/alecthomas/participle/v2 v2.0.0 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aliyun/aliyun-log-go-sdk v0.1.44 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/antonmedv/expr v1.12.5 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
Expand Down
2 changes: 0 additions & 2 deletions cmd/otelcontribcol/exporters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"runtime"
"testing"

override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -497,7 +496,6 @@ func TestDefaultExporters(t *testing.T) {
expectedExporters[k] = struct{}{}
}
for _, tt := range tests {
override.IMDSRetryer = nil
_, ok := expFactories[tt.exporter]
if !ok {
// not part of the distro, skipping.
Expand Down
2 changes: 1 addition & 1 deletion cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/otelcontrib
go 1.19

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab
github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.77.0
Expand Down Expand Up @@ -270,6 +269,7 @@ require (
github.com/alecthomas/participle/v2 v2.0.0 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aliyun/aliyun-log-go-sdk v0.1.44 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/antonmedv/expr v1.12.5 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
Expand Down
2 changes: 1 addition & 1 deletion exporter/awscloudwatchlogsexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsemfexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsxrayexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
3 changes: 1 addition & 2 deletions exporter/datadogexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ package datadogexporter
import (
"testing"

override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/confmap"
)

func TestValidate(t *testing.T) {
override.IMDSRetryer = nil

tests := []struct {
name string
cfg *Config
Expand Down
5 changes: 1 addition & 4 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datado

go 1.19

replace github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws => ../../override/aws

require (
github.com/DataDog/agent-payload/v5 v5.0.83
github.com/DataDog/datadog-agent/pkg/trace v0.45.0-rc.4
Expand All @@ -14,8 +12,7 @@ require (
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.2.0
github.com/DataDog/sketches-go v1.4.2
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.13.1
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab
github.com/aws/aws-sdk-go v1.44.293
github.com/aws/aws-sdk-go v1.44.255
github.com/cenkalti/backoff/v4 v4.2.1
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.77.0
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"sync"

"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source"
override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
Expand Down Expand Up @@ -65,7 +65,7 @@ func GetHostInfo(logger *zap.Logger) (hostInfo *HostInfo) {
}

meta := ec2metadata.New(sess, &aws.Config{
Retryer: override.IMDSRetryer,
Retryer: client.DefaultRetryer{NumMaxRetries: 5},
})

if idDoc, err := meta.GetInstanceIdentityDocument(); err == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/azure"
override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -65,7 +64,6 @@ var (
)

func TestFillHostMetadata(t *testing.T) {
override.IMDSRetryer = nil
params := exportertest.NewNopCreateSettings()
params.BuildInfo = mockBuildInfo

Expand Down
3 changes: 1 addition & 2 deletions extension/awsproxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab // indirect
github.com/aws/aws-sdk-go v1.44.293 // indirect
github.com/aws/aws-sdk-go v1.44.255 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
6 changes: 2 additions & 4 deletions extension/awsproxy/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ require (
github.com/alecthomas/participle/v2 v2.0.0 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aliyun/aliyun-log-go-sdk v0.1.44 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/antonmedv/expr v1.12.5 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
Expand Down
3 changes: 2 additions & 1 deletion internal/aws/awsutil/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/defaults"
Expand All @@ -47,7 +48,7 @@ type Conn struct{}

func (c *Conn) getEC2Region(s *session.Session) (string, error) {
return ec2metadata.New(s, &aws.Config{
Retryer: override.IMDSRetryer,
Retryer: client.DefaultRetryer{NumMaxRetries: 5},
}).Region()
}

Expand Down
2 changes: 1 addition & 1 deletion internal/aws/awsutil/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/aw
go 1.19

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4
github.com/aws/aws-sdk-go v1.44.293
github.com/stretchr/testify v1.8.2
go.uber.org/zap v1.24.0
Expand Down
4 changes: 2 additions & 2 deletions internal/aws/proxy/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"strings"
"time"

override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
Expand Down Expand Up @@ -81,7 +81,7 @@ var newAWSSession = func(roleArn string, region string, log *zap.Logger) (*sessi

var getEC2Region = func(s *session.Session) (string, error) {
return ec2metadata.New(s, &aws.Config{
Retryer: override.IMDSRetryer,
Retryer: client.DefaultRetryer{NumMaxRetries: 5},
}).Region()
}

Expand Down
5 changes: 1 addition & 4 deletions internal/aws/proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/pr

go 1.19

replace github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws => ../../../override/aws

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab
github.com/aws/aws-sdk-go v1.44.293
github.com/aws/aws-sdk-go v1.44.255
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.77.0
github.com/stretchr/testify v1.8.2
go.opentelemetry.io/collector v0.77.0
Expand Down
4 changes: 2 additions & 2 deletions internal/aws/proxy/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/aws/xray/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xr
go 1.19

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab
github.com/aws/aws-sdk-go v1.44.293
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.77.0
github.com/stretchr/testify v1.8.2
Expand All @@ -12,6 +11,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230712194013-e85dd5f17ce4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions internal/aws/xray/telemetry/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"sync"
"time"

override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/xray"
Expand Down Expand Up @@ -190,7 +190,7 @@ func ToOptions(cfg Config, sess *session.Session, settings *awsutil.AWSSessionSe
}
if !settings.LocalMode {
metadataClient := ec2metadata.New(sess, &aws.Config{
Retryer: override.IMDSRetryer,
Retryer: client.DefaultRetryer{NumMaxRetries: 5},
})
hostnameProviders = append(hostnameProviders, ec2MetadataProvider{
client: metadataClient,
Expand Down
4 changes: 2 additions & 2 deletions internal/metadataproviders/aws/ec2/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package ec2 // import "github.com/open-telemetry/opentelemetry-collector-contrib
import (
"context"

override "github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
)
Expand All @@ -38,7 +38,7 @@ var _ Provider = (*metadataClient)(nil)
func NewProvider(sess *session.Session) Provider {
return &metadataClient{
metadata: ec2metadata.New(sess, &aws.Config{
Retryer: override.IMDSRetryer,
Retryer: client.DefaultRetryer{NumMaxRetries: 5},
}),
}
}
Expand Down
5 changes: 1 addition & 4 deletions internal/metadataproviders/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/internal/metada

go 1.19

replace github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws => ../../override/aws

require (
github.com/Showmax/go-fqdn v1.0.0
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230714201444-77612b3cbeab
github.com/aws/aws-sdk-go v1.44.293
github.com/aws/aws-sdk-go v1.44.255
github.com/docker/docker v23.0.5+incompatible
github.com/hashicorp/consul/api v1.20.0
github.com/panta/machineid v1.0.2
Expand Down
4 changes: 2 additions & 2 deletions internal/metadataproviders/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions override/aws/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ module github.com/amazon-contributing/opentelemetry-collector-contrib/override/a
go 1.19

require github.com/aws/aws-sdk-go v1.44.293

require github.com/jmespath/go-jmespath v0.4.0 // indirect
5 changes: 0 additions & 5 deletions override/aws/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 082d76a

Please sign in to comment.