Skip to content

Commit

Permalink
Merge pull request open-telemetry#62 from sethAmazon/reduce-retry-time
Browse files Browse the repository at this point in the history
Reduce Retry Time And Add imds Fallback Client
  • Loading branch information
sethAmazon authored Jul 28, 2023
2 parents d272937 + c958fb9 commit d1a9d11
Show file tree
Hide file tree
Showing 76 changed files with 298 additions and 173 deletions.
4 changes: 2 additions & 2 deletions 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-20230719154634-7dfcb28377c2 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // 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 All @@ -286,7 +286,7 @@ require (
github.com/apache/thrift v0.18.1 // indirect
github.com/ardielle/ardielle-go v1.5.2 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.44.293 // indirect
github.com/aws/aws-sdk-go v1.44.309 // indirect
github.com/aws/aws-sdk-go-v2 v1.18.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.22 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/configschema/go.sum

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

4 changes: 2 additions & 2 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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-20230719154634-7dfcb28377c2
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83
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 @@ -278,7 +278,7 @@ require (
github.com/apache/thrift v0.18.1 // indirect
github.com/ardielle/ardielle-go v1.5.2 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.44.293 // indirect
github.com/aws/aws-sdk-go v1.44.309 // indirect
github.com/aws/aws-sdk-go-v2 v1.18.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.22 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcontribcol/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 cmd/oteltestbedcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require (
github.com/antonmedv/expr v1.12.5 // indirect
github.com/apache/thrift v0.18.1 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.44.255 // indirect
github.com/aws/aws-sdk-go v1.44.309 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bmatcuk/doublestar/v4 v4.6.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/oteltestbedcol/go.sum

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

4 changes: 2 additions & 2 deletions exporter/awscloudwatchlogsexporter/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/exporter/awsclo
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.293
github.com/aws/aws-sdk-go v1.44.309
github.com/cenkalti/backoff/v4 v4.2.1
github.com/google/uuid v1.3.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.77.0
Expand All @@ -19,7 +19,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230719154634-7dfcb28377c2 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // 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 exporter/awscloudwatchlogsexporter/go.sum

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

4 changes: 2 additions & 2 deletions exporter/awsemfexporter/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/exporter/awsemf
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.293
github.com/aws/aws-sdk-go v1.44.309
github.com/census-instrumentation/opencensus-proto v0.4.1
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.0
Expand All @@ -24,7 +24,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230719154634-7dfcb28377c2 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // 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
4 changes: 2 additions & 2 deletions exporter/awsemfexporter/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 exporter/awss3exporter/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/exporter/awss3e
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.255
github.com/aws/aws-sdk-go v1.44.309
github.com/stretchr/testify v1.8.2
go.opentelemetry.io/collector v0.77.0
go.opentelemetry.io/collector/component v0.77.0
Expand Down
4 changes: 2 additions & 2 deletions exporter/awss3exporter/go.sum

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

4 changes: 2 additions & 2 deletions exporter/awsxrayexporter/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/exporter/awsxra
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.293
github.com/aws/aws-sdk-go v1.44.309
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.77.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.77.0
Expand All @@ -18,7 +18,7 @@ require (
)

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230719154634-7dfcb28377c2 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // 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
4 changes: 2 additions & 2 deletions exporter/awsxrayexporter/go.sum

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

4 changes: 2 additions & 2 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ 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-20230719154634-7dfcb28377c2
github.com/aws/aws-sdk-go v1.44.293
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83
github.com/aws/aws-sdk-go v1.44.309
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.

24 changes: 21 additions & 3 deletions exporter/datadogexporter/internal/hostmetadata/internal/ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,37 @@ func GetHostInfo(logger *zap.Logger) (hostInfo *HostInfo) {
defer cancel()

meta := ec2metadata.New(sess, &aws.Config{
Retryer: override.IMDSRetryer,
Retryer: override.IMDSRetryer,
EC2MetadataEnableFallback: aws.Bool(false),
})

metaFallbackEnable := ec2metadata.New(sess, &aws.Config{
Retryer: override.IMDSRetryer,
EC2MetadataEnableFallback: aws.Bool(false),
})

if idDoc, err := meta.GetInstanceIdentityDocumentWithContext(ctx); err == nil {
hostInfo.InstanceID = idDoc.InstanceID
} else {
logger.Warn("Failed to get EC2 instance id document", zap.Error(err))
childCtxFallbackEnable, cancelRetryEnable := context.WithTimeout(ctx, override.TimePerCall)
defer cancelRetryEnable()
if idDocInner, errInner := meta.GetInstanceIdentityDocumentWithContext(childCtxFallbackEnable); errInner == nil {
hostInfo.InstanceID = idDocInner.InstanceID
} else {
logger.Warn("Failed to get EC2 instance id document", zap.Error(err))
}
}

if ec2Hostname, err := meta.GetMetadataWithContext(ctx, "hostname"); err == nil {
hostInfo.EC2Hostname = ec2Hostname
} else {
logger.Warn("Failed to get EC2 hostname", zap.Error(err))
childCtxFallbackEnable, cancelRetryEnable := context.WithTimeout(ctx, override.TimePerCall)
defer cancelRetryEnable()
if ec2HostnameInner, errInner := metaFallbackEnable.GetMetadataWithContext(childCtxFallbackEnable, "hostname"); errInner == nil {
hostInfo.EC2Hostname = ec2HostnameInner
} else {
logger.Warn("Failed to get EC2 hostname", zap.Error(err))
}
}

return
Expand Down
2 changes: 1 addition & 1 deletion exporter/kafkaexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/Shopify/sarama v1.38.1
github.com/aws/aws-sdk-go v1.44.255
github.com/aws/aws-sdk-go v1.44.309
github.com/cenkalti/backoff/v4 v4.2.1
github.com/gogo/protobuf v1.3.2
github.com/jaegertracing/jaeger v1.41.0
Expand Down
4 changes: 2 additions & 2 deletions exporter/kafkaexporter/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 exporter/prometheusexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.44.255 // indirect
github.com/aws/aws-sdk-go v1.44.309 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/prometheusexporter/go.sum

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

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

require (
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230719154634-7dfcb28377c2 // indirect
github.com/aws/aws-sdk-go v1.44.293 // indirect
github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20230727225902-317222bcea83 // indirect
github.com/aws/aws-sdk-go v1.44.309 // 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
Loading

0 comments on commit d1a9d11

Please sign in to comment.