diff --git a/exporter/carbonexporter/config.go b/exporter/carbonexporter/config.go index 420e948ac4a7..de3d0f75e08d 100644 --- a/exporter/carbonexporter/config.go +++ b/exporter/carbonexporter/config.go @@ -18,7 +18,7 @@ import ( // Config defines configuration for Carbon exporter. type Config struct { // Specifies the connection endpoint config. The default value is "localhost:2003". - confignet.TCPAddr `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct. + confignet.TCPAddrConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct. // MaxIdleConns is used to set a limit to the maximum idle TCP connections the client can keep open. Default value is 100. // If `sending_queue` is enabled, it is recommended to use same value as `sending_queue::num_consumers`. MaxIdleConns int `mapstructure:"max_idle_conns"` diff --git a/exporter/carbonexporter/config_test.go b/exporter/carbonexporter/config_test.go index 4c1fc2ca0a86..767908147d08 100644 --- a/exporter/carbonexporter/config_test.go +++ b/exporter/carbonexporter/config_test.go @@ -39,7 +39,7 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "allsettings"), expected: &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "localhost:8080", }, MaxIdleConns: 15, @@ -94,7 +94,7 @@ func TestValidateConfig(t *testing.T) { { name: "invalid_tcp_addr", config: &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "http://localhost:2003", }, }, @@ -103,7 +103,7 @@ func TestValidateConfig(t *testing.T) { { name: "invalid_timeout", config: &Config{ - TCPAddr: confignet.TCPAddr{Endpoint: defaultEndpoint}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: defaultEndpoint}, TimeoutSettings: exporterhelper.TimeoutSettings{ Timeout: -5 * time.Second, }, @@ -113,8 +113,8 @@ func TestValidateConfig(t *testing.T) { { name: "invalid_max_idle_conns", config: &Config{ - TCPAddr: confignet.TCPAddr{Endpoint: defaultEndpoint}, - MaxIdleConns: -1, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: defaultEndpoint}, + MaxIdleConns: -1, }, wantErr: true, }, diff --git a/exporter/carbonexporter/exporter.go b/exporter/carbonexporter/exporter.go index 3414833e6e8f..a0c6610ba746 100644 --- a/exporter/carbonexporter/exporter.go +++ b/exporter/carbonexporter/exporter.go @@ -22,7 +22,7 @@ import ( func newCarbonExporter(ctx context.Context, cfg *Config, set exporter.CreateSettings) (exporter.Metrics, error) { sender := carbonSender{ writeTimeout: cfg.Timeout, - conns: newConnPool(cfg.TCPAddr, cfg.Timeout, cfg.MaxIdleConns), + conns: newConnPool(cfg.TCPAddrConfig, cfg.Timeout, cfg.MaxIdleConns), } exp, err := exporterhelper.NewMetricsExporter( @@ -104,7 +104,7 @@ type connPool interface { } func newConnPool( - tcpConfig confignet.TCPAddr, + tcpConfig confignet.TCPAddrConfig, timeout time.Duration, maxIdleConns int, ) connPool { @@ -124,7 +124,7 @@ func newConnPool( // nopConnPool is a very simple implementation that does not cache any net.Conn. type nopConnPool struct { timeout time.Duration - tcpConfig confignet.TCPAddr + tcpConfig confignet.TCPAddrConfig } func (cp *nopConnPool) get() (net.Conn, error) { @@ -149,7 +149,7 @@ type connPoolWithIdle struct { maxIdleConns int mtx sync.Mutex conns []net.Conn - tcpConfig confignet.TCPAddr + tcpConfig confignet.TCPAddrConfig } func (cp *connPoolWithIdle) get() (net.Conn, error) { @@ -195,7 +195,7 @@ func (cp *connPoolWithIdle) close() error { return errs } -func createTCPConn(tcpConfig confignet.TCPAddr, timeout time.Duration) (net.Conn, error) { +func createTCPConn(tcpConfig confignet.TCPAddrConfig, timeout time.Duration) (net.Conn, error) { c, err := net.DialTimeout("tcp", tcpConfig.Endpoint, timeout) if err != nil { return nil, err diff --git a/exporter/carbonexporter/exporter_test.go b/exporter/carbonexporter/exporter_test.go index 471423ac08e2..5af6e35befae 100644 --- a/exporter/carbonexporter/exporter_test.go +++ b/exporter/carbonexporter/exporter_test.go @@ -41,7 +41,7 @@ func TestConsumeMetricsNoServer(t *testing.T) { exp, err := newCarbonExporter( context.Background(), &Config{ - TCPAddr: confignet.TCPAddr{Endpoint: testutil.GetAvailableLocalAddress(t)}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: testutil.GetAvailableLocalAddress(t)}, TimeoutSettings: exporterhelper.TimeoutSettings{Timeout: 5 * time.Second}, }, exportertest.NewNopCreateSettings()) @@ -61,7 +61,7 @@ func TestConsumeMetricsWithResourceToTelemetry(t *testing.T) { exp, err := newCarbonExporter( context.Background(), &Config{ - TCPAddr: confignet.TCPAddr{Endpoint: addr}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: addr}, TimeoutSettings: exporterhelper.TimeoutSettings{Timeout: 5 * time.Second}, ResourceToTelemetryConfig: resourcetotelemetry.Settings{Enabled: true}, }, @@ -126,7 +126,7 @@ func TestConsumeMetrics(t *testing.T) { exp, err := newCarbonExporter( context.Background(), &Config{ - TCPAddr: confignet.TCPAddr{Endpoint: addr}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: addr}, MaxIdleConns: tt.numProducers, TimeoutSettings: exporterhelper.TimeoutSettings{Timeout: 5 * time.Second}, }, @@ -159,8 +159,8 @@ func TestConsumeMetrics(t *testing.T) { } func TestNewConnectionPool(t *testing.T) { - assert.IsType(t, &nopConnPool{}, newConnPool(confignet.TCPAddr{Endpoint: defaultEndpoint}, 10*time.Second, 0)) - assert.IsType(t, &connPoolWithIdle{}, newConnPool(confignet.TCPAddr{Endpoint: defaultEndpoint}, 10*time.Second, 10)) + assert.IsType(t, &nopConnPool{}, newConnPool(confignet.TCPAddrConfig{Endpoint: defaultEndpoint}, 10*time.Second, 0)) + assert.IsType(t, &connPoolWithIdle{}, newConnPool(confignet.TCPAddrConfig{Endpoint: defaultEndpoint}, 10*time.Second, 10)) } func TestNopConnPool(t *testing.T) { @@ -172,7 +172,7 @@ func TestNopConnPool(t *testing.T) { cp := &nopConnPool{ timeout: 1 * time.Second, - tcpConfig: confignet.TCPAddr{Endpoint: addr}, + tcpConfig: confignet.TCPAddrConfig{Endpoint: addr}, } conn, err := cp.get() @@ -202,7 +202,7 @@ func TestConnPoolWithIdle(t *testing.T) { cp := &connPoolWithIdle{ timeout: 1 * time.Second, - tcpConfig: confignet.TCPAddr{Endpoint: addr}, + tcpConfig: confignet.TCPAddrConfig{Endpoint: addr}, maxIdleConns: 4, } @@ -234,7 +234,7 @@ func TestConnPoolWithIdleMaxConnections(t *testing.T) { cp := &connPoolWithIdle{ timeout: 1 * time.Second, - tcpConfig: confignet.TCPAddr{Endpoint: addr}, + tcpConfig: confignet.TCPAddrConfig{Endpoint: addr}, maxIdleConns: maxIdleConns, } diff --git a/exporter/carbonexporter/factory.go b/exporter/carbonexporter/factory.go index 15d55328ccd6..687d5dd6d707 100644 --- a/exporter/carbonexporter/factory.go +++ b/exporter/carbonexporter/factory.go @@ -30,7 +30,7 @@ func NewFactory() exporter.Factory { func createDefaultConfig() component.Config { return &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: defaultEndpoint, }, MaxIdleConns: 100, diff --git a/exporter/datadogexporter/config.go b/exporter/datadogexporter/config.go index 8bd19e4abdf8..2a8f6770cccc 100644 --- a/exporter/datadogexporter/config.go +++ b/exporter/datadogexporter/config.go @@ -55,7 +55,7 @@ type MetricsConfig struct { // TCPAddr.Endpoint is the host of the Datadog intake server to send metrics to. // If unset, the value is obtained from the Site. - confignet.TCPAddr `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` ExporterConfig MetricsExporterConfig `mapstructure:",squash"` @@ -248,7 +248,7 @@ type MetricsExporterConfig struct { type TracesConfig struct { // TCPAddr.Endpoint is the host of the Datadog intake server to send traces to. // If unset, the value is obtained from the Site. - confignet.TCPAddr `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` // ignored resources // A blacklist of regular expressions can be provided to disable certain traces based on their resource name @@ -310,7 +310,7 @@ type TracesConfig struct { type LogsConfig struct { // TCPAddr.Endpoint is the host of the Datadog intake server to send logs to. // If unset, the value is obtained from the Site. - confignet.TCPAddr `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` // DumpPayloads report whether payloads should be dumped when logging level is debug. DumpPayloads bool `mapstructure:"dump_payloads"` @@ -573,17 +573,17 @@ func (c *Config) Unmarshal(configMap *confmap.Conf) error { // If an endpoint is not explicitly set, override it based on the site. if !configMap.IsSet("metrics::endpoint") { - c.Metrics.TCPAddr.Endpoint = fmt.Sprintf("https://api.%s", c.API.Site) + c.Metrics.TCPAddrConfig.Endpoint = fmt.Sprintf("https://api.%s", c.API.Site) } if !configMap.IsSet("traces::endpoint") { - c.Traces.TCPAddr.Endpoint = fmt.Sprintf("https://trace.agent.%s", c.API.Site) + c.Traces.TCPAddrConfig.Endpoint = fmt.Sprintf("https://trace.agent.%s", c.API.Site) } if !configMap.IsSet("logs::endpoint") { - c.Logs.TCPAddr.Endpoint = fmt.Sprintf("https://http-intake.logs.%s", c.API.Site) + c.Logs.TCPAddrConfig.Endpoint = fmt.Sprintf("https://http-intake.logs.%s", c.API.Site) } // Return an error if an endpoint is explicitly set to "" - if c.Metrics.TCPAddr.Endpoint == "" || c.Traces.TCPAddr.Endpoint == "" || c.Logs.TCPAddr.Endpoint == "" { + if c.Metrics.TCPAddrConfig.Endpoint == "" || c.Traces.TCPAddrConfig.Endpoint == "" || c.Logs.TCPAddrConfig.Endpoint == "" { return errEmptyEndpoint } diff --git a/exporter/datadogexporter/factory.go b/exporter/datadogexporter/factory.go index e82076ab4596..5cda467dcdab 100644 --- a/exporter/datadogexporter/factory.go +++ b/exporter/datadogexporter/factory.go @@ -188,7 +188,7 @@ func (f *factory) createDefaultConfig() component.Config { }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://api.datadoghq.com", }, DeltaTTL: 3600, @@ -210,14 +210,14 @@ func (f *factory) createDefaultConfig() component.Config { }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://trace.agent.datadoghq.com", }, IgnoreResources: []string{}, }, Logs: LogsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://http-intake.logs.datadoghq.com", }, }, diff --git a/exporter/datadogexporter/factory_test.go b/exporter/datadogexporter/factory_test.go index 904da56cc630..7e82bf1c6c7f 100644 --- a/exporter/datadogexporter/factory_test.go +++ b/exporter/datadogexporter/factory_test.go @@ -80,7 +80,7 @@ func TestCreateDefaultConfig(t *testing.T) { }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://api.datadoghq.com", }, DeltaTTL: 3600, @@ -98,13 +98,13 @@ func TestCreateDefaultConfig(t *testing.T) { }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://trace.agent.datadoghq.com", }, IgnoreResources: []string{}, }, Logs: LogsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://http-intake.logs.datadoghq.com", }, }, @@ -142,7 +142,7 @@ func TestLoadConfig(t *testing.T) { }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://api.datadoghq.com", }, DeltaTTL: 3600, @@ -160,13 +160,13 @@ func TestLoadConfig(t *testing.T) { }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://trace.agent.datadoghq.com", }, IgnoreResources: []string{}, }, Logs: LogsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://http-intake.logs.datadoghq.com", }, }, @@ -192,7 +192,7 @@ func TestLoadConfig(t *testing.T) { FailOnInvalidKey: true, }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://api.datadoghq.eu", }, DeltaTTL: 3600, @@ -209,7 +209,7 @@ func TestLoadConfig(t *testing.T) { }, }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://trace.agent.datadoghq.eu", }, SpanNameRemappings: map[string]string{ @@ -221,7 +221,7 @@ func TestLoadConfig(t *testing.T) { TraceBuffer: 10, }, Logs: LogsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://http-intake.logs.datadoghq.eu", }, }, @@ -247,7 +247,7 @@ func TestLoadConfig(t *testing.T) { FailOnInvalidKey: false, }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://api.datadoghq.test", }, DeltaTTL: 3600, @@ -264,7 +264,7 @@ func TestLoadConfig(t *testing.T) { }, }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://trace.agent.datadoghq.test", }, SpanNameRemappings: map[string]string{ @@ -274,7 +274,7 @@ func TestLoadConfig(t *testing.T) { IgnoreResources: []string{}, }, Logs: LogsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "https://http-intake.logs.datadoghq.test", }, }, @@ -411,7 +411,7 @@ func TestCreateAPIMetricsExporter(t *testing.T) { require.NoError(t, component.UnmarshalConfig(sub, cfg)) c := cfg.(*Config) - c.Metrics.TCPAddr.Endpoint = server.URL + c.Metrics.TCPAddrConfig.Endpoint = server.URL c.HostMetadata.Enabled = false ctx := context.Background() @@ -445,7 +445,7 @@ func TestCreateAPIExporterFailOnInvalidKey_Zorkian(t *testing.T) { // Use the mock server for API key validation c := cfg.(*Config) - c.Metrics.TCPAddr.Endpoint = server.URL + c.Metrics.TCPAddrConfig.Endpoint = server.URL c.HostMetadata.Enabled = false t.Run("true", func(t *testing.T) { @@ -525,7 +525,7 @@ func TestCreateAPIExporterFailOnInvalidKey(t *testing.T) { // Use the mock server for API key validation c := cfg.(*Config) - c.Metrics.TCPAddr.Endpoint = server.URL + c.Metrics.TCPAddrConfig.Endpoint = server.URL c.HostMetadata.Enabled = false t.Run("true", func(t *testing.T) { @@ -599,7 +599,7 @@ func TestCreateAPILogsExporter(t *testing.T) { require.NoError(t, component.UnmarshalConfig(sub, cfg)) c := cfg.(*Config) - c.Metrics.TCPAddr.Endpoint = server.URL + c.Metrics.TCPAddrConfig.Endpoint = server.URL c.HostMetadata.Enabled = false ctx := context.Background() @@ -625,8 +625,8 @@ func TestOnlyMetadata(t *testing.T) { QueueSettings: exporterhelper.NewDefaultQueueSettings(), API: APIConfig{Key: "notnull"}, - Metrics: MetricsConfig{TCPAddr: confignet.TCPAddr{Endpoint: server.URL}}, - Traces: TracesConfig{TCPAddr: confignet.TCPAddr{Endpoint: server.URL}}, + Metrics: MetricsConfig{TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: server.URL}}, + Traces: TracesConfig{TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: server.URL}}, OnlyMetadata: true, HostMetadata: HostMetadataConfig{ diff --git a/exporter/datadogexporter/logs_exporter.go b/exporter/datadogexporter/logs_exporter.go index a51663ebdecb..58c8de9275f2 100644 --- a/exporter/datadogexporter/logs_exporter.go +++ b/exporter/datadogexporter/logs_exporter.go @@ -55,12 +55,12 @@ func newLogsExporter( if isMetricExportV2Enabled() { apiClient := clientutil.CreateAPIClient( params.BuildInfo, - cfg.Metrics.TCPAddr.Endpoint, + cfg.Metrics.TCPAddrConfig.Endpoint, cfg.TimeoutSettings, cfg.LimitedClientConfig.TLSSetting.InsecureSkipVerify) go func() { errchan <- clientutil.ValidateAPIKey(ctx, string(cfg.API.Key), params.Logger, apiClient) }() } else { - client := clientutil.CreateZorkianClient(string(cfg.API.Key), cfg.Metrics.TCPAddr.Endpoint) + client := clientutil.CreateZorkianClient(string(cfg.API.Key), cfg.Metrics.TCPAddrConfig.Endpoint) go func() { errchan <- clientutil.ValidateAPIKeyZorkian(params.Logger, client) }() } // validate the apiKey @@ -74,7 +74,7 @@ func newLogsExporter( if err != nil { return nil, fmt.Errorf("failed to create logs translator: %w", err) } - s := logs.NewSender(cfg.Logs.TCPAddr.Endpoint, params.Logger, cfg.TimeoutSettings, cfg.LimitedClientConfig.TLSSetting.InsecureSkipVerify, cfg.Logs.DumpPayloads, string(cfg.API.Key)) + s := logs.NewSender(cfg.Logs.TCPAddrConfig.Endpoint, params.Logger, cfg.TimeoutSettings, cfg.LimitedClientConfig.TLSSetting.InsecureSkipVerify, cfg.Logs.DumpPayloads, string(cfg.API.Key)) return &logsExporter{ params: params, diff --git a/exporter/datadogexporter/logs_exporter_test.go b/exporter/datadogexporter/logs_exporter_test.go index f2e9fb5d1ab4..3f858f71f903 100644 --- a/exporter/datadogexporter/logs_exporter_test.go +++ b/exporter/datadogexporter/logs_exporter_test.go @@ -214,12 +214,12 @@ func TestLogsExporter(t *testing.T) { defer server.Close() cfg := &Config{ Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: server.URL, }, }, Logs: LogsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: server.URL, }, }, diff --git a/exporter/datadogexporter/metrics_exporter.go b/exporter/datadogexporter/metrics_exporter.go index 2d39f7f8675a..9835d52e1997 100644 --- a/exporter/datadogexporter/metrics_exporter.go +++ b/exporter/datadogexporter/metrics_exporter.go @@ -128,13 +128,13 @@ func newMetricsExporter( if isMetricExportV2Enabled() { apiClient := clientutil.CreateAPIClient( params.BuildInfo, - cfg.Metrics.TCPAddr.Endpoint, + cfg.Metrics.TCPAddrConfig.Endpoint, cfg.TimeoutSettings, cfg.LimitedClientConfig.TLSSetting.InsecureSkipVerify) go func() { errchan <- clientutil.ValidateAPIKey(ctx, string(cfg.API.Key), params.Logger, apiClient) }() exporter.metricsAPI = datadogV2.NewMetricsApi(apiClient) } else { - client := clientutil.CreateZorkianClient(string(cfg.API.Key), cfg.Metrics.TCPAddr.Endpoint) + client := clientutil.CreateZorkianClient(string(cfg.API.Key), cfg.Metrics.TCPAddrConfig.Endpoint) client.ExtraHeader["User-Agent"] = clientutil.UserAgent(params.BuildInfo) client.HttpClient = clientutil.NewHTTPClient(cfg.TimeoutSettings, cfg.LimitedClientConfig.TLSSetting.InsecureSkipVerify) go func() { errchan <- clientutil.ValidateAPIKeyZorkian(params.Logger, client) }() @@ -157,7 +157,7 @@ func (exp *metricsExporter) pushSketches(ctx context.Context, sl sketches.Sketch req, err := http.NewRequestWithContext(ctx, http.MethodPost, - exp.cfg.Metrics.TCPAddr.Endpoint+sketches.SketchSeriesEndpoint, + exp.cfg.Metrics.TCPAddrConfig.Endpoint+sketches.SketchSeriesEndpoint, bytes.NewBuffer(payload), ) if err != nil { diff --git a/exporter/datadogexporter/metrics_exporter_test.go b/exporter/datadogexporter/metrics_exporter_test.go index bb0a6a685aa5..23e1401e8b65 100644 --- a/exporter/datadogexporter/metrics_exporter_test.go +++ b/exporter/datadogexporter/metrics_exporter_test.go @@ -49,7 +49,7 @@ func TestNewExporter(t *testing.T) { Key: "ddog_32_characters_long_api_key1", }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: server.URL, }, DeltaTTL: 3600, @@ -389,7 +389,7 @@ func TestNewExporter_Zorkian(t *testing.T) { Key: "ddog_32_characters_long_api_key1", }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: server.URL, }, DeltaTTL: 3600, @@ -859,7 +859,7 @@ func newTestConfig(t *testing.T, endpoint string, hostTags []string, histogramMo Tags: hostTags, }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: endpoint, }, HistConfig: HistogramConfig{ diff --git a/exporter/datadogexporter/traces_exporter.go b/exporter/datadogexporter/traces_exporter.go index 92ff1bbb7bd3..6f59c66a454e 100644 --- a/exporter/datadogexporter/traces_exporter.go +++ b/exporter/datadogexporter/traces_exporter.go @@ -70,13 +70,13 @@ func newTracesExporter( if isMetricExportV2Enabled() { apiClient := clientutil.CreateAPIClient( params.BuildInfo, - cfg.Metrics.TCPAddr.Endpoint, + cfg.Metrics.TCPAddrConfig.Endpoint, cfg.TimeoutSettings, cfg.LimitedClientConfig.TLSSetting.InsecureSkipVerify) go func() { errchan <- clientutil.ValidateAPIKey(ctx, string(cfg.API.Key), params.Logger, apiClient) }() exp.metricsAPI = datadogV2.NewMetricsApi(apiClient) } else { - client := clientutil.CreateZorkianClient(string(cfg.API.Key), cfg.Metrics.TCPAddr.Endpoint) + client := clientutil.CreateZorkianClient(string(cfg.API.Key), cfg.Metrics.TCPAddrConfig.Endpoint) go func() { errchan <- clientutil.ValidateAPIKeyZorkian(params.Logger, client) }() exp.client = client } diff --git a/exporter/datadogexporter/traces_exporter_test.go b/exporter/datadogexporter/traces_exporter_test.go index 4d177a0f34cf..cb8940faf639 100644 --- a/exporter/datadogexporter/traces_exporter_test.go +++ b/exporter/datadogexporter/traces_exporter_test.go @@ -133,10 +133,10 @@ func TestTracesSource(t *testing.T) { Hostname: "fallbackHostname", }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{Endpoint: metricsServer.URL}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: metricsServer.URL}, }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{Endpoint: tracesServer.URL}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: tracesServer.URL}, IgnoreResources: []string{}, }, } @@ -248,12 +248,12 @@ func TestTraceExporter(t *testing.T) { Hostname: "test-host", }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: metricsServer.URL, }, }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: server.URL, }, IgnoreResources: []string{}, @@ -286,7 +286,7 @@ func TestNewTracesExporter(t *testing.T) { cfg := &Config{} cfg.API.Key = "ddog_32_characters_long_api_key1" - cfg.Metrics.TCPAddr.Endpoint = metricsServer.URL + cfg.Metrics.TCPAddrConfig.Endpoint = metricsServer.URL params := exportertest.NewNopCreateSettings() // The client should have been created correctly @@ -307,10 +307,10 @@ func TestPushTraceData(t *testing.T) { Hostname: "test-host", }, Metrics: MetricsConfig{ - TCPAddr: confignet.TCPAddr{Endpoint: server.URL}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: server.URL}, }, Traces: TracesConfig{ - TCPAddr: confignet.TCPAddr{Endpoint: server.URL}, + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: server.URL}, }, HostMetadata: HostMetadataConfig{ diff --git a/extension/awsproxy/config_test.go b/extension/awsproxy/config_test.go index 1a703ab5869d..294569979f34 100644 --- a/extension/awsproxy/config_test.go +++ b/extension/awsproxy/config_test.go @@ -33,7 +33,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "1"), expected: &Config{ ProxyConfig: proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "0.0.0.0:1234", }, ProxyAddress: "https://proxy.proxy.com", diff --git a/extension/awsproxy/extension_test.go b/extension/awsproxy/extension_test.go index aef7e1295532..91719528d8cc 100644 --- a/extension/awsproxy/extension_test.go +++ b/extension/awsproxy/extension_test.go @@ -17,7 +17,7 @@ func TestInvalidEndpoint(t *testing.T) { _, err := newXrayProxy( &Config{ ProxyConfig: proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "invalidEndpoint", }, }, diff --git a/extension/awsproxy/factory.go b/extension/awsproxy/factory.go index fef6094f7507..b371d643b4c0 100644 --- a/extension/awsproxy/factory.go +++ b/extension/awsproxy/factory.go @@ -33,7 +33,7 @@ func NewFactory() extension.Factory { func createDefaultConfig() component.Config { return &Config{ ProxyConfig: proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: localhostgate.EndpointForPort(defaultPort), }, TLSSetting: configtls.TLSClientSetting{ diff --git a/extension/awsproxy/factory_test.go b/extension/awsproxy/factory_test.go index e264fa81c3f8..79b5e8de33f9 100644 --- a/extension/awsproxy/factory_test.go +++ b/extension/awsproxy/factory_test.go @@ -27,7 +27,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) { cfg := createDefaultConfig() assert.Equal(t, &Config{ ProxyConfig: proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "0.0.0.0:2000", }, }, @@ -53,7 +53,7 @@ func TestFactory_CreateExtension(t *testing.T) { cfg := createDefaultConfig().(*Config) address := testutil.GetAvailableLocalAddress(t) cfg.ProxyConfig.AWSEndpoint = backend.URL - cfg.ProxyConfig.TCPAddr.Endpoint = address + cfg.ProxyConfig.TCPAddrConfig.Endpoint = address cfg.ProxyConfig.Region = "us-east-2" // Simplest way to get SDK to use fake credentials diff --git a/extension/jaegerremotesampling/config_test.go b/extension/jaegerremotesampling/config_test.go index ca175bc836ab..45b3e321767d 100644 --- a/extension/jaegerremotesampling/config_test.go +++ b/extension/jaegerremotesampling/config_test.go @@ -30,7 +30,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewID(metadata.Type), expected: &Config{ HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"}, - GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.NetAddr{ + GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:14250", Transport: "tcp", }}, @@ -45,7 +45,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "1"), expected: &Config{ HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"}, - GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.NetAddr{ + GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:14250", Transport: "tcp", }}, diff --git a/extension/jaegerremotesampling/factory.go b/extension/jaegerremotesampling/factory.go index 78d1b30ba614..0fbbe898230d 100644 --- a/extension/jaegerremotesampling/factory.go +++ b/extension/jaegerremotesampling/factory.go @@ -35,7 +35,7 @@ func createDefaultConfig() component.Config { Endpoint: localhostgate.EndpointForPort(5778), }, GRPCServerConfig: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: localhostgate.EndpointForPort(14250), Transport: "tcp", }, diff --git a/extension/jaegerremotesampling/factory_test.go b/extension/jaegerremotesampling/factory_test.go index 4c0dfd0ad70f..237e8806a25b 100644 --- a/extension/jaegerremotesampling/factory_test.go +++ b/extension/jaegerremotesampling/factory_test.go @@ -19,7 +19,7 @@ func TestCreateDefaultConfig(t *testing.T) { // prepare and test expected := &Config{ HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"}, - GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.NetAddr{ + GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:14250", Transport: "tcp", }}, diff --git a/extension/jaegerremotesampling/internal/grpc_test.go b/extension/jaegerremotesampling/internal/grpc_test.go index 6c95df005e14..731b6a40412c 100644 --- a/extension/jaegerremotesampling/internal/grpc_test.go +++ b/extension/jaegerremotesampling/internal/grpc_test.go @@ -25,7 +25,7 @@ func TestMissingClientConfigManagerGRPC(t *testing.T) { func TestStartAndStopGRPC(t *testing.T) { // prepare srvSettings := configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "127.0.0.1:0", Transport: "tcp", }, diff --git a/extension/pprofextension/config.go b/extension/pprofextension/config.go index 8d99601ebb4e..b289e2a05b52 100644 --- a/extension/pprofextension/config.go +++ b/extension/pprofextension/config.go @@ -15,7 +15,7 @@ type Config struct { // TCPAddr is the address and port in which the pprof will be listening to. // Use localhost: to make it available only locally, or ":" to // make it available on all network interfaces. - TCPAddr confignet.TCPAddr `mapstructure:",squash"` + TCPAddr confignet.TCPAddrConfig `mapstructure:",squash"` // Fraction of blocking events that are profiled. A value <= 0 disables // profiling. See https://golang.org/pkg/runtime/#SetBlockProfileRate for details. diff --git a/extension/pprofextension/config_test.go b/extension/pprofextension/config_test.go index f9485b9f181b..b3086a366ef1 100644 --- a/extension/pprofextension/config_test.go +++ b/extension/pprofextension/config_test.go @@ -30,7 +30,7 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "1"), expected: &Config{ - TCPAddr: confignet.TCPAddr{Endpoint: "127.0.0.1:1777"}, + TCPAddr: confignet.TCPAddrConfig{Endpoint: "127.0.0.1:1777"}, BlockProfileFraction: 3, MutexProfileFraction: 5, }, diff --git a/extension/pprofextension/factory.go b/extension/pprofextension/factory.go index e2ee1b600569..e622a3f57720 100644 --- a/extension/pprofextension/factory.go +++ b/extension/pprofextension/factory.go @@ -30,7 +30,7 @@ func NewFactory() extension.Factory { func createDefaultConfig() component.Config { return &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddr: confignet.TCPAddrConfig{ Endpoint: defaultEndpoint, }, } diff --git a/extension/pprofextension/factory_test.go b/extension/pprofextension/factory_test.go index 665e2f439c5b..b11a1bb4493c 100644 --- a/extension/pprofextension/factory_test.go +++ b/extension/pprofextension/factory_test.go @@ -19,7 +19,7 @@ import ( func TestFactory_CreateDefaultConfig(t *testing.T) { cfg := createDefaultConfig() assert.Equal(t, &Config{ - TCPAddr: confignet.TCPAddr{Endpoint: defaultEndpoint}, + TCPAddr: confignet.TCPAddrConfig{Endpoint: defaultEndpoint}, }, cfg) diff --git a/extension/pprofextension/pprofextension_test.go b/extension/pprofextension/pprofextension_test.go index 4a03e5a863dc..db6e91feafa7 100644 --- a/extension/pprofextension/pprofextension_test.go +++ b/extension/pprofextension/pprofextension_test.go @@ -21,7 +21,7 @@ import ( func TestPerformanceProfilerExtensionUsage(t *testing.T) { config := Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddr: confignet.TCPAddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), }, BlockProfileFraction: 3, @@ -57,7 +57,7 @@ func TestPerformanceProfilerExtensionPortAlreadyInUse(t *testing.T) { defer ln.Close() config := Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddr: confignet.TCPAddrConfig{ Endpoint: endpoint, }, } @@ -71,7 +71,7 @@ func TestPerformanceProfilerExtensionPortAlreadyInUse(t *testing.T) { func TestPerformanceProfilerMultipleStarts(t *testing.T) { config := Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddr: confignet.TCPAddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), }, } @@ -90,7 +90,7 @@ func TestPerformanceProfilerMultipleStarts(t *testing.T) { func TestPerformanceProfilerMultipleShutdowns(t *testing.T) { config := Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddr: confignet.TCPAddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), }, } @@ -107,7 +107,7 @@ func TestPerformanceProfilerMultipleShutdowns(t *testing.T) { func TestPerformanceProfilerShutdownWithoutStart(t *testing.T) { config := Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddr: confignet.TCPAddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), }, } @@ -128,7 +128,7 @@ func TestPerformanceProfilerLifecycleWithFile(t *testing.T) { require.NoError(t, tmpFile.Close()) config := Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddr: confignet.TCPAddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), }, SaveToFile: tmpFile.Name(), diff --git a/internal/aws/proxy/cfg.go b/internal/aws/proxy/cfg.go index 5b45314c13c5..c6a1fc966620 100644 --- a/internal/aws/proxy/cfg.go +++ b/internal/aws/proxy/cfg.go @@ -15,7 +15,7 @@ type Config struct { // endpoint is the TCP address and port on which this receiver listens for // calls from the X-Ray SDK and relays them to the AWS X-Ray backend to // get sampling rules and report sampling statistics. - confignet.TCPAddr `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` // ProxyAddress defines the proxy address that the local TCP server // forwards HTTP requests to AWS X-Ray backend through. @@ -44,7 +44,7 @@ type Config struct { func DefaultConfig() *Config { return &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: localhostgate.EndpointForPort(2000), }, ProxyAddress: "", diff --git a/internal/aws/proxy/server_test.go b/internal/aws/proxy/server_test.go index 4b70aa0c0976..7bff20df8e63 100644 --- a/internal/aws/proxy/server_test.go +++ b/internal/aws/proxy/server_test.go @@ -36,7 +36,7 @@ func TestHappyCase(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr cfg.ProxyAddress = "https://example.com" srv, err := NewServer(cfg, logger) assert.NoError(t, err, "NewServer should succeed") @@ -68,7 +68,7 @@ func TestHandlerHappyCase(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr srv, err := NewServer(cfg, logger) assert.NoError(t, err, "NewServer should succeed") @@ -93,7 +93,7 @@ func TestHandlerIoReadSeekerCreationFailed(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr srv, err := NewServer(cfg, logger) assert.NoError(t, err, "NewServer should succeed") @@ -122,7 +122,7 @@ func TestHandlerNilBodyIsOk(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr srv, err := NewServer(cfg, logger) assert.NoError(t, err, "NewServer should succeed") @@ -146,7 +146,7 @@ func TestHandlerSignerErrorsOut(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr srv, err := NewServer(cfg, logger) assert.NoError(t, err, "NewServer should succeed") @@ -169,7 +169,7 @@ func TestTCPEndpointInvalid(t *testing.T) { t.Setenv(regionEnvVarName, regionEnvVar) cfg := DefaultConfig() - cfg.TCPAddr.Endpoint = "invalid\n" + cfg.TCPAddrConfig.Endpoint = "invalid\n" _, err := NewServer(cfg, logger) assert.Error(t, err, "NewServer should fail") } @@ -181,7 +181,7 @@ func TestCantGetAWSConfigSession(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr origSession := newAWSSession defer func() { @@ -203,7 +203,7 @@ func TestCantGetServiceEndpoint(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr _, err := NewServer(cfg, logger) assert.Error(t, err, "NewServer should fail") @@ -217,7 +217,7 @@ func TestAWSEndpointInvalid(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr cfg.AWSEndpoint = "invalid endpoint \n" _, err := NewServer(cfg, logger) @@ -232,7 +232,7 @@ func TestCanCreateTransport(t *testing.T) { cfg := DefaultConfig() tcpAddr := testutil.GetAvailableLocalAddress(t) - cfg.TCPAddr.Endpoint = tcpAddr + cfg.TCPAddrConfig.Endpoint = tcpAddr cfg.ProxyAddress = "invalid address \n" _, err := NewServer(cfg, logger) diff --git a/receiver/awsxrayreceiver/config.go b/receiver/awsxrayreceiver/config.go index 04b8dda9e503..d458ac3243a9 100644 --- a/receiver/awsxrayreceiver/config.go +++ b/receiver/awsxrayreceiver/config.go @@ -14,7 +14,7 @@ type Config struct { // The `NetAddr` represents the UDP address // and port on which this receiver listens for X-Ray segment documents // emitted by the X-Ray SDK. - confignet.NetAddr `mapstructure:",squash"` + confignet.AddrConfig `mapstructure:",squash"` // ProxyServer defines configurations related to the local TCP proxy server. ProxyServer *proxy.Config `mapstructure:"proxy_server"` diff --git a/receiver/awsxrayreceiver/config_test.go b/receiver/awsxrayreceiver/config_test.go index ebac3b6a77f2..a17007b65a5d 100644 --- a/receiver/awsxrayreceiver/config_test.go +++ b/receiver/awsxrayreceiver/config_test.go @@ -35,12 +35,12 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "udp_endpoint"), expected: &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "0.0.0.0:5678", Transport: "udp", }, ProxyServer: &proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "0.0.0.0:2000", }, ProxyAddress: "", @@ -57,12 +57,12 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "proxy_server"), expected: &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "0.0.0.0:2000", Transport: "udp", }, ProxyServer: &proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "0.0.0.0:1234", }, ProxyAddress: "https://proxy.proxy.com", diff --git a/receiver/awsxrayreceiver/factory.go b/receiver/awsxrayreceiver/factory.go index 528b2b7e4609..08c178ccafa8 100644 --- a/receiver/awsxrayreceiver/factory.go +++ b/receiver/awsxrayreceiver/factory.go @@ -32,7 +32,7 @@ func createDefaultConfig() component.Config { // in the X-Ray daemon: // https://github.com/aws/aws-xray-daemon/blob/master/pkg/cfg/cfg.go#L99 return &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: localhostgate.EndpointForPort(defaultPort), Transport: udppoller.Transport, }, diff --git a/receiver/awsxrayreceiver/receiver_test.go b/receiver/awsxrayreceiver/receiver_test.go index 2758ad4e2251..afa31c112092 100644 --- a/receiver/awsxrayreceiver/receiver_test.go +++ b/receiver/awsxrayreceiver/receiver_test.go @@ -45,12 +45,12 @@ func TestProxyCreationFailed(t *testing.T) { sink := new(consumertest.TracesSink) _, err = newReceiver( &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: addr, Transport: udppoller.Transport, }, ProxyServer: &proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "invalidEndpoint", }, }, @@ -65,7 +65,7 @@ func TestPollerCreationFailed(t *testing.T) { sink := new(consumertest.TracesSink) _, err := newReceiver( &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "dontCare", Transport: "tcp", }, @@ -279,12 +279,12 @@ func createAndOptionallyStartReceiver( set.Logger = logger rcvr, err := newReceiver( &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: addr, Transport: udppoller.Transport, }, ProxyServer: &proxy.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: tcpAddr, }, }, diff --git a/receiver/carbonreceiver/config.go b/receiver/carbonreceiver/config.go index b60a9a0476c2..7e3e6be2c991 100644 --- a/receiver/carbonreceiver/config.go +++ b/receiver/carbonreceiver/config.go @@ -17,7 +17,7 @@ var _ component.ConfigValidator = (*Config)(nil) // Config defines configuration for the Carbon receiver. type Config struct { - confignet.NetAddr `mapstructure:",squash"` + confignet.AddrConfig `mapstructure:",squash"` // TCPIdleTimeout is the timout for idle TCP connections, it is ignored // if transport being used is UDP. diff --git a/receiver/carbonreceiver/config_test.go b/receiver/carbonreceiver/config_test.go index fa56a4535775..f0d02afa21aa 100644 --- a/receiver/carbonreceiver/config_test.go +++ b/receiver/carbonreceiver/config_test.go @@ -35,7 +35,7 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "receiver_settings"), expected: &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:8080", Transport: "udp", }, @@ -49,7 +49,7 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "regex"), expected: &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:2003", Transport: "tcp", }, @@ -95,7 +95,7 @@ func TestLoadConfig(t *testing.T) { func TestConfigValidate(t *testing.T) { cfg := &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:2003", Transport: "tcp", }, diff --git a/receiver/carbonreceiver/factory.go b/receiver/carbonreceiver/factory.go index 94e566d99931..f50d438b296b 100644 --- a/receiver/carbonreceiver/factory.go +++ b/receiver/carbonreceiver/factory.go @@ -33,7 +33,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:2003", Transport: "tcp", }, diff --git a/receiver/carbonreceiver/receiver_test.go b/receiver/carbonreceiver/receiver_test.go index db47598e9298..8697b4f5c109 100644 --- a/receiver/carbonreceiver/receiver_test.go +++ b/receiver/carbonreceiver/receiver_test.go @@ -47,7 +47,7 @@ func Test_carbonreceiver_New(t *testing.T) { name: "zero_value_parser", args: args{ config: Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: defaultConfig.Endpoint, Transport: defaultConfig.Transport, }, @@ -68,7 +68,7 @@ func Test_carbonreceiver_New(t *testing.T) { name: "regex_parser", args: args{ config: Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:2003", Transport: "tcp", }, @@ -115,7 +115,7 @@ func Test_carbonreceiver_Start(t *testing.T) { name: "invalid_transport", args: args{ config: Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:2003", Transport: "unknown_transp", }, diff --git a/receiver/jaegerreceiver/config_test.go b/receiver/jaegerreceiver/config_test.go index 21265154932a..c2c019559ef0 100644 --- a/receiver/jaegerreceiver/config_test.go +++ b/receiver/jaegerreceiver/config_test.go @@ -34,7 +34,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:9876", Transport: "tcp", }, @@ -68,7 +68,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:14250", Transport: "tcp", }, @@ -92,7 +92,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:9876", Transport: "tcp", }, @@ -109,7 +109,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:9876", Transport: "tcp", }, @@ -202,7 +202,7 @@ func TestInvalidConfig(t *testing.T) { desc: "grpc-invalid-host", apply: func(cfg *Config) { cfg.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "1234", Transport: "tcp", }, diff --git a/receiver/jaegerreceiver/factory.go b/receiver/jaegerreceiver/factory.go index 33545b5074e9..4755cf06653b 100644 --- a/receiver/jaegerreceiver/factory.go +++ b/receiver/jaegerreceiver/factory.go @@ -74,7 +74,7 @@ func createDefaultConfig() component.Config { return &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: localhostgate.EndpointForPort(defaultGRPCPort), Transport: "tcp", }, diff --git a/receiver/jaegerreceiver/factory_test.go b/receiver/jaegerreceiver/factory_test.go index 622ef712cf29..aba1cb248e5d 100644 --- a/receiver/jaegerreceiver/factory_test.go +++ b/receiver/jaegerreceiver/factory_test.go @@ -40,7 +40,7 @@ func TestCreateReceiver(t *testing.T) { cfg := factory.CreateDefaultConfig() // have to enable at least one protocol for the jaeger receiver to be created cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:14250", Transport: "tcp", }, @@ -81,7 +81,7 @@ func TestCreateDefaultGRPCEndpoint(t *testing.T) { cfg := factory.CreateDefaultConfig() cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:14250", Transport: "tcp", }, @@ -98,7 +98,7 @@ func TestCreateTLSGPRCEndpoint(t *testing.T) { cfg := factory.CreateDefaultConfig() cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:14250", Transport: "tcp", }, diff --git a/receiver/jaegerreceiver/trace_receiver_test.go b/receiver/jaegerreceiver/trace_receiver_test.go index 561c55c7d7b3..60987e7d914c 100644 --- a/receiver/jaegerreceiver/trace_receiver_test.go +++ b/receiver/jaegerreceiver/trace_receiver_test.go @@ -142,7 +142,7 @@ func TestGRPCReception(t *testing.T) { // prepare config := &configuration{ GRPCServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", }, @@ -196,7 +196,7 @@ func TestGRPCReceptionWithTLS(t *testing.T) { } grpcServerSettings := configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", }, @@ -337,7 +337,7 @@ func grpcFixture(t *testing.T, t1 time.Time, d1, d2 time.Duration) *api_v2.PostS func TestSampling(t *testing.T) { config := &configuration{ - GRPCServerConfig: configgrpc.ServerConfig{NetAddr: confignet.NetAddr{ + GRPCServerConfig: configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", }}, diff --git a/receiver/jmxreceiver/receiver.go b/receiver/jmxreceiver/receiver.go index 33289cef6a71..849ca0258fe4 100644 --- a/receiver/jmxreceiver/receiver.go +++ b/receiver/jmxreceiver/receiver.go @@ -148,7 +148,7 @@ func (jmx *jmxMetricReceiver) buildOTLPReceiver() (receiver.Metrics, error) { factory := otlpreceiver.NewFactory() config := factory.CreateDefaultConfig().(*otlpreceiver.Config) - config.GRPC.NetAddr = confignet.NetAddr{Endpoint: endpoint, Transport: "tcp"} + config.GRPC.NetAddr = confignet.AddrConfig{Endpoint: endpoint, Transport: "tcp"} config.HTTP = nil return factory.CreateMetricsReceiver(context.Background(), jmx.params, config, jmx.nextConsumer) diff --git a/receiver/kubeletstatsreceiver/config.go b/receiver/kubeletstatsreceiver/config.go index 7f7eac7522a4..e12577b93fe8 100644 --- a/receiver/kubeletstatsreceiver/config.go +++ b/receiver/kubeletstatsreceiver/config.go @@ -24,8 +24,8 @@ var _ component.Config = (*Config)(nil) type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` - kube.ClientConfig `mapstructure:",squash"` - confignet.TCPAddr `mapstructure:",squash"` + kube.ClientConfig `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` // ExtraMetadataLabels contains list of extra metadata that should be taken from /pods endpoint // and put as extra labels on metrics resource. diff --git a/receiver/kubeletstatsreceiver/config_test.go b/receiver/kubeletstatsreceiver/config_test.go index 7f6e38470eed..fe5f055413e1 100644 --- a/receiver/kubeletstatsreceiver/config_test.go +++ b/receiver/kubeletstatsreceiver/config_test.go @@ -62,7 +62,7 @@ func TestLoadConfig(t *testing.T) { CollectionInterval: duration, InitialDelay: time.Second, }, - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "1.2.3.4:5555", }, ClientConfig: kube.ClientConfig{ diff --git a/receiver/lokireceiver/config_test.go b/receiver/lokireceiver/config_test.go index da1e9fdd19e1..c8e8eed0286f 100644 --- a/receiver/lokireceiver/config_test.go +++ b/receiver/lokireceiver/config_test.go @@ -33,7 +33,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:3600", Transport: "tcp", }, @@ -49,7 +49,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:4600", Transport: "tcp", }, diff --git a/receiver/lokireceiver/factory.go b/receiver/lokireceiver/factory.go index c4cc246b47c2..e61cce38e955 100644 --- a/receiver/lokireceiver/factory.go +++ b/receiver/lokireceiver/factory.go @@ -38,7 +38,7 @@ func createDefaultConfig() component.Config { return &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: localhostgate.EndpointForPort(defaultGRPCPort), Transport: "tcp", }, diff --git a/receiver/lokireceiver/factory_test.go b/receiver/lokireceiver/factory_test.go index 784662b730bd..4422d93947d1 100644 --- a/receiver/lokireceiver/factory_test.go +++ b/receiver/lokireceiver/factory_test.go @@ -26,7 +26,7 @@ func TestCreateReceiver(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: defaultGRPCBindEndpoint, Transport: "tcp", }, diff --git a/receiver/lokireceiver/loki_test.go b/receiver/lokireceiver/loki_test.go index 10dd6d6b2cbe..bb723a8d72e3 100644 --- a/receiver/lokireceiver/loki_test.go +++ b/receiver/lokireceiver/loki_test.go @@ -89,7 +89,7 @@ func startGRPCServer(t *testing.T) (*grpc.ClientConn, *consumertest.LogsSink) { config := &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", }, diff --git a/receiver/memcachedreceiver/config.go b/receiver/memcachedreceiver/config.go index 8321c54ccc3e..74b58c95a8f2 100644 --- a/receiver/memcachedreceiver/config.go +++ b/receiver/memcachedreceiver/config.go @@ -12,7 +12,7 @@ import ( type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` - confignet.NetAddr `mapstructure:",squash"` + confignet.AddrConfig `mapstructure:",squash"` // MetricsBuilderConfig allows customizing scraped metrics/attributes representation. metadata.MetricsBuilderConfig `mapstructure:",squash"` diff --git a/receiver/memcachedreceiver/factory.go b/receiver/memcachedreceiver/factory.go index 4f4cc77f2dbc..9ae794d31fd3 100644 --- a/receiver/memcachedreceiver/factory.go +++ b/receiver/memcachedreceiver/factory.go @@ -37,7 +37,7 @@ func createDefaultConfig() component.Config { return &Config{ ScraperControllerSettings: cfg, - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: defaultEndpoint, }, MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), diff --git a/receiver/mongodbreceiver/config.go b/receiver/mongodbreceiver/config.go index ac1042bea333..73f6f86e3cf7 100644 --- a/receiver/mongodbreceiver/config.go +++ b/receiver/mongodbreceiver/config.go @@ -24,11 +24,11 @@ type Config struct { configtls.TLSClientSetting `mapstructure:"tls,omitempty"` // MetricsBuilderConfig defines which metrics/attributes to enable for the scraper metadata.MetricsBuilderConfig `mapstructure:",squash"` - Hosts []confignet.NetAddr `mapstructure:"hosts"` - Username string `mapstructure:"username"` - Password configopaque.String `mapstructure:"password"` - ReplicaSet string `mapstructure:"replica_set,omitempty"` - Timeout time.Duration `mapstructure:"timeout"` + Hosts []confignet.AddrConfig `mapstructure:"hosts"` + Username string `mapstructure:"username"` + Password configopaque.String `mapstructure:"password"` + ReplicaSet string `mapstructure:"replica_set,omitempty"` + Timeout time.Duration `mapstructure:"timeout"` } func (c *Config) Validate() error { diff --git a/receiver/mongodbreceiver/config_test.go b/receiver/mongodbreceiver/config_test.go index fea7a98ca45c..1d8673c8a676 100644 --- a/receiver/mongodbreceiver/config_test.go +++ b/receiver/mongodbreceiver/config_test.go @@ -76,10 +76,10 @@ func TestValidate(t *testing.T) { } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - var hosts []confignet.NetAddr + var hosts []confignet.AddrConfig for _, ep := range tc.endpoints { - hosts = append(hosts, confignet.NetAddr{ + hosts = append(hosts, confignet.AddrConfig{ Endpoint: ep, }) } @@ -134,7 +134,7 @@ func TestBadTLSConfigs(t *testing.T) { cfg := &Config{ Username: "otel", Password: "pword", - Hosts: []confignet.NetAddr{ + Hosts: []confignet.AddrConfig{ { Endpoint: "localhost:27017", }, @@ -154,7 +154,7 @@ func TestBadTLSConfigs(t *testing.T) { func TestOptions(t *testing.T) { cfg := &Config{ - Hosts: []confignet.NetAddr{ + Hosts: []confignet.AddrConfig{ { Endpoint: "localhost:27017", }, @@ -179,7 +179,7 @@ func TestOptionsTLS(t *testing.T) { caFile := filepath.Join("testdata", "certs", "ca.crt") cfg := &Config{ - Hosts: []confignet.NetAddr{ + Hosts: []confignet.AddrConfig{ { Endpoint: "localhost:27017", }, @@ -207,7 +207,7 @@ func TestLoadConfig(t *testing.T) { require.NoError(t, component.UnmarshalConfig(sub, cfg)) expected := factory.CreateDefaultConfig().(*Config) - expected.Hosts = []confignet.NetAddr{ + expected.Hosts = []confignet.AddrConfig{ { Endpoint: "localhost:27017", }, diff --git a/receiver/mongodbreceiver/factory.go b/receiver/mongodbreceiver/factory.go index a16b296cc7ad..8a730dfde49f 100644 --- a/receiver/mongodbreceiver/factory.go +++ b/receiver/mongodbreceiver/factory.go @@ -29,7 +29,7 @@ func createDefaultConfig() component.Config { return &Config{ ScraperControllerSettings: scraperhelper.NewDefaultScraperControllerSettings(metadata.Type), Timeout: time.Minute, - Hosts: []confignet.NetAddr{ + Hosts: []confignet.AddrConfig{ { Endpoint: "localhost:27017", }, diff --git a/receiver/mongodbreceiver/integration_test.go b/receiver/mongodbreceiver/integration_test.go index e2d62a5c514f..4f10cb41408f 100644 --- a/receiver/mongodbreceiver/integration_test.go +++ b/receiver/mongodbreceiver/integration_test.go @@ -56,7 +56,7 @@ func integrationTest(name string, script []string, cfgMod func(*Config)) func(*t cfgMod(rCfg) rCfg.CollectionInterval = 2 * time.Second rCfg.MetricsBuilderConfig.Metrics.MongodbLockAcquireTime.Enabled = false - rCfg.Hosts = []confignet.NetAddr{ + rCfg.Hosts = []confignet.AddrConfig{ { Endpoint: fmt.Sprintf("%s:%s", ci.Host(t), ci.MappedPort(t, mongoPort)), }, diff --git a/receiver/mysqlreceiver/config.go b/receiver/mysqlreceiver/config.go index 63b00b7c62a4..337891bfee15 100644 --- a/receiver/mysqlreceiver/config.go +++ b/receiver/mysqlreceiver/config.go @@ -27,7 +27,7 @@ type Config struct { Password configopaque.String `mapstructure:"password,omitempty"` Database string `mapstructure:"database,omitempty"` AllowNativePasswords bool `mapstructure:"allow_native_passwords,omitempty"` - confignet.NetAddr `mapstructure:",squash"` + confignet.AddrConfig `mapstructure:",squash"` TLS configtls.TLSClientSetting `mapstructure:"tls,omitempty"` MetricsBuilderConfig metadata.MetricsBuilderConfig `mapstructure:",squash"` StatementEvents StatementEventsConfig `mapstructure:"statement_events"` diff --git a/receiver/mysqlreceiver/factory.go b/receiver/mysqlreceiver/factory.go index f4d3ac7dd6ea..57f4a8abad1d 100644 --- a/receiver/mysqlreceiver/factory.go +++ b/receiver/mysqlreceiver/factory.go @@ -30,7 +30,7 @@ func createDefaultConfig() component.Config { ScraperControllerSettings: cfg, AllowNativePasswords: true, Username: "root", - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:3306", Transport: "tcp", }, diff --git a/receiver/mysqlreceiver/factory_test.go b/receiver/mysqlreceiver/factory_test.go index 0f15cc666c6b..58641f8ff241 100644 --- a/receiver/mysqlreceiver/factory_test.go +++ b/receiver/mysqlreceiver/factory_test.go @@ -45,7 +45,7 @@ func TestCreateMetricsReceiver(t *testing.T) { }, Username: "otel", Password: "otel", - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:3306", }, }, diff --git a/receiver/mysqlreceiver/scraper_test.go b/receiver/mysqlreceiver/scraper_test.go index 93a661ecfab0..289c6021eb63 100644 --- a/receiver/mysqlreceiver/scraper_test.go +++ b/receiver/mysqlreceiver/scraper_test.go @@ -28,7 +28,7 @@ func TestScrape(t *testing.T) { cfg := createDefaultConfig().(*Config) cfg.Username = "otel" cfg.Password = "otel" - cfg.NetAddr = confignet.NetAddr{Endpoint: "localhost:3306"} + cfg.AddrConfig = confignet.AddrConfig{Endpoint: "localhost:3306"} cfg.MetricsBuilderConfig.Metrics.MysqlStatementEventCount.Enabled = true cfg.MetricsBuilderConfig.Metrics.MysqlStatementEventWaitTime.Enabled = true cfg.MetricsBuilderConfig.Metrics.MysqlConnectionErrors.Enabled = true @@ -81,7 +81,7 @@ func TestScrape(t *testing.T) { cfg := createDefaultConfig().(*Config) cfg.Username = "otel" cfg.Password = "otel" - cfg.NetAddr = confignet.NetAddr{Endpoint: "localhost:3306"} + cfg.AddrConfig = confignet.AddrConfig{Endpoint: "localhost:3306"} cfg.MetricsBuilderConfig.Metrics.MysqlReplicaSQLDelay.Enabled = true cfg.MetricsBuilderConfig.Metrics.MysqlReplicaTimeBehindSource.Enabled = true diff --git a/receiver/opencensusreceiver/config_test.go b/receiver/opencensusreceiver/config_test.go index 984cbbc74e1a..1aa0d91a25c7 100644 --- a/receiver/opencensusreceiver/config_test.go +++ b/receiver/opencensusreceiver/config_test.go @@ -33,7 +33,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "customname"), expected: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:9090", Transport: "tcp", }, @@ -45,7 +45,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "keepalive"), expected: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:55678", Transport: "tcp", }, @@ -70,7 +70,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "msg-size-conc-connect-max-idle"), expected: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:55678", Transport: "tcp", }, @@ -90,7 +90,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "tlscredentials"), expected: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:55678", Transport: "tcp", }, @@ -108,7 +108,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "cors"), expected: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:55678", Transport: "tcp", }, @@ -121,7 +121,7 @@ func TestLoadConfig(t *testing.T) { id: component.NewIDWithName(metadata.Type, "uds"), expected: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "/tmp/opencensus.sock", Transport: "unix", }, diff --git a/receiver/opencensusreceiver/factory.go b/receiver/opencensusreceiver/factory.go index b674b935c400..8ee917bcdf4e 100644 --- a/receiver/opencensusreceiver/factory.go +++ b/receiver/opencensusreceiver/factory.go @@ -31,7 +31,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: localhostgate.EndpointForPort(grpcPort), Transport: "tcp", }, diff --git a/receiver/opencensusreceiver/factory_test.go b/receiver/opencensusreceiver/factory_test.go index b27c8fc71838..32b560244339 100644 --- a/receiver/opencensusreceiver/factory_test.go +++ b/receiver/opencensusreceiver/factory_test.go @@ -40,7 +40,7 @@ func TestCreateReceiver(t *testing.T) { } func TestCreateTracesReceiver(t *testing.T) { - defaultNetAddr := confignet.NetAddr{ + defaultNetAddr := confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", } @@ -62,7 +62,7 @@ func TestCreateTracesReceiver(t *testing.T) { name: "invalid_port", cfg: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:112233", Transport: "tcp", }, @@ -99,7 +99,7 @@ func TestCreateTracesReceiver(t *testing.T) { } func TestCreateMetricsReceiver(t *testing.T) { - defaultNetAddr := confignet.NetAddr{ + defaultNetAddr := confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", } @@ -122,7 +122,7 @@ func TestCreateMetricsReceiver(t *testing.T) { name: "invalid_address", cfg: &Config{ ServerConfig: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "327.0.0.1:1122", Transport: "tcp", }, diff --git a/receiver/otelarrowreceiver/config_test.go b/receiver/otelarrowreceiver/config_test.go index 0a9cf8dfc71c..9e5126987e12 100644 --- a/receiver/otelarrowreceiver/config_test.go +++ b/receiver/otelarrowreceiver/config_test.go @@ -49,7 +49,7 @@ func TestUnmarshalConfig(t *testing.T) { &Config{ Protocols: Protocols{ GRPC: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:4317", Transport: "tcp", }, @@ -98,7 +98,7 @@ func TestUnmarshalConfigUnix(t *testing.T) { &Config{ Protocols: Protocols{ GRPC: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "/tmp/grpc_otlp.sock", Transport: "unix", }, diff --git a/receiver/otelarrowreceiver/factory.go b/receiver/otelarrowreceiver/factory.go index ac5d3a1d703b..92a32e48b99e 100644 --- a/receiver/otelarrowreceiver/factory.go +++ b/receiver/otelarrowreceiver/factory.go @@ -37,7 +37,7 @@ func createDefaultConfig() component.Config { return &Config{ Protocols: Protocols{ GRPC: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: defaultGRPCEndpoint, Transport: "tcp", }, diff --git a/receiver/otelarrowreceiver/factory_test.go b/receiver/otelarrowreceiver/factory_test.go index 3bd2b64b5de1..32bd0174fcaf 100644 --- a/receiver/otelarrowreceiver/factory_test.go +++ b/receiver/otelarrowreceiver/factory_test.go @@ -43,7 +43,7 @@ func TestCreateReceiver(t *testing.T) { func TestCreateTracesReceiver(t *testing.T) { factory := NewFactory() defaultGRPCSettings := configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", }, @@ -67,7 +67,7 @@ func TestCreateTracesReceiver(t *testing.T) { cfg: &Config{ Protocols: Protocols{ GRPC: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:112233", Transport: "tcp", }, @@ -99,7 +99,7 @@ func TestCreateTracesReceiver(t *testing.T) { func TestCreateMetricReceiver(t *testing.T) { factory := NewFactory() defaultGRPCSettings := configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", }, @@ -123,7 +123,7 @@ func TestCreateMetricReceiver(t *testing.T) { cfg: &Config{ Protocols: Protocols{ GRPC: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "327.0.0.1:1122", Transport: "tcp", }, @@ -154,7 +154,7 @@ func TestCreateMetricReceiver(t *testing.T) { func TestCreateLogReceiver(t *testing.T) { factory := NewFactory() defaultGRPCSettings := configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: "tcp", }, @@ -181,7 +181,7 @@ func TestCreateLogReceiver(t *testing.T) { cfg: &Config{ Protocols: Protocols{ GRPC: configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "327.0.0.1:1122", Transport: "tcp", }, diff --git a/receiver/postgresqlreceiver/client.go b/receiver/postgresqlreceiver/client.go index 67c319f9dae9..e4e68d6e8b50 100644 --- a/receiver/postgresqlreceiver/client.go +++ b/receiver/postgresqlreceiver/client.go @@ -70,7 +70,7 @@ type postgreSQLConfig struct { username string password string database string - address confignet.NetAddr + address confignet.AddrConfig tls configtls.TLSClientSetting } diff --git a/receiver/postgresqlreceiver/config.go b/receiver/postgresqlreceiver/config.go index 74aa1eee0cd9..4e7dd0e7c71c 100644 --- a/receiver/postgresqlreceiver/config.go +++ b/receiver/postgresqlreceiver/config.go @@ -32,7 +32,7 @@ type Config struct { Password configopaque.String `mapstructure:"password"` Databases []string `mapstructure:"databases"` ExcludeDatabases []string `mapstructure:"exclude_databases"` - confignet.NetAddr `mapstructure:",squash"` // provides Endpoint and Transport + confignet.AddrConfig `mapstructure:",squash"` // provides Endpoint and Transport configtls.TLSClientSetting `mapstructure:"tls,omitempty"` // provides SSL details metadata.MetricsBuilderConfig `mapstructure:",squash"` } diff --git a/receiver/postgresqlreceiver/config_test.go b/receiver/postgresqlreceiver/config_test.go index 125d02b74e60..1c1a0e40d53d 100644 --- a/receiver/postgresqlreceiver/config_test.go +++ b/receiver/postgresqlreceiver/config_test.go @@ -135,7 +135,7 @@ func TestLoadConfig(t *testing.T) { expected := factory.CreateDefaultConfig().(*Config) expected.Endpoint = "localhost:5432" - expected.NetAddr.Transport = "tcp" + expected.AddrConfig.Transport = "tcp" expected.Username = "otel" expected.Password = "${env:POSTGRESQL_PASSWORD}" expected.Databases = []string{"otel"} diff --git a/receiver/postgresqlreceiver/factory.go b/receiver/postgresqlreceiver/factory.go index 8b309b0be507..33f346736192 100644 --- a/receiver/postgresqlreceiver/factory.go +++ b/receiver/postgresqlreceiver/factory.go @@ -30,7 +30,7 @@ func createDefaultConfig() component.Config { return &Config{ ScraperControllerSettings: cfg, - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:5432", Transport: "tcp", }, diff --git a/receiver/postgresqlreceiver/scraper.go b/receiver/postgresqlreceiver/scraper.go index bb19c497afc1..37558f68780e 100644 --- a/receiver/postgresqlreceiver/scraper.go +++ b/receiver/postgresqlreceiver/scraper.go @@ -80,7 +80,7 @@ func (d *defaultClientFactory) getClient(c *Config, database string) (client, er password: string(c.Password), database: database, tls: c.TLSClientSetting, - address: c.NetAddr, + address: c.AddrConfig, }) } diff --git a/receiver/redisreceiver/config.go b/receiver/redisreceiver/config.go index 70870380dbe1..7a932efc2aad 100644 --- a/receiver/redisreceiver/config.go +++ b/receiver/redisreceiver/config.go @@ -19,7 +19,7 @@ type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` // TODO: Use one of the configs from core. // The target endpoint. - confignet.NetAddr `mapstructure:",squash"` + confignet.AddrConfig `mapstructure:",squash"` // TODO allow users to add additional resource key value pairs? diff --git a/receiver/redisreceiver/config_test.go b/receiver/redisreceiver/config_test.go index 9e0789d22249..a70ac3c10a6f 100644 --- a/receiver/redisreceiver/config_test.go +++ b/receiver/redisreceiver/config_test.go @@ -31,7 +31,7 @@ func TestConfig(t *testing.T) { assert.Equal(t, &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: "localhost:6379", Transport: "tcp", }, diff --git a/receiver/redisreceiver/factory.go b/receiver/redisreceiver/factory.go index bad88a7f7a1b..495a5837fed5 100644 --- a/receiver/redisreceiver/factory.go +++ b/receiver/redisreceiver/factory.go @@ -29,7 +29,7 @@ func createDefaultConfig() component.Config { scs := scraperhelper.NewDefaultScraperControllerSettings(metadata.Type) scs.CollectionInterval = 10 * time.Second return &Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Transport: "tcp", }, TLS: configtls.TLSClientSetting{ diff --git a/receiver/saphanareceiver/client.go b/receiver/saphanareceiver/client.go index d11cef26b5ab..2c725f23e47e 100644 --- a/receiver/saphanareceiver/client.go +++ b/receiver/saphanareceiver/client.go @@ -102,7 +102,7 @@ func newSapHanaClient(cfg *Config, factory sapHanaConnectionFactory) client { } func (c *sapHanaClient) Connect(ctx context.Context) error { - connector, err := sapdriver.NewDSNConnector(fmt.Sprintf("hdb://%s:%s@%s", c.receiverConfig.Username, string(c.receiverConfig.Password), c.receiverConfig.TCPAddr.Endpoint)) + connector, err := sapdriver.NewDSNConnector(fmt.Sprintf("hdb://%s:%s@%s", c.receiverConfig.Username, string(c.receiverConfig.Password), c.receiverConfig.TCPAddrConfig.Endpoint)) if err != nil { return fmt.Errorf("error generating DSN for SAP HANA connection: %w", err) } diff --git a/receiver/saphanareceiver/config.go b/receiver/saphanareceiver/config.go index d073b79b6864..5d7a923ae18e 100644 --- a/receiver/saphanareceiver/config.go +++ b/receiver/saphanareceiver/config.go @@ -23,7 +23,7 @@ const ( type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` - confignet.TCPAddr `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` configtls.TLSClientSetting `mapstructure:"tls,omitempty"` // MetricsBuilderConfig defines which metrics/attributes to enable for the scraper metadata.MetricsBuilderConfig `mapstructure:",squash"` diff --git a/receiver/saphanareceiver/factory.go b/receiver/saphanareceiver/factory.go index 57d82ae6685c..b9d3bd4bd840 100644 --- a/receiver/saphanareceiver/factory.go +++ b/receiver/saphanareceiver/factory.go @@ -34,7 +34,7 @@ func createDefaultConfig() component.Config { scs := scraperhelper.NewDefaultScraperControllerSettings(metadata.Type) scs.CollectionInterval = 10 * time.Second return &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: defaultEndpoint, }, TLSClientSetting: configtls.TLSClientSetting{ diff --git a/receiver/skywalkingreceiver/config_test.go b/receiver/skywalkingreceiver/config_test.go index 70052571d425..0a1b1c15a3c2 100644 --- a/receiver/skywalkingreceiver/config_test.go +++ b/receiver/skywalkingreceiver/config_test.go @@ -47,7 +47,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:11800", Transport: "tcp", }, diff --git a/receiver/skywalkingreceiver/factory.go b/receiver/skywalkingreceiver/factory.go index a1f0a493d69a..6084583ed357 100644 --- a/receiver/skywalkingreceiver/factory.go +++ b/receiver/skywalkingreceiver/factory.go @@ -47,7 +47,7 @@ func createDefaultConfig() component.Config { return &Config{ Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: localhostgate.EndpointForPort(defaultGRPCPort), Transport: "tcp", }, diff --git a/receiver/skywalkingreceiver/factory_test.go b/receiver/skywalkingreceiver/factory_test.go index a14c770c789e..7ab5e7480248 100644 --- a/receiver/skywalkingreceiver/factory_test.go +++ b/receiver/skywalkingreceiver/factory_test.go @@ -42,7 +42,7 @@ func TestCreateReceiver(t *testing.T) { cfg := factory.CreateDefaultConfig() // have to enable at least one protocol for the skywalking receiver to be created cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:11800", Transport: "tcp", }, @@ -87,7 +87,7 @@ func TestCreateDefaultGRPCEndpoint(t *testing.T) { cfg := factory.CreateDefaultConfig() cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:11800", Transport: "tcp", }, @@ -105,7 +105,7 @@ func TestCreateTLSGPRCEndpoint(t *testing.T) { cfg := factory.CreateDefaultConfig() cfg.(*Config).Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "0.0.0.0:11800", Transport: "tcp", }, diff --git a/receiver/statsdreceiver/config.go b/receiver/statsdreceiver/config.go index 4e9a2d5eb75d..b0ccd36302ac 100644 --- a/receiver/statsdreceiver/config.go +++ b/receiver/statsdreceiver/config.go @@ -16,7 +16,7 @@ import ( // Config defines configuration for StatsD receiver. type Config struct { - NetAddr confignet.NetAddr `mapstructure:",squash"` + NetAddr confignet.AddrConfig `mapstructure:",squash"` AggregationInterval time.Duration `mapstructure:"aggregation_interval"` EnableMetricType bool `mapstructure:"enable_metric_type"` EnableSimpleTags bool `mapstructure:"enable_simple_tags"` diff --git a/receiver/statsdreceiver/config_test.go b/receiver/statsdreceiver/config_test.go index b9d726e0baca..feac712d51cb 100644 --- a/receiver/statsdreceiver/config_test.go +++ b/receiver/statsdreceiver/config_test.go @@ -37,7 +37,7 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "receiver_settings"), expected: &Config{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:12345", Transport: "custom_transport", }, diff --git a/receiver/statsdreceiver/factory.go b/receiver/statsdreceiver/factory.go index d3b66404221c..85d9fca0b95c 100644 --- a/receiver/statsdreceiver/factory.go +++ b/receiver/statsdreceiver/factory.go @@ -39,7 +39,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: defaultBindEndpoint, Transport: defaultTransport, }, diff --git a/receiver/statsdreceiver/receiver_test.go b/receiver/statsdreceiver/receiver_test.go index 07e7b53c76fc..9b2ce42c335d 100644 --- a/receiver/statsdreceiver/receiver_test.go +++ b/receiver/statsdreceiver/receiver_test.go @@ -37,7 +37,7 @@ func Test_statsdreceiver_Start(t *testing.T) { name: "unsupported transport", args: args{ config: Config{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: "localhost:8125", Transport: "unknown", }, @@ -94,7 +94,7 @@ func Test_statsdreceiver_EndToEnd(t *testing.T) { addr: testutil.GetAvailableLocalNetworkAddress(t, "udp"), configFn: func() *Config { return &Config{ - NetAddr: confignet.NetAddr{ + NetAddr: confignet.AddrConfig{ Endpoint: defaultBindEndpoint, Transport: defaultTransport, }, diff --git a/receiver/wavefrontreceiver/config.go b/receiver/wavefrontreceiver/config.go index 6b0b20cad5fd..4f5d4b73eff6 100644 --- a/receiver/wavefrontreceiver/config.go +++ b/receiver/wavefrontreceiver/config.go @@ -12,7 +12,7 @@ import ( // Config defines configuration for the Wavefront receiver. type Config struct { - confignet.TCPAddr `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` // TCPIdleTimeout is the timout for idle TCP connections. TCPIdleTimeout time.Duration `mapstructure:"tcp_idle_timeout"` diff --git a/receiver/wavefrontreceiver/config_test.go b/receiver/wavefrontreceiver/config_test.go index 590e407bc204..45ea42bd30ee 100644 --- a/receiver/wavefrontreceiver/config_test.go +++ b/receiver/wavefrontreceiver/config_test.go @@ -34,7 +34,7 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "allsettings"), expected: &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "localhost:8080", }, TCPIdleTimeout: 5 * time.Second, diff --git a/receiver/wavefrontreceiver/factory.go b/receiver/wavefrontreceiver/factory.go index 7da77a461942..7e727eeedce9 100644 --- a/receiver/wavefrontreceiver/factory.go +++ b/receiver/wavefrontreceiver/factory.go @@ -33,7 +33,7 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: "localhost:2003", }, TCPIdleTimeout: tcpIdleTimeoutDefault, diff --git a/receiver/wavefrontreceiver/receiver.go b/receiver/wavefrontreceiver/receiver.go index 2a3c5c6cac41..35e60ff3b51c 100644 --- a/receiver/wavefrontreceiver/receiver.go +++ b/receiver/wavefrontreceiver/receiver.go @@ -42,7 +42,7 @@ func (r *metricsReceiver) Start(ctx context.Context, host component.Host) error // The Wavefront receiver leverages the Carbon receiver code by implementing // a dedicated parser for its format. carbonCfg := &carbonreceiver.Config{ - NetAddr: confignet.NetAddr{ + AddrConfig: confignet.AddrConfig{ Endpoint: r.cfg.Endpoint, Transport: "tcp", }, diff --git a/receiver/zookeeperreceiver/config.go b/receiver/zookeeperreceiver/config.go index cde56452312e..0bd42b26dbef 100644 --- a/receiver/zookeeperreceiver/config.go +++ b/receiver/zookeeperreceiver/config.go @@ -12,6 +12,6 @@ import ( type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` - confignet.TCPAddr `mapstructure:",squash"` + confignet.TCPAddrConfig `mapstructure:",squash"` metadata.MetricsBuilderConfig `mapstructure:",squash"` } diff --git a/receiver/zookeeperreceiver/factory.go b/receiver/zookeeperreceiver/factory.go index 2bee6389e2b7..3778e274ca75 100644 --- a/receiver/zookeeperreceiver/factory.go +++ b/receiver/zookeeperreceiver/factory.go @@ -38,7 +38,7 @@ func createDefaultConfig() component.Config { return &Config{ ScraperControllerSettings: cfg, - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: localhostgate.EndpointForPort(defaultPort), }, MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), diff --git a/receiver/zookeeperreceiver/factory_test.go b/receiver/zookeeperreceiver/factory_test.go index bdb219e9a4f8..251d4cf27a5c 100644 --- a/receiver/zookeeperreceiver/factory_test.go +++ b/receiver/zookeeperreceiver/factory_test.go @@ -47,7 +47,7 @@ func TestFactory(t *testing.T) { { name: "Invalid timeout", config: &Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: ":2181", }, }, diff --git a/receiver/zookeeperreceiver/scraper.go b/receiver/zookeeperreceiver/scraper.go index 24c6e42142b2..ed723db342e2 100644 --- a/receiver/zookeeperreceiver/scraper.go +++ b/receiver/zookeeperreceiver/scraper.go @@ -46,7 +46,7 @@ func (z *zookeeperMetricsScraper) Name() string { } func newZookeeperMetricsScraper(settings receiver.CreateSettings, config *Config) (*zookeeperMetricsScraper, error) { - _, _, err := net.SplitHostPort(config.TCPAddr.Endpoint) + _, _, err := net.SplitHostPort(config.TCPAddrConfig.Endpoint) if err != nil { return nil, err } diff --git a/receiver/zookeeperreceiver/scraper_test.go b/receiver/zookeeperreceiver/scraper_test.go index 7cbc45beb483..79119c817035 100644 --- a/receiver/zookeeperreceiver/scraper_test.go +++ b/receiver/zookeeperreceiver/scraper_test.go @@ -276,7 +276,7 @@ func TestZookeeperMetricsScraperScrape(t *testing.T) { } cfg := createDefaultConfig().(*Config) - cfg.TCPAddr.Endpoint = localAddr + cfg.TCPAddrConfig.Endpoint = localAddr if tt.metricsConfig != nil { cfg.MetricsBuilderConfig.Metrics = tt.metricsConfig() } diff --git a/testbed/datareceivers/jaeger.go b/testbed/datareceivers/jaeger.go index 8d9adf9a1b43..baaddaf9b1bc 100644 --- a/testbed/datareceivers/jaeger.go +++ b/testbed/datareceivers/jaeger.go @@ -34,7 +34,7 @@ func (jr *jaegerDataReceiver) Start(tc consumer.Traces, _ consumer.Metrics, _ co factory := jaegerreceiver.NewFactory() cfg := factory.CreateDefaultConfig().(*jaegerreceiver.Config) cfg.Protocols.GRPC = &configgrpc.ServerConfig{ - NetAddr: confignet.NetAddr{Endpoint: fmt.Sprintf("127.0.0.1:%d", jr.Port), Transport: "tcp"}, + NetAddr: confignet.AddrConfig{Endpoint: fmt.Sprintf("127.0.0.1:%d", jr.Port), Transport: "tcp"}, } var err error set := receivertest.NewNopCreateSettings() diff --git a/testbed/datareceivers/opencensus.go b/testbed/datareceivers/opencensus.go index 74e8bfa89dac..c945e587930b 100644 --- a/testbed/datareceivers/opencensus.go +++ b/testbed/datareceivers/opencensus.go @@ -33,7 +33,7 @@ func NewOCDataReceiver(port int) testbed.DataReceiver { func (or *ocDataReceiver) Start(tc consumer.Traces, mc consumer.Metrics, _ consumer.Logs) error { factory := opencensusreceiver.NewFactory() cfg := factory.CreateDefaultConfig().(*opencensusreceiver.Config) - cfg.NetAddr = confignet.NetAddr{Endpoint: fmt.Sprintf("127.0.0.1:%d", or.Port), Transport: "tcp"} + cfg.NetAddr = confignet.AddrConfig{Endpoint: fmt.Sprintf("127.0.0.1:%d", or.Port), Transport: "tcp"} var err error set := receivertest.NewNopCreateSettings() if or.traceReceiver, err = factory.CreateTracesReceiver(context.Background(), set, cfg, tc); err != nil { diff --git a/testbed/datasenders/carbon.go b/testbed/datasenders/carbon.go index e6a67fc13a24..7ea620f39ab5 100644 --- a/testbed/datasenders/carbon.go +++ b/testbed/datasenders/carbon.go @@ -42,7 +42,7 @@ func NewCarbonDataSender(port int) *CarbonDataSender { func (cs *CarbonDataSender) Start() error { factory := carbonexporter.NewFactory() cfg := &carbonexporter.Config{ - TCPAddr: confignet.TCPAddr{ + TCPAddrConfig: confignet.TCPAddrConfig{ Endpoint: cs.GetEndpoint().String(), }, TimeoutSettings: exporterhelper.TimeoutSettings{ diff --git a/testbed/testbed/receivers.go b/testbed/testbed/receivers.go index 59937042e358..37225fe1dc5d 100644 --- a/testbed/testbed/receivers.go +++ b/testbed/testbed/receivers.go @@ -61,7 +61,7 @@ func (bor *BaseOTLPDataReceiver) Start(tc consumer.Traces, mc consumer.Metrics, factory := otlpreceiver.NewFactory() cfg := factory.CreateDefaultConfig().(*otlpreceiver.Config) if bor.exporterType == "otlp" { - cfg.GRPC.NetAddr = confignet.NetAddr{Endpoint: fmt.Sprintf("127.0.0.1:%d", bor.Port), Transport: "tcp"} + cfg.GRPC.NetAddr = confignet.AddrConfig{Endpoint: fmt.Sprintf("127.0.0.1:%d", bor.Port), Transport: "tcp"} cfg.HTTP = nil } else { cfg.HTTP.Endpoint = fmt.Sprintf("127.0.0.1:%d", bor.Port)