Skip to content

Commit

Permalink
update test to match changes in open-telemetry/opentelemetry-collecto…
Browse files Browse the repository at this point in the history
…r#7017

Signed-off-by: Alex Boten <aboten@lightstep.com>
  • Loading branch information
Alex Boten committed Feb 1, 2023
1 parent e963596 commit 43133d4
Show file tree
Hide file tree
Showing 42 changed files with 178 additions and 110 deletions.
11 changes: 7 additions & 4 deletions exporter/awscloudwatchlogsexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"path/filepath"
"testing"

"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -58,10 +59,12 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(typeStr, "e2-no-retries-short-queue"),
expected: &Config{
RetrySettings: exporterhelper.RetrySettings{
Enabled: false,
InitialInterval: defaultRetrySettings.InitialInterval,
MaxInterval: defaultRetrySettings.MaxInterval,
MaxElapsedTime: defaultRetrySettings.MaxElapsedTime,
Enabled: false,
InitialInterval: defaultRetrySettings.InitialInterval,
MaxInterval: defaultRetrySettings.MaxInterval,
MaxElapsedTime: defaultRetrySettings.MaxElapsedTime,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
LogGroupName: "test-2",
Expand Down
2 changes: 1 addition & 1 deletion exporter/awscloudwatchlogsexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.18

require (
github.com/aws/aws-sdk-go v1.44.189
github.com/cenkalti/backoff/v4 v4.2.0
github.com/google/uuid v1.3.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.70.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.70.0
Expand All @@ -18,7 +19,6 @@ require (
)

require (
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
Expand Down
11 changes: 7 additions & 4 deletions exporter/awskinesisexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -60,10 +61,12 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(typeStr, ""),
expected: &Config{
RetrySettings: exporterhelper.RetrySettings{
Enabled: false,
MaxInterval: 30 * time.Second,
InitialInterval: 5 * time.Second,
MaxElapsedTime: 300 * time.Second,
Enabled: false,
MaxInterval: 30 * time.Second,
InitialInterval: 5 * time.Second,
MaxElapsedTime: 300 * time.Second,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
TimeoutSettings: exporterhelper.NewDefaultTimeoutSettings(),
QueueSettings: exporterhelper.NewDefaultQueueSettings(),
Expand Down
2 changes: 1 addition & 1 deletion exporter/awskinesisexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/aws/aws-sdk-go-v2/credentials v1.13.10
github.com/aws/aws-sdk-go-v2/service/kinesis v1.17.0
github.com/aws/aws-sdk-go-v2/service/sts v1.18.2
github.com/cenkalti/backoff/v4 v4.2.0
github.com/gogo/protobuf v1.3.2
github.com/google/uuid v1.3.0
github.com/jaegertracing/jaeger v1.41.0
Expand Down Expand Up @@ -35,7 +36,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand Down
11 changes: 7 additions & 4 deletions exporter/clickhouseexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -65,10 +66,12 @@ func TestLoadConfig(t *testing.T) {
Timeout: 5 * time.Second,
},
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
InitialInterval: 5 * time.Second,
MaxInterval: 30 * time.Second,
MaxElapsedTime: 300 * time.Second,
Enabled: true,
InitialInterval: 5 * time.Second,
MaxInterval: 30 * time.Second,
MaxElapsedTime: 300 * time.Second,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
QueueSettings: QueueSettings{
QueueSize: 100,
Expand Down
2 changes: 1 addition & 1 deletion exporter/clickhouseexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.18

require (
github.com/ClickHouse/clickhouse-go/v2 v2.4.3
github.com/cenkalti/backoff/v4 v4.2.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.70.0
github.com/stretchr/testify v1.8.1
go.opentelemetry.io/collector v0.70.1-0.20230130215412-26bd7b2bf678
Expand All @@ -19,7 +20,6 @@ require (
github.com/ClickHouse/ch-go v0.50.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
Expand Down
7 changes: 4 additions & 3 deletions exporter/datadogexporter/internal/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/otlp/model/attributes/gcp"
"github.com/DataDog/datadog-agent/pkg/otlp/model/source"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/pdata/pcommon"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.uber.org/zap"
Expand Down Expand Up @@ -106,13 +107,13 @@ type Meta struct {
// metadataFromAttributes gets metadata info from attributes following
// OpenTelemetry semantic conventions
func metadataFromAttributes(attrs pcommon.Map) *HostMetadata {
return metadataFromAttributesWithRegistry(attrs)
return metadataFromAttributesWithRegistry(HostnamePreviewFeatureGate, attrs)
}

func metadataFromAttributesWithRegistry(attrs pcommon.Map) *HostMetadata {
func metadataFromAttributesWithRegistry(gate *featuregate.Gate, attrs pcommon.Map) *HostMetadata {
hm := &HostMetadata{Meta: &Meta{}, Tags: &HostTags{}}

var usePreviewHostnameLogic = HostnamePreviewFeatureGate.IsEnabled()
var usePreviewHostnameLogic = gate.IsEnabled()
if src, ok := attributes.SourceFromAttributes(attrs, usePreviewHostnameLogic); ok && src.Kind == source.HostnameKind {
hm.InternalHostname = src.Identifier
hm.Meta.Hostname = src.Identifier
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/internal/metadata/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ func TestMetadataFromAttributes(t *testing.T) {
for _, testInstance := range tests {
t.Run(testInstance.name, func(t *testing.T) {
registry := featuregate.NewRegistry()
registry.MustRegister(HostnamePreviewFeatureGate.ID(), featuregate.StageBeta)
gate := registry.MustRegister(HostnamePreviewFeatureGate.ID(), featuregate.StageBeta)
require.NoError(t, registry.Set(HostnamePreviewFeatureGate.ID(), testInstance.usePreviewHostnameLogic))
metadata := metadataFromAttributesWithRegistry(testInstance.attrs)
metadata := metadataFromAttributesWithRegistry(gate, testInstance.attrs)
assert.Equal(t, testInstance.expected.InternalHostname, metadata.InternalHostname)
assert.Equal(t, testInstance.expected.Meta, metadata.Meta)
assert.ElementsMatch(t, testInstance.expected.Tags.GCP, metadata.Tags.GCP)
Expand Down
11 changes: 7 additions & 4 deletions exporter/f5cloudexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand All @@ -43,10 +44,12 @@ func TestLoadConfig(t *testing.T) {
expectedCfg := &Config{
Config: otlphttp.Config{
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
QueueSettings: exporterhelper.QueueSettings{
Enabled: true,
Expand Down
2 changes: 1 addition & 1 deletion exporter/f5cloudexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/f5clou
go 1.18

require (
github.com/cenkalti/backoff/v4 v4.2.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.70.0
github.com/stretchr/testify v1.8.1
go.opentelemetry.io/collector v0.70.1-0.20230130215412-26bd7b2bf678
Expand All @@ -16,7 +17,6 @@ require (
require (
cloud.google.com/go/compute v1.14.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down
11 changes: 7 additions & 4 deletions exporter/googlecloudexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"time"

"github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector"
"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -74,10 +75,12 @@ func TestLoadConfig(t *testing.T) {
},
},
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
QueueSettings: exporterhelper.QueueSettings{
Enabled: true,
Expand Down
4 changes: 2 additions & 2 deletions exporter/googlecloudexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.18

require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector v0.35.0
github.com/cenkalti/backoff/v4 v4.2.0
github.com/stretchr/testify v1.8.1
go.opentelemetry.io/collector v0.70.1-0.20230130215412-26bd7b2bf678
go.opentelemetry.io/collector/component v0.70.1-0.20230130215412-26bd7b2bf678
Expand All @@ -21,7 +22,6 @@ require (
cloud.google.com/go/trace v1.8.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.11.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.35.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
Expand Down Expand Up @@ -62,7 +62,7 @@ require (
google.golang.org/api v0.108.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa // indirect
google.golang.org/grpc v1.52.1 // indirect
google.golang.org/grpc v1.52.3 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
4 changes: 2 additions & 2 deletions exporter/googlecloudexporter/go.sum

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

11 changes: 7 additions & 4 deletions exporter/googlemanagedprometheusexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -53,10 +54,12 @@ func TestLoadConfig(t *testing.T) {
UserAgent: "opentelemetry-collector-contrib {{version}}",
},
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
QueueSettings: exporterhelper.QueueSettings{
Enabled: true,
Expand Down
2 changes: 1 addition & 1 deletion exporter/googlemanagedprometheusexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.18
require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector v0.35.0
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector/googlemanagedprometheus v0.35.0
github.com/cenkalti/backoff/v4 v4.2.0
github.com/stretchr/testify v1.8.1
go.opentelemetry.io/collector v0.70.1-0.20230130215412-26bd7b2bf678
go.opentelemetry.io/collector/component v0.70.1-0.20230130215412-26bd7b2bf678
Expand All @@ -22,7 +23,6 @@ require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.11.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.35.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand Down
5 changes: 5 additions & 0 deletions exporter/influxdbexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"testing"
"time"

// TODO: uncomment this after update core dependencies
// "github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -60,6 +62,9 @@ func TestLoadConfig(t *testing.T) {
InitialInterval: 1 * time.Second,
MaxInterval: 3 * time.Second,
MaxElapsedTime: 10 * time.Second,
// TODO: uncomment these after update core dependencies
// RandomizationFactor: backoff.DefaultRandomizationFactor,
// Multiplier: backoff.DefaultMultiplier,
},
Org: "my-org",
Bucket: "my-bucket",
Expand Down
11 changes: 7 additions & 4 deletions exporter/jaegerexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -48,10 +49,12 @@ func TestLoadConfig(t *testing.T) {
Timeout: 10 * time.Second,
},
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
QueueSettings: exporterhelper.QueueSettings{
Enabled: true,
Expand Down
2 changes: 1 addition & 1 deletion exporter/jaegerexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaeger
go 1.18

require (
github.com/cenkalti/backoff/v4 v4.2.0
github.com/jaegertracing/jaeger v1.41.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.70.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.70.0
Expand All @@ -20,7 +21,6 @@ require (
require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/apache/thrift v0.17.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
Expand Down
11 changes: 7 additions & 4 deletions exporter/kafkaexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/Shopify/sarama"
"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
Expand All @@ -45,10 +46,12 @@ func TestLoadConfig(t *testing.T) {
Timeout: 10 * time.Second,
},
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
QueueSettings: exporterhelper.QueueSettings{
Enabled: true,
Expand Down
Loading

0 comments on commit 43133d4

Please sign in to comment.