Skip to content

Commit

Permalink
Update core to latest, start using helpers to construct config settin…
Browse files Browse the repository at this point in the history
…gs (#2957)

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Apr 1, 2021
1 parent 7276360 commit 5fe49ca
Show file tree
Hide file tree
Showing 287 changed files with 622 additions and 805 deletions.
2 changes: 1 addition & 1 deletion exporter/alibabacloudlogserviceexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import "go.opentelemetry.io/collector/config"

// Config defines configuration for AlibabaCloud Log Service exporter.
type Config struct {
config.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
*config.ExporterSettings `mapstructure:"-"`
// LogService's Endpoint, https://www.alibabacloud.com/help/doc-detail/29008.htm
// for AlibabaCloud Kubernetes(or ECS), set {region-id}-intranet.log.aliyuncs.com, eg cn-hangzhou-intranet.log.aliyuncs.com;
// others set {region-id}.log.aliyuncs.com, eg cn-hangzhou.log.aliyuncs.com
Expand Down
2 changes: 1 addition & 1 deletion exporter/alibabacloudlogserviceexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestLoadConfig(t *testing.T) {

e1 := cfg.Exporters[expectedName]
expectedCfg := Config{
ExporterSettings: config.ExporterSettings{
ExporterSettings: &config.ExporterSettings{
TypeVal: config.Type(typeStr),
NameVal: expectedName,
},
Expand Down
5 changes: 1 addition & 4 deletions exporter/alibabacloudlogserviceexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ func NewFactory() component.ExporterFactory {
// CreateDefaultConfig creates the default configuration for exporter.
func createDefaultConfig() config.Exporter {
return &Config{
ExporterSettings: config.ExporterSettings{
TypeVal: config.Type(typeStr),
NameVal: typeStr,
},
ExporterSettings: config.NewExporterSettings(typeStr),
}
}

Expand Down
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.23.1-0.20210331231428-f8bdcf682f15
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf
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 @@ -907,8 +907,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.23.1-0.20210331231428-f8bdcf682f15 h1:3U6eZM3+ZZ87T1i6vbvo3g0DpbhMiwp1o3KSm+O7qxM=
go.opentelemetry.io/collector v0.23.1-0.20210331231428-f8bdcf682f15/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf h1:0eFtPrybUN7R8ZN7nwWKeco+3xemkjLCrXDmOY9+Wj0=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
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
17 changes: 10 additions & 7 deletions exporter/alibabacloudlogserviceexporter/logs_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer/pdata"
"go.opentelemetry.io/collector/translator/conventions"
"go.uber.org/zap"
Expand Down Expand Up @@ -54,9 +55,10 @@ func createSimpleLogData(numberOfLogs int) pdata.Logs {

func TestNewLogsExporter(t *testing.T) {
got, err := newLogsExporter(zap.NewNop(), &Config{
Endpoint: "us-west-1.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
ExporterSettings: config.NewExporterSettings(typeStr),
Endpoint: "us-west-1.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
})
assert.NoError(t, err)
require.NotNil(t, got)
Expand All @@ -69,10 +71,11 @@ func TestNewLogsExporter(t *testing.T) {

func TestSTSTokenExporter(t *testing.T) {
got, err := newLogsExporter(zap.NewNop(), &Config{
Endpoint: "us-west-1.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
TokenFilePath: path.Join(".", "testdata", "config.yaml"),
ExporterSettings: config.NewExporterSettings(typeStr),
Endpoint: "us-west-1.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
TokenFilePath: path.Join(".", "testdata", "config.yaml"),
})
assert.NoError(t, err)
require.NotNil(t, got)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ import (
metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/testutil/metricstestutil"
"go.opentelemetry.io/collector/translator/internaldata"
"go.uber.org/zap"
)

func TestNewMetricsExporter(t *testing.T) {
got, err := newMetricsExporter(zap.NewNop(), &Config{
Endpoint: "us-west-1.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
ExporterSettings: config.NewExporterSettings(typeStr),
Endpoint: "us-west-1.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
})
assert.NoError(t, err)
require.NotNil(t, got)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer/pdata"
"go.uber.org/zap"
)

func TestNewTraceExporter(t *testing.T) {

got, err := newTraceExporter(zap.NewNop(), &Config{
Endpoint: "cn-hangzhou.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
ExporterSettings: config.NewExporterSettings(typeStr),
Endpoint: "cn-hangzhou.log.aliyuncs.com",
Project: "demo-project",
Logstore: "demo-logstore",
})
assert.NoError(t, err)
require.NotNil(t, got)
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsemfexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (

// Config defines configuration for AWS EMF exporter.
type Config struct {
config.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
*config.ExporterSettings `mapstructure:"-"`
// LogGroupName is the name of CloudWatch log group which defines group of log streams
// that share the same retention, monitoring, and access control settings.
LogGroupName string `mapstructure:"log_group_name"`
Expand Down
6 changes: 3 additions & 3 deletions exporter/awsemfexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestLoadConfig(t *testing.T) {
r1.Validate()
assert.Equal(t,
&Config{
ExporterSettings: config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsemf/1"},
ExporterSettings: &config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsemf/1"},
LogGroupName: "",
LogStreamName: "",
Endpoint: "",
Expand All @@ -70,7 +70,7 @@ func TestLoadConfig(t *testing.T) {
r2.Validate()
assert.Equal(t, r2,
&Config{
ExporterSettings: config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsemf/resource_attr_to_label"},
ExporterSettings: &config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsemf/resource_attr_to_label"},
LogGroupName: "",
LogStreamName: "",
Endpoint: "",
Expand All @@ -97,7 +97,7 @@ func TestConfigValidate(t *testing.T) {
{unit: "Megabytes", metricName: "memory_usage"},
}
config := &Config{
ExporterSettings: config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsemf/resource_attr_to_label"},
ExporterSettings: &config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsemf/resource_attr_to_label"},
RequestTimeoutSeconds: 30,
MaxRetries: 1,
DimensionRollupOption: "ZeroAndSingleDimensionRollup",
Expand Down
5 changes: 1 addition & 4 deletions exporter/awsemfexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ func NewFactory() component.ExporterFactory {
// CreateDefaultConfig creates the default configuration for exporter.
func createDefaultConfig() config.Exporter {
return &Config{
ExporterSettings: config.ExporterSettings{
TypeVal: config.Type(typeStr),
NameVal: typeStr,
},
ExporterSettings: config.NewExporterSettings(typeStr),
LogGroupName: "",
LogStreamName: "",
Namespace: "",
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsemfexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws 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.23.1-0.20210331231428-f8bdcf682f15
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf
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/awsemfexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1047,8 +1047,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.23.1-0.20210331231428-f8bdcf682f15 h1:3U6eZM3+ZZ87T1i6vbvo3g0DpbhMiwp1o3KSm+O7qxM=
go.opentelemetry.io/collector v0.23.1-0.20210331231428-f8bdcf682f15/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf h1:0eFtPrybUN7R8ZN7nwWKeco+3xemkjLCrXDmOY9+Wj0=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
go.opentelemetry.io/otel v0.19.0 h1:Lenfy7QHRXPZVsw/12CWpxX6d/JkrX8wrx2vO8G80Ng=
go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg=
go.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc=
Expand Down
2 changes: 1 addition & 1 deletion exporter/awskinesisexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type KPLConfig struct {

// Config contains the main configuration options for the awskinesis exporter
type Config struct {
config.ExporterSettings `mapstructure:",squash"`
*config.ExporterSettings `mapstructure:"-"`

AWS AWSConfig `mapstructure:"aws"`
KPL KPLConfig `mapstructure:"kpl"`
Expand Down
10 changes: 2 additions & 8 deletions exporter/awskinesisexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ func TestDefaultConfig(t *testing.T) {

assert.Equal(t, e,
&Config{
ExporterSettings: config.ExporterSettings{
TypeVal: "awskinesis",
NameVal: "awskinesis",
},
ExporterSettings: config.NewExporterSettings(typeStr),
AWS: AWSConfig{
Region: "us-west-2",
},
Expand Down Expand Up @@ -83,10 +80,7 @@ func TestConfig(t *testing.T) {

assert.Equal(t, e,
&Config{
ExporterSettings: config.ExporterSettings{
TypeVal: "awskinesis",
NameVal: "awskinesis",
},
ExporterSettings: config.NewExporterSettings(typeStr),
AWS: AWSConfig{
StreamName: "test-stream",
KinesisEndpoint: "awskinesis.mars-1.aws.galactic",
Expand Down
5 changes: 1 addition & 4 deletions exporter/awskinesisexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ func NewFactory() component.ExporterFactory {

func createDefaultConfig() config.Exporter {
return &Config{
ExporterSettings: config.ExporterSettings{
TypeVal: typeStr,
NameVal: typeStr,
},
ExporterSettings: config.NewExporterSettings(typeStr),
AWS: AWSConfig{
Region: "us-west-2",
},
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.23.1-0.20210331231428-f8bdcf682f15
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf
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 @@ -1077,8 +1077,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.23.1-0.20210331231428-f8bdcf682f15 h1:3U6eZM3+ZZ87T1i6vbvo3g0DpbhMiwp1o3KSm+O7qxM=
go.opentelemetry.io/collector v0.23.1-0.20210331231428-f8bdcf682f15/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf h1:0eFtPrybUN7R8ZN7nwWKeco+3xemkjLCrXDmOY9+Wj0=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
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/awsprometheusremotewriteexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestLoadConfig(t *testing.T) {
e1 := cfg.Exporters["awsprometheusremotewrite/2"]
cfgComplete := &Config{
Config: prw.Config{
ExporterSettings: config.ExporterSettings{
ExporterSettings: &config.ExporterSettings{
NameVal: "awsprometheusremotewrite/2",
TypeVal: "awsprometheusremotewrite",
},
Expand Down
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.23.1-0.20210331231428-f8bdcf682f15
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf
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 @@ -1047,8 +1047,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.23.1-0.20210331231428-f8bdcf682f15 h1:3U6eZM3+ZZ87T1i6vbvo3g0DpbhMiwp1o3KSm+O7qxM=
go.opentelemetry.io/collector v0.23.1-0.20210331231428-f8bdcf682f15/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf h1:0eFtPrybUN7R8ZN7nwWKeco+3xemkjLCrXDmOY9+Wj0=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
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/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import "go.opentelemetry.io/collector/config"

// Config defines configuration for AWS X-Ray exporter.
type Config struct {
config.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
*config.ExporterSettings `mapstructure:"-"`
// Maximum number of concurrent calls to AWS X-Ray to upload documents.
NumberOfWorkers int `mapstructure:"num_workers"`
// X-Ray service endpoint to which the collector sends segment documents.
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsxrayexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestLoadConfig(t *testing.T) {
r1 := cfg.Exporters["awsxray/customname"].(*Config)
assert.Equal(t, r1,
&Config{
ExporterSettings: config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsxray/customname"},
ExporterSettings: &config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: "awsxray/customname"},
NumberOfWorkers: 8,
Endpoint: "",
RequestTimeoutSeconds: 30,
Expand Down
5 changes: 1 addition & 4 deletions exporter/awsxrayexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ func NewFactory() component.ExporterFactory {

func createDefaultConfig() config.Exporter {
return &Config{
ExporterSettings: config.ExporterSettings{
TypeVal: config.Type(typeStr),
NameVal: typeStr,
},
ExporterSettings: config.NewExporterSettings(typeStr),
NumberOfWorkers: 8,
Endpoint: "",
RequestTimeoutSeconds: 30,
Expand Down
5 changes: 1 addition & 4 deletions exporter/awsxrayexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ func TestCreateDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.Equal(t, cfg, &Config{
ExporterSettings: config.ExporterSettings{
TypeVal: config.Type(typeStr),
NameVal: typeStr,
},
ExporterSettings: config.NewExporterSettings(typeStr),
NumberOfWorkers: 8,
Endpoint: "",
RequestTimeoutSeconds: 30,
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsxrayexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/awsxray 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.23.1-0.20210331231428-f8bdcf682f15
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf
go.uber.org/zap v1.16.0
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
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 @@ -1047,8 +1047,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.23.1-0.20210331231428-f8bdcf682f15 h1:3U6eZM3+ZZ87T1i6vbvo3g0DpbhMiwp1o3KSm+O7qxM=
go.opentelemetry.io/collector v0.23.1-0.20210331231428-f8bdcf682f15/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf h1:0eFtPrybUN7R8ZN7nwWKeco+3xemkjLCrXDmOY9+Wj0=
go.opentelemetry.io/collector v0.23.1-0.20210331235005-1edaf40cedaf/go.mod h1:2mL8mFNp96idZ7zW/7IpKBaLryUBlfPs9nBrGcOeioM=
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
11 changes: 5 additions & 6 deletions exporter/azuremonitorexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import (

// Config defines configuration for Azure Monitor
type Config struct {
// squash ensures fields are correctly decoded in embedded struct.
config.ExporterSettings `mapstructure:",squash"`
Endpoint string `mapstructure:"endpoint"`
InstrumentationKey string `mapstructure:"instrumentation_key"`
MaxBatchSize int `mapstructure:"maxbatchsize"`
MaxBatchInterval time.Duration `mapstructure:"maxbatchinterval"`
*config.ExporterSettings `mapstructure:"-"`
Endpoint string `mapstructure:"endpoint"`
InstrumentationKey string `mapstructure:"instrumentation_key"`
MaxBatchSize int `mapstructure:"maxbatchsize"`
MaxBatchInterval time.Duration `mapstructure:"maxbatchinterval"`
}
2 changes: 1 addition & 1 deletion exporter/azuremonitorexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestLoadConfig(t *testing.T) {
assert.Equal(
t,
&Config{
ExporterSettings: config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: exporterType},
ExporterSettings: &config.ExporterSettings{TypeVal: config.Type(typeStr), NameVal: exporterType},
Endpoint: defaultEndpoint,
InstrumentationKey: "abcdefg",
MaxBatchSize: 100,
Expand Down
5 changes: 1 addition & 4 deletions exporter/azuremonitorexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ type factory struct {

func createDefaultConfig() config.Exporter {
return &Config{
ExporterSettings: config.ExporterSettings{
TypeVal: config.Type(typeStr),
NameVal: typeStr,
},
ExporterSettings: config.NewExporterSettings(typeStr),
Endpoint: defaultEndpoint,
MaxBatchSize: 1024,
MaxBatchInterval: 10 * time.Second,
Expand Down
Loading

0 comments on commit 5fe49ca

Please sign in to comment.