Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update core to latest & fix impacted components #3442

Closed
wants to merge 15 commits into from
2 changes: 1 addition & 1 deletion exporter/alibabacloudlogserviceexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
gopkg.in/ini.v1 v1.57.0 // indirect
)
4 changes: 2 additions & 2 deletions exporter/alibabacloudlogserviceexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsemfexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
google.golang.org/protobuf v1.26.0
)
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsemfexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/otel v0.20.0 h1:eaP0Fqu7SXHwvjiqDq83zImeehOHX8doTvU9AwXON8g=
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo=
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
Expand Down
2 changes: 1 addition & 1 deletion exporter/awskinesisexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/signalfx/opencensus-go-exporter-kinesis v0.6.3
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
gopkg.in/ini.v1 v1.57.0 // indirect
)
4 changes: 2 additions & 2 deletions exporter/awskinesisexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
5 changes: 3 additions & 2 deletions exporter/awsprometheusremotewriteexporter/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
v4 "github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configtls"
)
Expand Down Expand Up @@ -63,7 +64,7 @@ func TestRequestSignature(t *testing.T) {
return newSigningRoundTripperWithCredentials(authConfig, awsCreds, next, sdkInformation)
},
}
client, _ := setting.ToClient()
client, _ := setting.ToClient(componenttest.NewNopHost().GetExtensions())
req, err := http.NewRequest("POST", setting.Endpoint, strings.NewReader("a=1&b=2"))
assert.NoError(t, err)
_, err = client.Do(req)
Expand Down Expand Up @@ -109,7 +110,7 @@ func TestLeakingBody(t *testing.T) {
return newSigningRoundTripperWithCredentials(authConfig, awsCreds, next, sdkInformation)
},
}
client, _ := setting.ToClient()
client, _ := setting.ToClient(componenttest.NewNopHost().GetExtensions())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer, you can use something like map[config.ComponentID]component.Extension{} instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also a great option, @jpkrohling! Which way do you believe is the correct convention for us to use moving forward? I know we typically use componentest when possible, so I thought following that pattern made the most sense at the time of this PR.

checker := &checkCloser{Reader: strings.NewReader("a=1&b=2")}
req, err := http.NewRequest("POST", setting.Endpoint, checker)
assert.NoError(t, err)
Expand Down
36 changes: 23 additions & 13 deletions exporter/awsprometheusremotewriteexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configcheck"
"go.opentelemetry.io/collector/config/confighttp"
Expand Down Expand Up @@ -75,31 +76,40 @@ func TestCreateMetricsExporter(t *testing.T) {
cfg config.Exporter
params component.ExporterCreateParams
returnError bool
startError bool
}{
{"success_case_with_auth",
validConfigWithAuth,
component.ExporterCreateParams{Logger: zap.NewNop()},
false,
{
name: "success_case_with_auth",
cfg: validConfigWithAuth,
params: component.ExporterCreateParams{Logger: zap.NewNop()},
returnError: false,
},
{"invalid_config_case",
invalidConfig,
component.ExporterCreateParams{Logger: zap.NewNop()},
true,
{
name: "invalid_config_case",
cfg: invalidConfig,
params: component.ExporterCreateParams{Logger: zap.NewNop()},
returnError: true,
},
{"invalid_tls_config_case",
invalidTLSConfig,
component.ExporterCreateParams{Logger: zap.NewNop()},
true,
{
name: "invalid_tls_config_case",
cfg: invalidTLSConfig,
params: component.ExporterCreateParams{Logger: zap.NewNop()},
returnError: false,
startError: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := af.CreateMetricsExporter(context.Background(), tt.params, tt.cfg)
exp, err := af.CreateMetricsExporter(context.Background(), tt.params, tt.cfg)
if tt.returnError {
assert.Error(t, err)
return
}
assert.NoError(t, err)
err = exp.Start(context.Background(), componenttest.NewNopHost())
if tt.startError {
assert.Error(t, err)
}
})
}
}
2 changes: 1 addition & 1 deletion exporter/awsprometheusremotewriteexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/onsi/gomega v1.10.2 // indirect
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
gopkg.in/ini.v1 v1.57.0 // indirect
)
4 changes: 2 additions & 2 deletions exporter/awsprometheusremotewriteexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsxrayexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-00010101000000-000000000000
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
gopkg.in/ini.v1 v1.57.0 // indirect
)
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsxrayexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
2 changes: 1 addition & 1 deletion exporter/azuremonitorexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/tedsuo/ifrit v0.0.0-20191009134036-9a97d0632f00 // indirect
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
golang.org/x/net v0.0.0-20210427231257-85d9c07bbe3a
gopkg.in/ini.v1 v1.57.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/azuremonitorexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
2 changes: 1 addition & 1 deletion exporter/carbonexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/onsi/gomega v1.10.2 // indirect
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
google.golang.org/protobuf v1.26.0
gopkg.in/ini.v1 v1.57.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/carbonexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/stretchr/testify v1.7.0
github.com/tinylib/msgp v1.1.5 // indirect
github.com/zorkian/go-datadog-api v2.29.0+incompatible // indirect
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
gopkg.in/DataDog/dd-trace-go.v1 v1.30.0
gopkg.in/ini.v1 v1.57.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1094,8 +1094,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
7 changes: 2 additions & 5 deletions exporter/dynatraceexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,15 @@ func createMetricsExporter(
return nil, err
}

exp, err := newMetricsExporter(params, cfg)

if err != nil {
return nil, err
}
exp := newMetricsExporter(params, cfg)

return exporterhelper.NewMetricsExporter(
cfg,
params.Logger,
exp.PushMetricsData,
exporterhelper.WithQueue(cfg.QueueSettings),
exporterhelper.WithRetry(cfg.RetrySettings),
exporterhelper.WithStart(exp.start),
exporterhelper.WithResourceToTelemetryConversion(cfg.ResourceToTelemetrySettings),
)
}
2 changes: 1 addition & 1 deletion exporter/dynatraceexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/onsi/gomega v1.10.2 // indirect
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
gopkg.in/ini.v1 v1.57.0 // indirect
)
4 changes: 2 additions & 2 deletions exporter/dynatraceexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e h1:bN5lZMmX8/6W9lDaawNZonKA9t/lgPq1laO1crBIbBc=
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66 h1:U/XU+17DcSE6IGOVSbQIEmXSOIOHpSqnKN64wfIRS7E=
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66/go.mod h1:J2oCzkvFAkgmgrvIdQNg5Dt3QAZ+ep7HNtHPay/7nvo=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
21 changes: 14 additions & 7 deletions exporter/dynatraceexporter/metrics_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,11 @@ import (
const maxChunkSize = 1000

// NewExporter exports to a Dynatrace Metrics v2 API
func newMetricsExporter(params component.ExporterCreateParams, cfg *config.Config) (*exporter, error) {
client, err := cfg.HTTPClientSettings.ToClient()
if err != nil {
return nil, err
}
func newMetricsExporter(params component.ExporterCreateParams, cfg *config.Config) *exporter {
return &exporter{
logger: params.Logger,
cfg: cfg,
client: client,
}, nil
}
}

// exporter forwards metrics to a Dynatrace agent
Expand Down Expand Up @@ -232,6 +227,18 @@ func (e *exporter) sendBatch(ctx context.Context, lines []string) (int, error) {
return 0, nil
}

// start starts the exporter
func (e *exporter) start(_ context.Context, host component.Host) (err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used in the factory as "WithStart" so it will not be called.

client, err := e.cfg.HTTPClientSettings.ToClient(host.GetExtensions())
if err != nil {
return err
}

e.client = client

return nil
}

// normalizeMetricName formats the custom namespace and view name to
// Metric naming Conventions
func normalizeMetricName(prefix, name string) (string, error) {
Expand Down
24 changes: 24 additions & 0 deletions exporter/dynatraceexporter/metrics_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ import (
"net/http/httptest"
"testing"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/consumer/consumererror"
"go.opentelemetry.io/collector/consumer/pdata"
"go.uber.org/zap"
Expand Down Expand Up @@ -468,6 +471,27 @@ func Test_exporter_PushMetricsData_Error(t *testing.T) {
})
}

func Test_exporter_start_InvalidHTTPClientSettings(t *testing.T) {
config := &config.Config{
HTTPClientSettings: confighttp.HTTPClientSettings{
Endpoint: "localhost:9090",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: "/non/existent",
},
},
},
}

exp := newMetricsExporter(component.ExporterCreateParams{Logger: zap.NewNop()}, config)

err := exp.start(context.Background(), componenttest.NewNopHost())
if err == nil {
t.Errorf("Expected error when creating a metrics exporter with invalid HTTP Client Settings")
return
}
}

func Test_normalizeMetricName(t *testing.T) {
type args struct {
prefix string
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/stretchr/testify v1.7.0
go.elastic.co/apm v1.9.1-0.20201218004853-18a8126106c6
go.elastic.co/fastjson v1.1.0
go.opentelemetry.io/collector v0.27.1-0.20210520162255-f7674b2f593e
go.opentelemetry.io/collector v0.27.1-0.20210520180039-2e84285efc66
go.uber.org/zap v1.16.0
gopkg.in/ini.v1 v1.57.0 // indirect
howett.net/plist v0.0.0-20201026045517-117a925f2150 // indirect
Expand Down
Loading