diff --git a/cmd/opampsupervisor/supervisor/supervisor.go b/cmd/opampsupervisor/supervisor/supervisor.go index 799ebcbec8451..3bbb673e26139 100644 --- a/cmd/opampsupervisor/supervisor/supervisor.go +++ b/cmd/opampsupervisor/supervisor/supervisor.go @@ -764,7 +764,7 @@ func (s *Supervisor) startHealthCheckServer() error { healthCheckServerPort := s.config.HealthCheck.Port() server, err := s.config.HealthCheck.ToServer( s.runCtx, - nopHost{}, + nil, s.telemetrySettings.TelemetrySettings, mux, ) diff --git a/connector/grafanacloudconnector/connector_test.go b/connector/grafanacloudconnector/connector_test.go index 8c5299abafb0a..f736bd905ca0b 100644 --- a/connector/grafanacloudconnector/connector_test.go +++ b/connector/grafanacloudconnector/connector_test.go @@ -7,6 +7,7 @@ import ( "testing" "time" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/connector/connectortest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/ptrace" @@ -141,7 +142,7 @@ func TestConsumeTraces(t *testing.T) { assert.NilError(t, err) ctx := t.Context() - assert.NilError(t, c.Start(ctx, nil)) + assert.NilError(t, c.Start(ctx, componenttest.NewNopHost())) err = c.ConsumeTraces(ctx, tc.input) assert.NilError(t, err) assert.NilError(t, c.Shutdown(ctx)) diff --git a/exporter/alertmanagerexporter/alertmanager_exporter.go b/exporter/alertmanagerexporter/alertmanager_exporter.go index 36feed0c6ec38..f779cb2d9d0e5 100644 --- a/exporter/alertmanagerexporter/alertmanager_exporter.go +++ b/exporter/alertmanagerexporter/alertmanager_exporter.go @@ -189,7 +189,7 @@ func (s *alertmanagerExporter) pushTraces(ctx context.Context, td ptrace.Traces) } func (s *alertmanagerExporter) start(ctx context.Context, host component.Host) error { - client, err := s.config.ToClient(ctx, host, s.settings) + client, err := s.config.ToClient(ctx, host.GetExtensions(), s.settings) if err != nil { return fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/exporter/azuremonitorexporter/azuremonitor_exporter.go b/exporter/azuremonitorexporter/azuremonitor_exporter.go index 759c749979ba9..815ae89f2cf99 100644 --- a/exporter/azuremonitorexporter/azuremonitor_exporter.go +++ b/exporter/azuremonitorexporter/azuremonitor_exporter.go @@ -34,7 +34,7 @@ func (exporter *azureMonitorExporter) Start(ctx context.Context, host component. exporter.config.InstrumentationKey = configopaque.String(connectionVars.InstrumentationKey) exporter.config.ClientConfig.Endpoint = connectionVars.IngestionURL telemetryConfiguration := appinsights.NewTelemetryConfiguration(connectionVars.InstrumentationKey) - telemetryConfiguration.Client, err = exporter.config.ClientConfig.ToClient(ctx, host, exporter.settings) + telemetryConfiguration.Client, err = exporter.config.ClientConfig.ToClient(ctx, host.GetExtensions(), exporter.settings) if err != nil { return err } diff --git a/exporter/bmchelixexporter/internal/operationsmanagement/metrics_client.go b/exporter/bmchelixexporter/internal/operationsmanagement/metrics_client.go index 55b4535759b62..b9a0bc7113b51 100644 --- a/exporter/bmchelixexporter/internal/operationsmanagement/metrics_client.go +++ b/exporter/bmchelixexporter/internal/operationsmanagement/metrics_client.go @@ -26,7 +26,7 @@ type MetricsClient struct { // NewMetricsClient creates a new MetricsClient func NewMetricsClient(ctx context.Context, clientConfig confighttp.ClientConfig, apiKey configopaque.String, host component.Host, settings component.TelemetrySettings, logger *zap.Logger) (*MetricsClient, error) { - httpClient, err := clientConfig.ToClient(ctx, host, settings) + httpClient, err := clientConfig.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, err } diff --git a/exporter/coralogixexporter/config.go b/exporter/coralogixexporter/config.go index 211146f165dcc..08e7a800d7a16 100644 --- a/exporter/coralogixexporter/config.go +++ b/exporter/coralogixexporter/config.go @@ -49,7 +49,7 @@ func (c *TransportConfig) ToHTTPClient(ctx context.Context, host component.Host, Headers: c.Headers, Compression: c.Compression, } - return httpClientConfig.ToClient(ctx, host, settings) + return httpClientConfig.ToClient(ctx, host.GetExtensions(), settings) } // Config defines configuration for Coralogix exporter. diff --git a/exporter/coralogixexporter/signals.go b/exporter/coralogixexporter/signals.go index 0161ea37849a2..8198ea743a7aa 100644 --- a/exporter/coralogixexporter/signals.go +++ b/exporter/coralogixexporter/signals.go @@ -36,7 +36,7 @@ type signalConfigWrapper struct { } func (w *signalConfigWrapper) ToClientConn(ctx context.Context, host component.Host, settings component.TelemetrySettings, opts ...configgrpc.ToClientConnOption) (*grpc.ClientConn, error) { - return w.config.ToClientConn(ctx, host, settings, opts...) + return w.config.ToClientConn(ctx, host.GetExtensions(), settings, opts...) } func (w *signalConfigWrapper) ToHTTPClient(ctx context.Context, host component.Host, settings component.TelemetrySettings) (*http.Client, error) { @@ -146,7 +146,7 @@ func (e *signalExporter) startSignalExporter(ctx context.Context, host component return err } } else { - if e.clientConn, err = transportConfig.ToClientConn(ctx, host, e.settings, configgrpc.WithGrpcDialOption(grpc.WithUserAgent(e.userAgent))); err != nil { + if e.clientConn, err = transportConfig.ToClientConn(ctx, host.GetExtensions(), e.settings, configgrpc.WithGrpcDialOption(grpc.WithUserAgent(e.userAgent))); err != nil { return err } e.callOptions = []grpc.CallOption{ diff --git a/exporter/datadogexporter/factory_test.go b/exporter/datadogexporter/factory_test.go index 008dd018ab03b..dcea18ba193aa 100644 --- a/exporter/datadogexporter/factory_test.go +++ b/exporter/datadogexporter/factory_test.go @@ -16,6 +16,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/confignet" "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/confmap/confmaptest" @@ -236,7 +237,7 @@ func TestOnlyMetadata(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, expMetrics) - err = expTraces.Start(ctx, nil) + err = expTraces.Start(ctx, componenttest.NewNopHost()) assert.NoError(t, err) defer func() { assert.NoError(t, expTraces.Shutdown(ctx)) @@ -284,9 +285,9 @@ func TestStopExporters(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, expMetrics) - err = expTraces.Start(ctx, nil) + err = expTraces.Start(ctx, componenttest.NewNopHost()) assert.NoError(t, err) - err = expMetrics.Start(ctx, nil) + err = expMetrics.Start(ctx, componenttest.NewNopHost()) assert.NoError(t, err) finishShutdown := make(chan bool) diff --git a/exporter/datadogexporter/logs_exporter_test.go b/exporter/datadogexporter/logs_exporter_test.go index 626f91827a01e..4e409d33f1eef 100644 --- a/exporter/datadogexporter/logs_exporter_test.go +++ b/exporter/datadogexporter/logs_exporter_test.go @@ -14,6 +14,7 @@ import ( "github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/confignet" "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/pdata/pcommon" @@ -433,7 +434,7 @@ func TestLogsExporterHostMetadata(t *testing.T) { assert.NotNil(t, exp) // Test 2: Verify exporter can start successfully (this initializes metadata infrastructure) - err = exp.Start(t.Context(), nil) + err = exp.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) defer func() { assert.NoError(t, exp.Shutdown(t.Context())) @@ -495,7 +496,7 @@ func TestLogsExporterHostMetadataOnlyMode(t *testing.T) { require.NoError(t, err) assert.NotNil(t, exp) - err = exp.Start(t.Context(), nil) + err = exp.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) defer func() { assert.NoError(t, exp.Shutdown(t.Context())) diff --git a/exporter/dorisexporter/exporter_common.go b/exporter/dorisexporter/exporter_common.go index 73361e9513f4e..fc01a008b6613 100644 --- a/exporter/dorisexporter/exporter_common.go +++ b/exporter/dorisexporter/exporter_common.go @@ -111,7 +111,7 @@ func streamLoadRequest(ctx context.Context, cfg *Config, table string, data []by } func createDorisHTTPClient(ctx context.Context, cfg *Config, host component.Host, settings component.TelemetrySettings) (*http.Client, error) { - client, err := cfg.ToClient(ctx, host, settings) + client, err := cfg.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, err } diff --git a/exporter/dorisexporter/exporter_logs_test.go b/exporter/dorisexporter/exporter_logs_test.go index aea34324cb87c..65e098951137e 100644 --- a/exporter/dorisexporter/exporter_logs_test.go +++ b/exporter/dorisexporter/exporter_logs_test.go @@ -33,7 +33,7 @@ func TestPushLogData(t *testing.T) { ctx := t.Context() - client, err := createDorisHTTPClient(ctx, config, nil, componenttest.NewNopTelemetrySettings()) + client, err := createDorisHTTPClient(ctx, config, componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings()) require.NoError(t, err) require.NotNil(t, client) diff --git a/exporter/dorisexporter/exporter_metrics_test.go b/exporter/dorisexporter/exporter_metrics_test.go index 199992ebe476d..468f294e6a6ed 100644 --- a/exporter/dorisexporter/exporter_metrics_test.go +++ b/exporter/dorisexporter/exporter_metrics_test.go @@ -31,7 +31,7 @@ func TestPushMetricData(t *testing.T) { ctx := t.Context() - client, err := createDorisHTTPClient(ctx, config, nil, componenttest.NewNopTelemetrySettings()) + client, err := createDorisHTTPClient(ctx, config, componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings()) require.NoError(t, err) require.NotNil(t, client) diff --git a/exporter/dorisexporter/exporter_traces_test.go b/exporter/dorisexporter/exporter_traces_test.go index 80d47e42716e9..508fde0907331 100644 --- a/exporter/dorisexporter/exporter_traces_test.go +++ b/exporter/dorisexporter/exporter_traces_test.go @@ -32,7 +32,7 @@ func TestPushTraceData(t *testing.T) { ctx := t.Context() - client, err := createDorisHTTPClient(ctx, config, nil, componenttest.NewNopTelemetrySettings()) + client, err := createDorisHTTPClient(ctx, config, componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings()) require.NoError(t, err) require.NotNil(t, client) diff --git a/exporter/elasticsearchexporter/esclient.go b/exporter/elasticsearchexporter/esclient.go index 687c298bd12bf..fb9c3a1835a93 100644 --- a/exporter/elasticsearchexporter/esclient.go +++ b/exporter/elasticsearchexporter/esclient.go @@ -107,7 +107,7 @@ func newElasticsearchClient( telemetry component.TelemetrySettings, userAgent string, ) (esapi.Transport, error) { - httpClient, err := config.ToClient(ctx, host, telemetry) + httpClient, err := config.ToClient(ctx, host.GetExtensions(), telemetry) if err != nil { return nil, err } diff --git a/exporter/elasticsearchexporter/integrationtest/datareceiver.go b/exporter/elasticsearchexporter/integrationtest/datareceiver.go index 89cbe02933edf..a546fefdacf57 100644 --- a/exporter/elasticsearchexporter/integrationtest/datareceiver.go +++ b/exporter/elasticsearchexporter/integrationtest/datareceiver.go @@ -368,7 +368,7 @@ func (es *mockESReceiver) Start(ctx context.Context, host component.Host) error } }) - es.server, err = es.config.ToServer(ctx, host, es.params.TelemetrySettings, r) + es.server, err = es.config.ToServer(ctx, host.GetExtensions(), es.params.TelemetrySettings, r) if err != nil { return fmt.Errorf("failed to create mock ES server: %w", err) } diff --git a/exporter/faroexporter/exporter.go b/exporter/faroexporter/exporter.go index 8fef9b5890b2d..a70aa9aa5cfb6 100644 --- a/exporter/faroexporter/exporter.go +++ b/exporter/faroexporter/exporter.go @@ -66,7 +66,7 @@ func newExporter(cfg component.Config, set exporter.Settings) (*faroExporter, er } func (fe *faroExporter) start(ctx context.Context, host component.Host) error { - client, err := fe.config.ToClient(ctx, host, fe.settings) + client, err := fe.config.ToClient(ctx, host.GetExtensions(), fe.settings) if err != nil { return err } diff --git a/exporter/honeycombmarkerexporter/logs_exporter.go b/exporter/honeycombmarkerexporter/logs_exporter.go index effefc721f193..fb242c0a2f5ac 100644 --- a/exporter/honeycombmarkerexporter/logs_exporter.go +++ b/exporter/honeycombmarkerexporter/logs_exporter.go @@ -158,7 +158,7 @@ func (e *honeycombLogsExporter) sendMarker(ctx context.Context, m marker, logRec } func (e *honeycombLogsExporter) start(ctx context.Context, host component.Host) (err error) { - client, err := e.httpClientSettings.ToClient(ctx, host, e.set) + client, err := e.httpClientSettings.ToClient(ctx, host.GetExtensions(), e.set) if err != nil { return err } diff --git a/exporter/influxdbexporter/writer.go b/exporter/influxdbexporter/writer.go index 63fc3029fd303..ab09d89cc6f8d 100644 --- a/exporter/influxdbexporter/writer.go +++ b/exporter/influxdbexporter/writer.go @@ -108,7 +108,7 @@ func composeWriteURL(config *Config) (string, error) { // Start implements component.StartFunc func (w *influxHTTPWriter) Start(ctx context.Context, host component.Host) error { - httpClient, err := w.httpClientSettings.ToClient(ctx, host, w.telemetrySettings) + httpClient, err := w.httpClientSettings.ToClient(ctx, host.GetExtensions(), w.telemetrySettings) if err != nil { return err } diff --git a/exporter/logicmonitorexporter/logs_exporter.go b/exporter/logicmonitorexporter/logs_exporter.go index ace79a7aa15e5..a2f3540dfdd00 100644 --- a/exporter/logicmonitorexporter/logs_exporter.go +++ b/exporter/logicmonitorexporter/logs_exporter.go @@ -46,7 +46,7 @@ func newLogsExporter(_ context.Context, cfg component.Config, set exporter.Setti } func (e *logExporter) start(ctx context.Context, host component.Host) error { - client, err := e.config.ToClient(ctx, host, e.settings) + client, err := e.config.ToClient(ctx, host.GetExtensions(), e.settings) if err != nil { return fmt.Errorf("failed to create http client: %w", err) } diff --git a/exporter/logicmonitorexporter/traces_exporter.go b/exporter/logicmonitorexporter/traces_exporter.go index cb090f133f945..510a791a1c4a8 100644 --- a/exporter/logicmonitorexporter/traces_exporter.go +++ b/exporter/logicmonitorexporter/traces_exporter.go @@ -34,7 +34,7 @@ func newTracesExporter(_ context.Context, cfg component.Config, set exporter.Set } func (e *tracesExporter) start(ctx context.Context, host component.Host) error { - client, err := e.config.ToClient(ctx, host, e.settings) + client, err := e.config.ToClient(ctx, host.GetExtensions(), e.settings) if err != nil { return fmt.Errorf("failed to create http client: %w", err) } diff --git a/exporter/logzioexporter/exporter.go b/exporter/logzioexporter/exporter.go index 77cc5868708c4..032f1572a593c 100644 --- a/exporter/logzioexporter/exporter.go +++ b/exporter/logzioexporter/exporter.go @@ -105,7 +105,7 @@ func newLogzioLogsExporter(config *Config, set exporter.Settings) (exporter.Logs } func (exporter *logzioExporter) start(ctx context.Context, host component.Host) error { - client, err := exporter.config.ToClient(ctx, host, exporter.settings) + client, err := exporter.config.ToClient(ctx, host.GetExtensions(), exporter.settings) if err != nil { return err } diff --git a/exporter/mezmoexporter/exporter.go b/exporter/mezmoexporter/exporter.go index e077c22bdca2b..0df5a75cccca7 100644 --- a/exporter/mezmoexporter/exporter.go +++ b/exporter/mezmoexporter/exporter.go @@ -58,7 +58,7 @@ func (m *mezmoExporter) pushLogData(_ context.Context, ld plog.Logs) error { } func (m *mezmoExporter) start(ctx context.Context, host component.Host) (err error) { - m.client, err = m.config.ToClient(ctx, host, m.settings) + m.client, err = m.config.ToClient(ctx, host.GetExtensions(), m.settings) return err } diff --git a/exporter/opensearchexporter/sso_log_exporter.go b/exporter/opensearchexporter/sso_log_exporter.go index 9481c4bdb569c..2bd3a4245a161 100644 --- a/exporter/opensearchexporter/sso_log_exporter.go +++ b/exporter/opensearchexporter/sso_log_exporter.go @@ -57,7 +57,7 @@ func newLogExporter(cfg *Config, set exporter.Settings) *logExporter { } func (l *logExporter) Start(ctx context.Context, host component.Host) error { - httpClient, err := l.httpSettings.ToClient(ctx, host, l.telemetry) + httpClient, err := l.httpSettings.ToClient(ctx, host.GetExtensions(), l.telemetry) if err != nil { return err } diff --git a/exporter/opensearchexporter/sso_trace_exporter.go b/exporter/opensearchexporter/sso_trace_exporter.go index 54c9adc6c5d37..3449a691df237 100644 --- a/exporter/opensearchexporter/sso_trace_exporter.go +++ b/exporter/opensearchexporter/sso_trace_exporter.go @@ -48,7 +48,7 @@ func newSSOTracesExporter(cfg *Config, set exporter.Settings) *ssoTracesExporter } func (s *ssoTracesExporter) Start(ctx context.Context, host component.Host) error { - httpClient, err := s.httpSettings.ToClient(ctx, host, s.telemetry) + httpClient, err := s.httpSettings.ToClient(ctx, host.GetExtensions(), s.telemetry) if err != nil { return err } diff --git a/exporter/otelarrowexporter/otelarrow.go b/exporter/otelarrowexporter/otelarrow.go index 15ec08cdc8abe..828ad18c37704 100644 --- a/exporter/otelarrowexporter/otelarrow.go +++ b/exporter/otelarrowexporter/otelarrow.go @@ -117,7 +117,7 @@ func (e *baseExporter) start(ctx context.Context, host component.Host) (err erro dialOpts = append(dialOpts, configgrpc.WithGrpcDialOption(opt)) } - if e.clientConn, err = e.config.ToClientConn(ctx, host, e.settings.TelemetrySettings, dialOpts...); err != nil { + if e.clientConn, err = e.config.ToClientConn(ctx, host.GetExtensions(), e.settings.TelemetrySettings, dialOpts...); err != nil { return err } e.traceExporter = ptraceotlp.NewGRPCClient(e.clientConn) diff --git a/exporter/prometheusexporter/end_to_end_test.go b/exporter/prometheusexporter/end_to_end_test.go index 928eb722d34f8..764b187113849 100644 --- a/exporter/prometheusexporter/end_to_end_test.go +++ b/exporter/prometheusexporter/end_to_end_test.go @@ -18,6 +18,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/receiver/receivertest" @@ -67,7 +68,7 @@ func TestEndToEndSummarySupport(t *testing.T) { set := exportertest.NewNopSettings(metadata.Type) exporter, err := exporterFactory.CreateMetrics(ctx, set, exporterCfg) require.NoError(t, err) - require.NoError(t, exporter.Start(ctx, nil), "Failed to start the Prometheus exporter") + require.NoError(t, exporter.Start(ctx, componenttest.NewNopHost()), "Failed to start the Prometheus exporter") t.Cleanup(func() { require.NoError(t, exporter.Shutdown(ctx)) }) // 3. Create the Prometheus receiver scraping from the DropWizard mock server and @@ -94,7 +95,7 @@ func TestEndToEndSummarySupport(t *testing.T) { // 3.5 Create the Prometheus receiver and pass in the previously created Prometheus exporter. prometheusReceiver, err := receiverFactory.CreateMetrics(ctx, receiverCreateSet, rcvCfg, exporter) require.NoError(t, err) - require.NoError(t, prometheusReceiver.Start(ctx, nil), "Failed to start the Prometheus receiver") + require.NoError(t, prometheusReceiver.Start(ctx, componenttest.NewNopHost()), "Failed to start the Prometheus receiver") t.Cleanup(func() { require.NoError(t, prometheusReceiver.Shutdown(ctx)) }) // 4. Scrape from the Prometheus receiver to ensure that we export summary metrics diff --git a/exporter/prometheusexporter/prometheus.go b/exporter/prometheusexporter/prometheus.go index 909375edb1751..c13ab34df6970 100644 --- a/exporter/prometheusexporter/prometheus.go +++ b/exporter/prometheusexporter/prometheus.go @@ -71,7 +71,7 @@ func (pe *prometheusExporter) Start(ctx context.Context, host component.Host) er mux := http.NewServeMux() mux.Handle("/metrics", pe.handler) - srv, err := pe.config.ToServer(ctx, host, pe.settings, mux) + srv, err := pe.config.ToServer(ctx, host.GetExtensions(), pe.settings, mux) if err != nil { lnerr := ln.Close() return errors.Join(err, lnerr) diff --git a/exporter/prometheusremotewriteexporter/exporter.go b/exporter/prometheusremotewriteexporter/exporter.go index 2f05b106fa4ca..b2ee981b5e71e 100644 --- a/exporter/prometheusremotewriteexporter/exporter.go +++ b/exporter/prometheusremotewriteexporter/exporter.go @@ -230,7 +230,7 @@ func newPRWExporter(cfg *Config, set exporter.Settings) (*prwExporter, error) { // Start creates the prometheus client func (prwe *prwExporter) Start(ctx context.Context, host component.Host) (err error) { - prwe.client, err = prwe.clientSettings.ToClient(ctx, host, prwe.settings) + prwe.client, err = prwe.clientSettings.ToClient(ctx, host.GetExtensions(), prwe.settings) if err != nil { return err } diff --git a/exporter/sematextexporter/writer.go b/exporter/sematextexporter/writer.go index 2e8e54bc0a7b0..d65bc68d3a833 100644 --- a/exporter/sematextexporter/writer.go +++ b/exporter/sematextexporter/writer.go @@ -88,7 +88,7 @@ func composeWriteURL(config *Config) (string, error) { // Start implements component.StartFunc func (w *sematextHTTPWriter) Start(ctx context.Context, host component.Host) error { - httpClient, err := w.httpClientSettings.ToClient(ctx, host, w.telemetrySettings) + httpClient, err := w.httpClientSettings.ToClient(ctx, host.GetExtensions(), w.telemetrySettings) if err != nil { return err } diff --git a/exporter/signalfxexporter/exporter.go b/exporter/signalfxexporter/exporter.go index 66393080cf919..86199ec6e8d73 100644 --- a/exporter/signalfxexporter/exporter.go +++ b/exporter/signalfxexporter/exporter.go @@ -217,7 +217,7 @@ func (se *signalfxExporter) startLogs(ctx context.Context, host component.Host) func (se *signalfxExporter) createClient(ctx context.Context, host component.Host) (*http.Client, error) { se.config.TLS = se.config.IngestTLSs - return se.config.ToClient(ctx, host, se.telemetrySettings) + return se.config.ToClient(ctx, host.GetExtensions(), se.telemetrySettings) } func (se *signalfxExporter) pushMetrics(ctx context.Context, md pmetric.Metrics) error { diff --git a/exporter/signalfxexporter/exporter_test.go b/exporter/signalfxexporter/exporter_test.go index 7dc8967fe9e69..a90aa65ce9702 100644 --- a/exporter/signalfxexporter/exporter_test.go +++ b/exporter/signalfxexporter/exporter_test.go @@ -192,7 +192,7 @@ func TestConsumeMetrics(t *testing.T) { }, } - client, err := cfg.ToClient(t.Context(), componenttest.NewNopHost(), exportertest.NewNopSettings(componentmetadata.Type).TelemetrySettings) + client, err := cfg.ToClient(t.Context(), nil, exportertest.NewNopSettings(componentmetadata.Type).TelemetrySettings) require.NoError(t, err) c, err := translation.NewMetricsConverter(zap.NewNop(), nil, nil, nil, "", false, true) @@ -938,7 +938,7 @@ func TestConsumeEventData(t *testing.T) { }, } - client, err := cfg.ToClient(t.Context(), componenttest.NewNopHost(), exportertest.NewNopSettings(componentmetadata.Type).TelemetrySettings) + client, err := cfg.ToClient(t.Context(), nil, exportertest.NewNopSettings(componentmetadata.Type).TelemetrySettings) require.NoError(t, err) eventClient := &sfxEventClient{ @@ -2057,7 +2057,7 @@ func TestConsumeMixedMetrics(t *testing.T) { }, } - client, err := cfg.ToClient(t.Context(), componenttest.NewNopHost(), exportertest.NewNopSettings(componentmetadata.Type).TelemetrySettings) + client, err := cfg.ToClient(t.Context(), nil, exportertest.NewNopSettings(componentmetadata.Type).TelemetrySettings) require.NoError(t, err) c, err := translation.NewMetricsConverter(zap.NewNop(), nil, nil, nil, "", false, false) diff --git a/exporter/signalfxexporter/internal/correlation/correlation.go b/exporter/signalfxexporter/internal/correlation/correlation.go index b7678cc4e7871..eb0c16e480e8c 100644 --- a/exporter/signalfxexporter/internal/correlation/correlation.go +++ b/exporter/signalfxexporter/internal/correlation/correlation.go @@ -56,7 +56,7 @@ func newCorrelationClient(ctx context.Context, cfg *Config, accessToken configop return nil, fmt.Errorf("failed to parse correlation endpoint URL %q: %w", cfg.Endpoint, err) } - httpClient, err := cfg.ToClient(ctx, host, params.TelemetrySettings) + httpClient, err := cfg.ToClient(ctx, host.GetExtensions(), params.TelemetrySettings) if err != nil { return nil, fmt.Errorf("failed to create correlation API client: %w", err) } diff --git a/exporter/splunkhecexporter/client.go b/exporter/splunkhecexporter/client.go index 56146d1fab70d..96a18c6fb2b2d 100644 --- a/exporter/splunkhecexporter/client.go +++ b/exporter/splunkhecexporter/client.go @@ -658,7 +658,7 @@ func checkHecHealth(ctx context.Context, client *http.Client, healthCheckURL *ur func buildHTTPClient(ctx context.Context, config *Config, host component.Host, telemetrySettings component.TelemetrySettings) (*http.Client, error) { // we handle compression explicitly. config.Compression = "" - return config.ToClient(ctx, host, telemetrySettings) + return config.ToClient(ctx, host.GetExtensions(), telemetrySettings) } func buildHTTPHeaders(config *Config, buildInfo component.BuildInfo) map[string]string { diff --git a/exporter/stefexporter/exporter.go b/exporter/stefexporter/exporter.go index 34bfa7b3799a2..35ed9ccb57d1c 100644 --- a/exporter/stefexporter/exporter.go +++ b/exporter/stefexporter/exporter.go @@ -66,7 +66,7 @@ func newStefExporter(set component.TelemetrySettings, cfg *Config) *stefExporter func (s *stefExporter) Start(ctx context.Context, host component.Host) error { // Prepare gRPC connection. var err error - s.grpcConn, err = s.cfg.ToClientConn(ctx, host, s.set) + s.grpcConn, err = s.cfg.ToClientConn(ctx, host.GetExtensions(), s.set) if err != nil { return err } diff --git a/exporter/sumologicexporter/exporter.go b/exporter/sumologicexporter/exporter.go index aac46a3f0274c..11702517d92fe 100644 --- a/exporter/sumologicexporter/exporter.go +++ b/exporter/sumologicexporter/exporter.go @@ -244,7 +244,7 @@ func (se *sumologicexporter) configure(ctx context.Context) error { return errors.New("no auth extension and no endpoint specified") } - client, err := httpSettings.ToClient(ctx, se.host, componenttest.NewNopTelemetrySettings()) + client, err := httpSettings.ToClient(ctx, se.host.GetExtensions(), componenttest.NewNopTelemetrySettings()) if err != nil { return fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/exporter/sumologicexporter/sender_test.go b/exporter/sumologicexporter/sender_test.go index 85f142fe8e31d..1b9aa615aa428 100644 --- a/exporter/sumologicexporter/sender_test.go +++ b/exporter/sumologicexporter/sender_test.go @@ -77,7 +77,7 @@ func prepareSenderTest(t *testing.T, compression configcompression.Type, cb []fu cfg.Auth = configoptional.None[configauth.Config]() httpSettings := cfg.ClientConfig host := componenttest.NewNopHost() - client, err := httpSettings.ToClient(t.Context(), host, componenttest.NewNopTelemetrySettings()) + client, err := httpSettings.ToClient(t.Context(), host.GetExtensions(), componenttest.NewNopTelemetrySettings()) require.NoError(t, err) if err != nil { return nil diff --git a/exporter/tinybirdexporter/exporter.go b/exporter/tinybirdexporter/exporter.go index 8e294f931ccf2..2a8edbd8a20bf 100644 --- a/exporter/tinybirdexporter/exporter.go +++ b/exporter/tinybirdexporter/exporter.go @@ -67,7 +67,7 @@ func newExporter(cfg component.Config, set exporter.Settings, opts ...option) *t func (e *tinybirdExporter) start(ctx context.Context, host component.Host) error { var err error - e.client, err = e.config.ClientConfig.ToClient(ctx, host, e.settings) + e.client, err = e.config.ClientConfig.ToClient(ctx, host.GetExtensions(), e.settings) return err } diff --git a/exporter/zipkinexporter/zipkin.go b/exporter/zipkinexporter/zipkin.go index 0235635c444ba..57d16fd574256 100644 --- a/exporter/zipkinexporter/zipkin.go +++ b/exporter/zipkinexporter/zipkin.go @@ -59,7 +59,7 @@ func createZipkinExporter(cfg *Config, settings component.TelemetrySettings) (*z // start creates the http client func (ze *zipkinExporter) start(ctx context.Context, host component.Host) (err error) { - ze.client, err = ze.clientSettings.ToClient(ctx, host, ze.settings) + ze.client, err = ze.clientSettings.ToClient(ctx, host.GetExtensions(), ze.settings) return err } diff --git a/extension/datadogextension/config_test.go b/extension/datadogextension/config_test.go index b53863efa1b6c..ee032bf4a3289 100644 --- a/extension/datadogextension/config_test.go +++ b/extension/datadogextension/config_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/extension" @@ -145,7 +146,7 @@ func TestExtensionWithProxyConfig(t *testing.T) { require.NotNil(t, serializer) // Start and stop the extension to test lifecycle - err = ext.Start(t.Context(), nil) + err = ext.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) err = ext.Shutdown(t.Context()) diff --git a/extension/encoding/otlpencodingextension/extension_test.go b/extension/encoding/otlpencodingextension/extension_test.go index 1653c50b8d44f..019f11a8dd6b3 100644 --- a/extension/encoding/otlpencodingextension/extension_test.go +++ b/extension/encoding/otlpencodingextension/extension_test.go @@ -140,7 +140,7 @@ func TestOTLPProtoUnmarshal(t *testing.T) { func createAndExtension0(t *testing.T, c *Config) *otlpExtension { ex, err := newExtension(c) require.NoError(t, err) - err = ex.Start(t.Context(), nil) + err = ex.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) return ex } diff --git a/extension/healthcheckextension/healthcheckextension.go b/extension/healthcheckextension/healthcheckextension.go index e0745b459b340..a2096bd049614 100644 --- a/extension/healthcheckextension/healthcheckextension.go +++ b/extension/healthcheckextension/healthcheckextension.go @@ -35,7 +35,7 @@ func (hc *healthCheckExtension) Start(ctx context.Context, host component.Host) return fmt.Errorf("failed to bind to address %s: %w", hc.config.Endpoint, err) } - hc.server, err = hc.config.ToServer(ctx, host, hc.settings, nil) + hc.server, err = hc.config.ToServer(ctx, host.GetExtensions(), hc.settings, nil) if err != nil { return err } diff --git a/extension/httpforwarderextension/extension.go b/extension/httpforwarderextension/extension.go index 1dda35f5db2ff..bc11f3e1d2b11 100644 --- a/extension/httpforwarderextension/extension.go +++ b/extension/httpforwarderextension/extension.go @@ -35,7 +35,7 @@ func (h *httpForwarder) Start(ctx context.Context, host component.Host) error { return fmt.Errorf("failed to bind to address %s: %w", h.config.Ingress.Endpoint, err) } - httpClient, err := h.config.Egress.ToClient(ctx, host, h.settings) + httpClient, err := h.config.Egress.ToClient(ctx, host.GetExtensions(), h.settings) if err != nil { return fmt.Errorf("failed to create HTTP Client: %w", err) } @@ -44,7 +44,7 @@ func (h *httpForwarder) Start(ctx context.Context, host component.Host) error { handler := http.NewServeMux() handler.HandleFunc("/", h.forwardRequest) - h.server, err = h.config.Ingress.ToServer(ctx, host, h.settings, handler) + h.server, err = h.config.Ingress.ToServer(ctx, host.GetExtensions(), h.settings, handler) if err != nil { return fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/extension/jaegerremotesampling/extension.go b/extension/jaegerremotesampling/extension.go index ba9bbbc738da4..ae0bf23785197 100644 --- a/extension/jaegerremotesampling/extension.go +++ b/extension/jaegerremotesampling/extension.go @@ -61,7 +61,7 @@ func (jrse *jrsExtension) Start(ctx context.Context, host component.Host) error } if jrse.cfg.Source.Remote != nil { - conn, err := jrse.cfg.Source.Remote.ToClientConn(ctx, host, jrse.telemetry) + conn, err := jrse.cfg.Source.Remote.ToClientConn(ctx, host.GetExtensions(), jrse.telemetry) if err != nil { return fmt.Errorf("failed to create the remote strategy store: %w", err) } diff --git a/extension/jaegerremotesampling/internal/server/grpc/grpc.go b/extension/jaegerremotesampling/internal/server/grpc/grpc.go index 880719a984440..7d7b5b680f849 100644 --- a/extension/jaegerremotesampling/internal/server/grpc/grpc.go +++ b/extension/jaegerremotesampling/internal/server/grpc/grpc.go @@ -60,7 +60,7 @@ type SamplingGRPCServer struct { } func (s *SamplingGRPCServer) Start(ctx context.Context, host component.Host) error { - server, err := s.settings.ToServer(ctx, host, s.telemetry) + server, err := s.settings.ToServer(ctx, host.GetExtensions(), s.telemetry) if err != nil { return err } diff --git a/extension/jaegerremotesampling/internal/server/http/http.go b/extension/jaegerremotesampling/internal/server/http/http.go index 040fb4bde6af2..0a866f9d71e07 100644 --- a/extension/jaegerremotesampling/internal/server/http/http.go +++ b/extension/jaegerremotesampling/internal/server/http/http.go @@ -56,7 +56,7 @@ func NewHTTP(telemetry component.TelemetrySettings, settings confighttp.ServerCo func (h *SamplingHTTPServer) Start(ctx context.Context, host component.Host) error { var err error - h.srv, err = h.settings.ToServer(ctx, host, h.telemetry, h.mux) + h.srv, err = h.settings.ToServer(ctx, host.GetExtensions(), h.telemetry, h.mux) if err != nil { return err } diff --git a/extension/remotetapextension/extension.go b/extension/remotetapextension/extension.go index 57e40d9f0e4c7..3644cf23d9fc2 100644 --- a/extension/remotetapextension/extension.go +++ b/extension/remotetapextension/extension.go @@ -31,7 +31,7 @@ func (s *remoteObserverExtension) Start(ctx context.Context, host component.Host } mux := http.NewServeMux() mux.Handle("/", http.FileServer(http.FS(htmlContent))) - s.server, err = s.config.ToServer(ctx, host, s.settings.TelemetrySettings, mux) + s.server, err = s.config.ToServer(ctx, host.GetExtensions(), s.settings.TelemetrySettings, mux) if err != nil { return err } diff --git a/extension/solarwindsapmsettingsextension/extension.go b/extension/solarwindsapmsettingsextension/extension.go index 9428ca6f7adaa..71576f9cd7182 100644 --- a/extension/solarwindsapmsettingsextension/extension.go +++ b/extension/solarwindsapmsettingsextension/extension.go @@ -76,7 +76,7 @@ func (extension *solarwindsapmSettingsExtension) Start(_ context.Context, host c } httpClientConfig := confighttp.NewDefaultClientConfig() httpClientConfig.DisableKeepAlives = true - extension.client, err = httpClientConfig.ToClient(ctx, host, extension.telemetrySettings) + extension.client, err = httpClientConfig.ToClient(ctx, host.GetExtensions(), extension.telemetrySettings) if err != nil { return err } diff --git a/extension/solarwindsapmsettingsextension/extension_test.go b/extension/solarwindsapmsettingsextension/extension_test.go index 199a30109eefd..7449326ed0c4e 100644 --- a/extension/solarwindsapmsettingsextension/extension_test.go +++ b/extension/solarwindsapmsettingsextension/extension_test.go @@ -65,7 +65,7 @@ func newNopSettings() extension.Settings { func createAnExtension(t *testing.T, c *Config) extension.Extension { ex, err := newSolarwindsApmSettingsExtension(c, newNopSettings()) require.NoError(t, err) - require.NoError(t, ex.Start(t.Context(), nil)) + require.NoError(t, ex.Start(t.Context(), componenttest.NewNopHost())) return ex } diff --git a/extension/sumologicextension/extension.go b/extension/sumologicextension/extension.go index fd5870a1c2d5c..8649011131f02 100644 --- a/extension/sumologicextension/extension.go +++ b/extension/sumologicextension/extension.go @@ -334,7 +334,7 @@ func (se *SumologicExtension) getHTTPClient( ) (*http.Client, error) { httpClient, err := httpClientSettings.ToClient( ctx, - se.host, + se.host.GetExtensions(), componenttest.NewNopTelemetrySettings(), ) if err != nil { diff --git a/extension/sumologicextension/extension_test.go b/extension/sumologicextension/extension_test.go index eb6e86f9114ce..4c245210b543d 100644 --- a/extension/sumologicextension/extension_test.go +++ b/extension/sumologicextension/extension_test.go @@ -1605,6 +1605,8 @@ func TestUpdateMetadataRequestPayload(t *testing.T) { se, err := newSumologicExtension(cfg, zap.NewNop(), component.NewID(metadata.Type), "1.0.0") require.NoError(t, err) + se.host = componenttest.NewNopHost() + httpClient, err := se.getHTTPClient(t.Context(), se.conf.ClientConfig, api.OpenRegisterResponsePayload{}) require.NoError(t, err) diff --git a/internal/aws/ecsutil/client.go b/internal/aws/ecsutil/client.go index 8fac85b16fda2..5502537123bac 100644 --- a/internal/aws/ecsutil/client.go +++ b/internal/aws/ecsutil/client.go @@ -62,7 +62,7 @@ func defaultClient( host component.Host, settings component.TelemetrySettings, ) (*clientImpl, error) { - client, err := clientSettings.ToClient(ctx, host, settings) + client, err := clientSettings.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, err } diff --git a/internal/healthcheck/internal/grpc/server.go b/internal/healthcheck/internal/grpc/server.go index 4671e1021bf2a..670ca061bec9f 100644 --- a/internal/healthcheck/internal/grpc/server.go +++ b/internal/healthcheck/internal/grpc/server.go @@ -50,7 +50,7 @@ func NewServer( // Start implements the component.Component interface. func (s *Server) Start(ctx context.Context, host component.Host) error { var err error - s.grpcServer, err = s.config.ToServer(ctx, host, s.telemetry) + s.grpcServer, err = s.config.ToServer(ctx, host.GetExtensions(), s.telemetry) if err != nil { return err } diff --git a/internal/healthcheck/internal/http/server.go b/internal/healthcheck/internal/http/server.go index 60c86376a40b2..138d8b48d2f55 100644 --- a/internal/healthcheck/internal/http/server.go +++ b/internal/healthcheck/internal/http/server.go @@ -86,7 +86,7 @@ func (s *Server) Start(ctx context.Context, host component.Host) error { var err error s.startTimestamp = time.Now() - s.httpServer, err = s.httpConfig.ToServer(ctx, host, s.telemetry, s.mux) + s.httpServer, err = s.httpConfig.ToServer(ctx, host.GetExtensions(), s.telemetry, s.mux) if err != nil { return err } diff --git a/pkg/stanza/adapter/receiver_test.go b/pkg/stanza/adapter/receiver_test.go index 496385821e47a..8d5db4d99e777 100644 --- a/pkg/stanza/adapter/receiver_test.go +++ b/pkg/stanza/adapter/receiver_test.go @@ -241,7 +241,7 @@ func benchmarkReceiver(b *testing.B, logsPerIteration int, batchingInput, batchi rcv.set = set rcv.emitter = emitter - require.NoError(b, rcv.Start(b.Context(), nil)) + require.NoError(b, rcv.Start(b.Context(), componenttest.NewNopHost())) for b.Loop() { nextIteration <- struct{}{} diff --git a/processor/cumulativetodeltaprocessor/processor_test.go b/processor/cumulativetodeltaprocessor/processor_test.go index 7e796b38ca726..1258c33e68946 100644 --- a/processor/cumulativetodeltaprocessor/processor_test.go +++ b/processor/cumulativetodeltaprocessor/processor_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" @@ -883,7 +884,7 @@ func TestCumulativeToDeltaProcessor(t *testing.T) { caps := mgp.Capabilities() assert.True(t, caps.MutatesData) ctx := t.Context() - require.NoError(t, mgp.Start(ctx, nil)) + require.NoError(t, mgp.Start(ctx, componenttest.NewNopHost())) cErr := mgp.ConsumeMetrics(t.Context(), test.inMetrics) assert.NoError(t, cErr) diff --git a/processor/deltatocumulativeprocessor/stale_test.go b/processor/deltatocumulativeprocessor/stale_test.go index f071e3da13850..cc4b56c4371b6 100644 --- a/processor/deltatocumulativeprocessor/stale_test.go +++ b/processor/deltatocumulativeprocessor/stale_test.go @@ -13,6 +13,7 @@ import ( "time" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" ) @@ -22,7 +23,7 @@ func TestStaleness(t *testing.T) { ctx := context.Background() iface, _ := setup(t, &Config{MaxStale: 5 * time.Minute, MaxStreams: 50}, &countingSink{}) proc := iface.(*deltaToCumulativeProcessor) - err := proc.Start(ctx, nil) + err := proc.Start(ctx, componenttest.NewNopHost()) time.Sleep(1 * time.Second) // ticker startup require.NoError(t, err) defer proc.Shutdown(ctx) diff --git a/processor/deltatorateprocessor/processor_test.go b/processor/deltatorateprocessor/processor_test.go index 95f4371aeb131..e40150aac0763 100644 --- a/processor/deltatorateprocessor/processor_test.go +++ b/processor/deltatorateprocessor/processor_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" @@ -130,7 +131,7 @@ func TestCumulativeToDeltaProcessor(t *testing.T) { caps := mgp.Capabilities() assert.True(t, caps.MutatesData) ctx := t.Context() - require.NoError(t, mgp.Start(ctx, nil)) + require.NoError(t, mgp.Start(ctx, componenttest.NewNopHost())) cErr := mgp.ConsumeMetrics(t.Context(), test.inMetrics) assert.NoError(t, cErr) diff --git a/processor/filterprocessor/logs_test.go b/processor/filterprocessor/logs_test.go index 3c14719ecbaa9..c2ba2d4cd53e9 100644 --- a/processor/filterprocessor/logs_test.go +++ b/processor/filterprocessor/logs_test.go @@ -596,7 +596,7 @@ func TestFilterLogProcessor(t *testing.T) { caps := flp.Capabilities() assert.True(t, caps.MutatesData) ctx := t.Context() - assert.NoError(t, flp.Start(ctx, nil)) + assert.NoError(t, flp.Start(ctx, componenttest.NewNopHost())) cErr := flp.ConsumeLogs(t.Context(), test.inLogs) assert.NoError(t, cErr) diff --git a/processor/filterprocessor/metrics_test.go b/processor/filterprocessor/metrics_test.go index e23280f666e9e..f2994c691d673 100644 --- a/processor/filterprocessor/metrics_test.go +++ b/processor/filterprocessor/metrics_test.go @@ -345,7 +345,7 @@ func TestFilterMetricProcessor(t *testing.T) { caps := fmp.Capabilities() assert.True(t, caps.MutatesData) ctx := t.Context() - assert.NoError(t, fmp.Start(ctx, nil)) + assert.NoError(t, fmp.Start(ctx, componenttest.NewNopHost())) cErr := fmp.ConsumeMetrics(t.Context(), test.inMetrics) assert.NoError(t, cErr) diff --git a/processor/filterprocessor/traces_test.go b/processor/filterprocessor/traces_test.go index fb4bd2cba63ee..381f9a96b534c 100644 --- a/processor/filterprocessor/traces_test.go +++ b/processor/filterprocessor/traces_test.go @@ -146,7 +146,7 @@ func TestFilterTraceProcessor(t *testing.T) { caps := fmp.Capabilities() require.True(t, caps.MutatesData) - require.NoError(t, fmp.Start(ctx, nil)) + require.NoError(t, fmp.Start(ctx, componenttest.NewNopHost())) cErr := fmp.ConsumeTraces(ctx, test.inTraces) require.NoError(t, cErr) diff --git a/processor/groupbytraceprocessor/processor_test.go b/processor/groupbytraceprocessor/processor_test.go index 24a4ba81c822a..366bd61ff94cc 100644 --- a/processor/groupbytraceprocessor/processor_test.go +++ b/processor/groupbytraceprocessor/processor_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" @@ -57,7 +58,7 @@ func TestTraceIsDispatchedAfterDuration(t *testing.T) { } p.st = st ctx := t.Context() - assert.NoError(t, p.Start(ctx, nil)) + assert.NoError(t, p.Start(ctx, componenttest.NewNopHost())) defer func() { assert.NoError(t, p.Shutdown(ctx)) }() @@ -102,7 +103,7 @@ func TestInternalCacheLimit(t *testing.T) { st := newMemoryStorage(p.telemetryBuilder) p.st = st ctx := t.Context() - assert.NoError(t, p.Start(ctx, nil)) + assert.NoError(t, p.Start(ctx, componenttest.NewNopHost())) defer func() { assert.NoError(t, p.Shutdown(ctx)) }() @@ -202,7 +203,7 @@ func TestTraceDisappearedFromStorageBeforeReleasing(t *testing.T) { batch := simpleTracesWithID(traceID) ctx := t.Context() - assert.NoError(t, p.Start(ctx, nil)) + assert.NoError(t, p.Start(ctx, componenttest.NewNopHost())) defer func() { assert.NoError(t, p.Shutdown(ctx)) }() @@ -240,7 +241,7 @@ func TestTraceErrorFromStorageWhileReleasing(t *testing.T) { batch := simpleTracesWithID(traceID) ctx := t.Context() - assert.NoError(t, p.Start(ctx, nil)) + assert.NoError(t, p.Start(ctx, componenttest.NewNopHost())) defer func() { assert.NoError(t, p.Shutdown(ctx)) }() @@ -318,7 +319,7 @@ func TestAddSpansToExistingTrace(t *testing.T) { p.st = st ctx := t.Context() - assert.NoError(t, p.Start(ctx, nil)) + assert.NoError(t, p.Start(ctx, componenttest.NewNopHost())) defer func() { assert.NoError(t, p.Shutdown(ctx)) }() @@ -464,7 +465,7 @@ func TestTracesAreDispatchedInIndividualBatches(t *testing.T) { st := newMemoryStorage(p.telemetryBuilder) p.st = st ctx := t.Context() - assert.NoError(t, p.Start(ctx, nil)) + assert.NoError(t, p.Start(ctx, componenttest.NewNopHost())) defer func() { assert.NoError(t, p.Shutdown(ctx)) }() @@ -571,7 +572,7 @@ func BenchmarkConsumeTracesCompleteOnFirstBatch(b *testing.B) { st := newMemoryStorage(p.telemetryBuilder) p.st = st ctx := b.Context() - require.NoError(b, p.Start(ctx, nil)) + require.NoError(b, p.Start(ctx, componenttest.NewNopHost())) defer func() { assert.NoError(b, p.Shutdown(ctx)) }() diff --git a/processor/isolationforestprocessor/processor_test.go b/processor/isolationforestprocessor/processor_test.go index f45b7bd9db20d..649a1a400b456 100644 --- a/processor/isolationforestprocessor/processor_test.go +++ b/processor/isolationforestprocessor/processor_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" @@ -1052,7 +1053,7 @@ func Test_Start_Shutdown_Lifecycle(t *testing.T) { require.NoError(t, err) // Test Start - err = p.Start(t.Context(), nil) + err = p.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) // Give some time for background goroutine to start @@ -1071,7 +1072,7 @@ func Test_modelUpdateLoop_Coverage(t *testing.T) { p, err := newIsolationForestProcessor(cfg, logger) require.NoError(t, err) - err = p.Start(t.Context(), nil) + err = p.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) // Wait for at least one update cycle diff --git a/processor/logstransformprocessor/processor_test.go b/processor/logstransformprocessor/processor_test.go index 95daa0afce704..58113b49c352d 100644 --- a/processor/logstransformprocessor/processor_test.go +++ b/processor/logstransformprocessor/processor_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" @@ -147,7 +148,7 @@ func TestLogsTransformProcessor(t *testing.T) { require.NoError(t, err) assert.True(t, ltp.Capabilities().MutatesData) - err = ltp.Start(t.Context(), nil) + err = ltp.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) sourceLogData := generateLogData(tt.sourceMessages) @@ -265,7 +266,7 @@ func TestProcessorShutdownWithSlowOperator(t *testing.T) { require.NoError(t, err) assert.True(t, ltp.Capabilities().MutatesData) - err = ltp.Start(t.Context(), nil) + err = ltp.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) testLog := plog.NewLogs() diff --git a/processor/remotetapprocessor/processor.go b/processor/remotetapprocessor/processor.go index 398a224ac57c3..330a2b24b8db7 100644 --- a/processor/remotetapprocessor/processor.go +++ b/processor/remotetapprocessor/processor.go @@ -54,7 +54,7 @@ func (w *wsprocessor) Start(ctx context.Context, host component.Host) error { if err != nil { return fmt.Errorf("failed to bind to address %s: %w", w.config.Endpoint, err) } - w.server, err = w.config.ToServer(ctx, host, w.telemetrySettings, websocket.Server{Handler: w.handleConn}) + w.server, err = w.config.ToServer(ctx, host.GetExtensions(), w.telemetrySettings, websocket.Server{Handler: w.handleConn}) if err != nil { return err } diff --git a/processor/resourcedetectionprocessor/resourcedetection_processor.go b/processor/resourcedetectionprocessor/resourcedetection_processor.go index 40d2939ad3541..fb672cfc9959b 100644 --- a/processor/resourcedetectionprocessor/resourcedetection_processor.go +++ b/processor/resourcedetectionprocessor/resourcedetection_processor.go @@ -28,7 +28,7 @@ type resourceDetectionProcessor struct { // Start is invoked during service startup. func (rdp *resourceDetectionProcessor) Start(ctx context.Context, host component.Host) error { - client, _ := rdp.httpClientSettings.ToClient(ctx, host, rdp.telemetrySettings) + client, _ := rdp.httpClientSettings.ToClient(ctx, host.GetExtensions(), rdp.telemetrySettings) ctx = internal.ContextWithClient(ctx, client) var err error rdp.resource, rdp.schemaURL, err = rdp.provider.Get(ctx, client) diff --git a/processor/schemaprocessor/processor.go b/processor/schemaprocessor/processor.go index fb90375055bc2..0574c844351d6 100644 --- a/processor/schemaprocessor/processor.go +++ b/processor/schemaprocessor/processor.go @@ -177,7 +177,7 @@ func (t schemaProcessor) processTraces(ctx context.Context, td ptrace.Traces) (p // start will add HTTP provider to the manager and prefetch schemas func (t *schemaProcessor) start(ctx context.Context, host component.Host) error { - client, err := t.config.ToClient(ctx, host, t.telemetry) + client, err := t.config.ToClient(ctx, host.GetExtensions(), t.telemetry) if err != nil { return err } diff --git a/processor/schemaprocessor/processor_test.go b/processor/schemaprocessor/processor_test.go index 59c7efa5b1ce1..6e079c516ef62 100644 --- a/processor/schemaprocessor/processor_test.go +++ b/processor/schemaprocessor/processor_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" @@ -55,7 +56,7 @@ func TestSchemaProcessorStart(t *testing.T) { t.Parallel() trans := newTestSchemaProcessor(t, "", "1.9.0") - assert.NoError(t, trans.start(t.Context(), nil)) + assert.NoError(t, trans.start(t.Context(), componenttest.NewNopHost())) } func TestSchemaProcessorProcessing(t *testing.T) { diff --git a/receiver/apachereceiver/scraper.go b/receiver/apachereceiver/scraper.go index 2bdc1d1c3c283..d5d53881dd757 100644 --- a/receiver/apachereceiver/scraper.go +++ b/receiver/apachereceiver/scraper.go @@ -49,7 +49,7 @@ func newApacheScraper( } func (r *apacheScraper) start(ctx context.Context, host component.Host) error { - httpClient, err := r.cfg.ToClient(ctx, host, r.settings) + httpClient, err := r.cfg.ToClient(ctx, host.GetExtensions(), r.settings) if err != nil { return err } diff --git a/receiver/apachesparkreceiver/client.go b/receiver/apachesparkreceiver/client.go index 01f965609a6b6..8298fbd6b26d7 100644 --- a/receiver/apachesparkreceiver/client.go +++ b/receiver/apachesparkreceiver/client.go @@ -41,7 +41,7 @@ type apacheSparkClient struct { // newApacheSparkClient creates a new client to make requests for the Apache Spark receiver. func newApacheSparkClient(ctx context.Context, cfg *Config, host component.Host, settings component.TelemetrySettings) (client, error) { - client, err := cfg.ToClient(ctx, host, settings) + client, err := cfg.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go index 0e5b911de441b..6eba2fdf3c1f0 100644 --- a/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go +++ b/receiver/awscontainerinsightreceiver/internal/ecsInfo/ecsinfo.go @@ -85,7 +85,7 @@ func NewECSInfo(refreshInterval time.Duration, hostIPProvider hostIPProvider, ho } ctx, cancel := context.WithCancel(context.Background()) - client, err := setting.ToClient(ctx, host, settings) + client, err := setting.ToClient(ctx, host.GetExtensions(), settings) if err != nil { settings.Logger.Warn("Failed to create a http client for ECS info!") cancel() diff --git a/receiver/awscontainerinsightreceiver/receiver_test.go b/receiver/awscontainerinsightreceiver/receiver_test.go index ecfc286a2238a..94c51be5c155c 100644 --- a/receiver/awscontainerinsightreceiver/receiver_test.go +++ b/receiver/awscontainerinsightreceiver/receiver_test.go @@ -72,7 +72,7 @@ func TestCollectData(t *testing.T) { require.NotNil(t, metricsReceiver) r := metricsReceiver.(*awsContainerInsightReceiver) - _ = r.Start(t.Context(), nil) + _ = r.Start(t.Context(), componenttest.NewNopHost()) ctx := t.Context() r.k8sapiserver = &mockK8sAPIServer{} r.cadvisor = &mockCadvisor{} @@ -98,7 +98,7 @@ func TestCollectDataWithErrConsumer(t *testing.T) { require.NotNil(t, metricsReceiver) r := metricsReceiver.(*awsContainerInsightReceiver) - _ = r.Start(t.Context(), nil) + _ = r.Start(t.Context(), componenttest.NewNopHost()) r.cadvisor = &mockCadvisor{} r.k8sapiserver = &mockK8sAPIServer{} ctx := t.Context() @@ -120,7 +120,7 @@ func TestCollectDataWithECS(t *testing.T) { require.NotNil(t, metricsReceiver) r := metricsReceiver.(*awsContainerInsightReceiver) - _ = r.Start(t.Context(), nil) + _ = r.Start(t.Context(), componenttest.NewNopHost()) ctx := t.Context() r.cadvisor = &mockCadvisor{} diff --git a/receiver/awsfirehosereceiver/receiver.go b/receiver/awsfirehosereceiver/receiver.go index a9baf5c8ca08f..03c29f4df0de1 100644 --- a/receiver/awsfirehosereceiver/receiver.go +++ b/receiver/awsfirehosereceiver/receiver.go @@ -122,7 +122,7 @@ func (fmr *firehoseReceiver) Start(ctx context.Context, host component.Host) err } var err error - fmr.server, err = fmr.config.ToServer(ctx, host, fmr.settings.TelemetrySettings, fmr) + fmr.server, err = fmr.config.ToServer(ctx, host.GetExtensions(), fmr.settings.TelemetrySettings, fmr) if err != nil { return fmt.Errorf("failed to initialize HTTP server: %w", err) } diff --git a/receiver/bigipreceiver/client.go b/receiver/bigipreceiver/client.go index aa97844d48e55..1cbc007397fcd 100644 --- a/receiver/bigipreceiver/client.go +++ b/receiver/bigipreceiver/client.go @@ -76,7 +76,7 @@ var _ client = (*bigipClient)(nil) // newClient creates an initialized client (but with no token) func newClient(ctx context.Context, cfg *Config, host component.Host, settings component.TelemetrySettings, logger *zap.Logger) (client, error) { - httpClient, err := cfg.ToClient(ctx, host, settings) + httpClient, err := cfg.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/receiver/cloudfoundryreceiver/stream.go b/receiver/cloudfoundryreceiver/stream.go index c253fa45b02dc..11fe4995002ac 100644 --- a/receiver/cloudfoundryreceiver/stream.go +++ b/receiver/cloudfoundryreceiver/stream.go @@ -27,7 +27,7 @@ func newEnvelopeStreamFactory( httpConfig confighttp.ClientConfig, host component.Host, ) (*envelopeStreamFactory, error) { - httpClient, err := httpConfig.ToClient(ctx, host, settings) + httpClient, err := httpConfig.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, fmt.Errorf("creating HTTP client for Cloud Foundry RLP Gateway: %w", err) } diff --git a/receiver/collectdreceiver/receiver.go b/receiver/collectdreceiver/receiver.go index 58bb2d05f399c..7321eaf4dffd4 100644 --- a/receiver/collectdreceiver/receiver.go +++ b/receiver/collectdreceiver/receiver.go @@ -58,7 +58,7 @@ func newCollectdReceiver( // Start starts an HTTP server that can process CollectD JSON requests. func (cdr *collectdReceiver) Start(ctx context.Context, host component.Host) error { var err error - cdr.server, err = cdr.config.ToServer(ctx, host, cdr.createSettings.TelemetrySettings, cdr) + cdr.server, err = cdr.config.ToServer(ctx, host.GetExtensions(), cdr.createSettings.TelemetrySettings, cdr) if err != nil { return err } diff --git a/receiver/couchdbreceiver/client.go b/receiver/couchdbreceiver/client.go index 9f02bc4228b65..338dd930339e1 100644 --- a/receiver/couchdbreceiver/client.go +++ b/receiver/couchdbreceiver/client.go @@ -31,7 +31,7 @@ type couchDBClient struct { // newCouchDBClient creates a new client to make requests for the CouchDB receiver. func newCouchDBClient(ctx context.Context, cfg *Config, host component.Host, settings component.TelemetrySettings) (client, error) { - client, err := cfg.ToClient(ctx, host, settings) + client, err := cfg.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/receiver/datadogreceiver/receiver.go b/receiver/datadogreceiver/receiver.go index f2b80d8be3d61..df4c6086a4a16 100644 --- a/receiver/datadogreceiver/receiver.go +++ b/receiver/datadogreceiver/receiver.go @@ -221,7 +221,7 @@ func (ddr *datadogReceiver) Start(ctx context.Context, host component.Host) erro var err error ddr.server, err = ddr.config.ToServer( ctx, - host, + host.GetExtensions(), ddr.params.TelemetrySettings, ddmux, ) diff --git a/receiver/elasticsearchreceiver/client.go b/receiver/elasticsearchreceiver/client.go index 7b8b9fd2a5e28..da0ceadd90ed1 100644 --- a/receiver/elasticsearchreceiver/client.go +++ b/receiver/elasticsearchreceiver/client.go @@ -49,7 +49,7 @@ type defaultElasticsearchClient struct { var _ elasticsearchClient = (*defaultElasticsearchClient)(nil) func newElasticsearchClient(ctx context.Context, settings component.TelemetrySettings, c Config, h component.Host) (*defaultElasticsearchClient, error) { - client, err := c.ToClient(ctx, h, settings) + client, err := c.ToClient(ctx, h.GetExtensions(), settings) if err != nil { return nil, err } diff --git a/receiver/envoyalsreceiver/als.go b/receiver/envoyalsreceiver/als.go index f9a32e87a3caf..d9ef5e07de99e 100644 --- a/receiver/envoyalsreceiver/als.go +++ b/receiver/envoyalsreceiver/als.go @@ -31,7 +31,7 @@ type alsReceiver struct { func (r *alsReceiver) Start(ctx context.Context, host component.Host) error { var err error - r.serverGRPC, err = r.conf.ToServer(ctx, host, r.settings.TelemetrySettings) + r.serverGRPC, err = r.conf.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings) if err != nil { return fmt.Errorf("failed create grpc server error: %w", err) } diff --git a/receiver/expvarreceiver/scraper.go b/receiver/expvarreceiver/scraper.go index c868796a7fd4c..4acfe13e66e71 100644 --- a/receiver/expvarreceiver/scraper.go +++ b/receiver/expvarreceiver/scraper.go @@ -42,7 +42,7 @@ func newExpVarScraper(cfg *Config, set receiver.Settings) *expVarScraper { } func (e *expVarScraper) start(ctx context.Context, host component.Host) error { - client, err := e.cfg.ToClient(ctx, host, e.set.TelemetrySettings) + client, err := e.cfg.ToClient(ctx, host.GetExtensions(), e.set.TelemetrySettings) if err != nil { return err } diff --git a/receiver/faroreceiver/receiver.go b/receiver/faroreceiver/receiver.go index 52d69b61f59bb..e65f302a2fb51 100644 --- a/receiver/faroreceiver/receiver.go +++ b/receiver/faroreceiver/receiver.go @@ -111,7 +111,7 @@ func (r *faroReceiver) startHTTPServer(ctx context.Context, host component.Host) var err error if r.serverHTTP, err = r.cfg.ToServer( ctx, - host, + host.GetExtensions(), r.settings.TelemetrySettings, httpMux, confighttp.WithErrorHandler(r.errorHandler), diff --git a/receiver/flinkmetricsreceiver/client.go b/receiver/flinkmetricsreceiver/client.go index a2d8b51659cef..2fbd24863913e 100644 --- a/receiver/flinkmetricsreceiver/client.go +++ b/receiver/flinkmetricsreceiver/client.go @@ -56,7 +56,7 @@ type flinkClient struct { } func newClient(ctx context.Context, cfg *Config, host component.Host, settings component.TelemetrySettings, logger *zap.Logger) (client, error) { - httpClient, err := cfg.ToClient(ctx, host, settings) + httpClient, err := cfg.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/receiver/fluentforwardreceiver/receiver_test.go b/receiver/fluentforwardreceiver/receiver_test.go index fc4d02144faa6..b28a895d73093 100644 --- a/receiver/fluentforwardreceiver/receiver_test.go +++ b/receiver/fluentforwardreceiver/receiver_test.go @@ -16,6 +16,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tinylib/msgp/msgp" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" @@ -43,7 +44,7 @@ func setupServer(t *testing.T) (func() net.Conn, *consumertest.LogsSink, *observ receiver, err := newFluentReceiver(set, conf, next) require.NoError(t, err) - require.NoError(t, receiver.Start(ctx, nil)) + require.NoError(t, receiver.Start(ctx, componenttest.NewNopHost())) connect := func() net.Conn { conn, err := net.Dial("tcp", receiver.(*fluentReceiver).listener.Addr().String()) @@ -339,7 +340,7 @@ func TestUnixEndpoint(t *testing.T) { receiver, err := newFluentReceiver(receivertest.NewNopSettings(metadata.Type), conf, next) require.NoError(t, err) - require.NoError(t, receiver.Start(ctx, nil)) + require.NoError(t, receiver.Start(ctx, componenttest.NewNopHost())) defer func() { require.NoError(t, receiver.Shutdown(ctx)) }() conn, err := net.Dial("unix", receiver.(*fluentReceiver).listener.Addr().String()) diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go index 125254021d9ca..859cd4db7e976 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go @@ -34,7 +34,7 @@ type githubScraper struct { func (ghs *githubScraper) start(ctx context.Context, host component.Host) (err error) { ghs.logger.Sugar().Info("starting the GitHub scraper") - ghs.client, err = ghs.cfg.ToClient(ctx, host, ghs.settings) + ghs.client, err = ghs.cfg.ToClient(ctx, host.GetExtensions(), ghs.settings) return err } diff --git a/receiver/githubreceiver/trace_receiver.go b/receiver/githubreceiver/trace_receiver.go index 41db817a55d47..d958a3b488b22 100644 --- a/receiver/githubreceiver/trace_receiver.go +++ b/receiver/githubreceiver/trace_receiver.go @@ -99,7 +99,7 @@ func (gtr *githubTracesReceiver) Start(ctx context.Context, host component.Host) router.HandleFunc(gtr.cfg.WebHook.Path, gtr.handleReq) // webhook server standup and configuration - gtr.server, err = gtr.cfg.WebHook.ToServer(ctx, host, gtr.settings.TelemetrySettings, router) + gtr.server, err = gtr.cfg.WebHook.ToServer(ctx, host.GetExtensions(), gtr.settings.TelemetrySettings, router) if err != nil { return err } diff --git a/receiver/gitlabreceiver/traces_receiver.go b/receiver/gitlabreceiver/traces_receiver.go index 19af2b2a91ef9..753f8f0b59461 100644 --- a/receiver/gitlabreceiver/traces_receiver.go +++ b/receiver/gitlabreceiver/traces_receiver.go @@ -127,7 +127,7 @@ func (gtr *gitlabTracesReceiver) Start(ctx context.Context, host component.Host) router.HandleFunc(gtr.cfg.WebHook.Path, gtr.handleWebhook) // webhook server standup and configuration - gtr.server, err = gtr.cfg.WebHook.ToServer(ctx, host, gtr.settings.TelemetrySettings, router) + gtr.server, err = gtr.cfg.WebHook.ToServer(ctx, host.GetExtensions(), gtr.settings.TelemetrySettings, router) if err != nil { return err } diff --git a/receiver/googlecloudpubsubpushreceiver/receiver.go b/receiver/googlecloudpubsubpushreceiver/receiver.go index 89812975adbdd..d7d63d9a672bb 100644 --- a/receiver/googlecloudpubsubpushreceiver/receiver.go +++ b/receiver/googlecloudpubsubpushreceiver/receiver.go @@ -159,7 +159,7 @@ func (p *pubSubPushReceiver) Start(ctx context.Context, host component.Host) err p.settings.Logger, ) - server, err := p.cfg.ToServer(ctx, host, p.settings.TelemetrySettings, mux) + server, err := p.cfg.ToServer(ctx, host.GetExtensions(), p.settings.TelemetrySettings, mux) if err != nil { return err } diff --git a/receiver/haproxyreceiver/scraper.go b/receiver/haproxyreceiver/scraper.go index 74bd2d506f269..b5c47e08e745a 100644 --- a/receiver/haproxyreceiver/scraper.go +++ b/receiver/haproxyreceiver/scraper.go @@ -317,7 +317,7 @@ func (*haproxyScraper) readStats(buf []byte) ([]map[string]string, error) { func (s *haproxyScraper) start(ctx context.Context, host component.Host) error { var err error - s.httpClient, err = s.cfg.ToClient(ctx, host, s.telemetrySettings) + s.httpClient, err = s.cfg.ToClient(ctx, host.GetExtensions(), s.telemetrySettings) return err } diff --git a/receiver/httpcheckreceiver/scraper.go b/receiver/httpcheckreceiver/scraper.go index 59229db133e74..17da7cb28ed2a 100644 --- a/receiver/httpcheckreceiver/scraper.go +++ b/receiver/httpcheckreceiver/scraper.go @@ -218,7 +218,7 @@ func (h *httpcheckScraper) start(ctx context.Context, host component.Host) (err // Process each endpoint in the unified list for _, endpoint := range allEndpoints { - client, clientErr := target.ToClient(ctx, host, h.settings) + client, clientErr := target.ToClient(ctx, host.GetExtensions(), h.settings) if clientErr != nil { h.settings.Logger.Error("failed to initialize HTTP client", zap.String("endpoint", endpoint), zap.Error(clientErr)) err = multierr.Append(err, clientErr) diff --git a/receiver/influxdbreceiver/receiver.go b/receiver/influxdbreceiver/receiver.go index eb5a87102fd14..b6068682960fe 100644 --- a/receiver/influxdbreceiver/receiver.go +++ b/receiver/influxdbreceiver/receiver.go @@ -77,7 +77,7 @@ func (r *metricsReceiver) Start(ctx context.Context, host component.Host) error router.HandleFunc("/ping", r.handlePing) r.wg.Add(1) - r.server, err = r.httpServerSettings.ToServer(ctx, host, r.settings, router) + r.server, err = r.httpServerSettings.ToServer(ctx, host.GetExtensions(), r.settings, router) if err != nil { return err } diff --git a/receiver/jaegerreceiver/trace_receiver.go b/receiver/jaegerreceiver/trace_receiver.go index e1f317a901439..990679ba1c236 100644 --- a/receiver/jaegerreceiver/trace_receiver.go +++ b/receiver/jaegerreceiver/trace_receiver.go @@ -332,7 +332,7 @@ func (jr *jReceiver) startCollector(ctx context.Context, host component.Host) er nr := mux.NewRouter() nr.HandleFunc("/api/traces", jr.HandleThriftHTTPBatch).Methods(http.MethodPost) - jr.collectorServer, err = httpConfig.ToServer(ctx, host, jr.settings.TelemetrySettings, nr) + jr.collectorServer, err = httpConfig.ToServer(ctx, host.GetExtensions(), jr.settings.TelemetrySettings, nr) if err != nil { return err } @@ -351,7 +351,7 @@ func (jr *jReceiver) startCollector(ctx context.Context, host component.Host) er if jr.config.GRPC.HasValue() { grpcConfig := jr.config.GRPC.Get() var err error - jr.grpc, err = grpcConfig.ToServer(ctx, host, jr.settings.TelemetrySettings) + jr.grpc, err = grpcConfig.ToServer(ctx, host.GetExtensions(), jr.settings.TelemetrySettings) if err != nil { return fmt.Errorf("failed to build the options for the Jaeger gRPC Collector: %w", err) } diff --git a/receiver/kafkametricsreceiver/broker_scraper_test.go b/receiver/kafkametricsreceiver/broker_scraper_test.go index aa5319cfde470..6769fae523c11 100644 --- a/receiver/kafkametricsreceiver/broker_scraper_test.go +++ b/receiver/kafkametricsreceiver/broker_scraper_test.go @@ -60,7 +60,7 @@ func TestBrokerScraperStart(t *testing.T) { bs, err := createBrokerScraper(t.Context(), Config{}, receivertest.NewNopSettings(metadata.Type)) assert.NoError(t, err) assert.NotNil(t, bs) - assert.NoError(t, bs.Start(t.Context(), nil)) + assert.NoError(t, bs.Start(t.Context(), componenttest.NewNopHost())) } func TestBrokerScraper_scrape_handles_client_error(t *testing.T) { diff --git a/receiver/kafkametricsreceiver/consumer_scraper_test.go b/receiver/kafkametricsreceiver/consumer_scraper_test.go index 6568ecff3df8c..b48bfd3e23a5f 100644 --- a/receiver/kafkametricsreceiver/consumer_scraper_test.go +++ b/receiver/kafkametricsreceiver/consumer_scraper_test.go @@ -98,7 +98,7 @@ func TestConsumerScraperStart(t *testing.T) { cs, err := createConsumerScraper(t.Context(), Config{}, receivertest.NewNopSettings(metadata.Type)) assert.NoError(t, err) assert.NotNil(t, cs) - err = cs.Start(t.Context(), nil) + err = cs.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) } diff --git a/receiver/kafkametricsreceiver/topic_scraper_test.go b/receiver/kafkametricsreceiver/topic_scraper_test.go index 76d5eccbe9eba..c93ebe29d1f05 100644 --- a/receiver/kafkametricsreceiver/topic_scraper_test.go +++ b/receiver/kafkametricsreceiver/topic_scraper_test.go @@ -83,7 +83,7 @@ func TestTopicScraper_startScraperCreatesClient(t *testing.T) { ms, err := createTopicsScraper(t.Context(), Config{}, receivertest.NewNopSettings(metadata.Type)) assert.NotNil(t, ms) assert.NoError(t, err) - err = ms.Start(t.Context(), nil) + err = ms.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) } diff --git a/receiver/kubeletstatsreceiver/scraper_test.go b/receiver/kubeletstatsreceiver/scraper_test.go index fb7c5181cc6a9..548ededc844ab 100644 --- a/receiver/kubeletstatsreceiver/scraper_test.go +++ b/receiver/kubeletstatsreceiver/scraper_test.go @@ -11,6 +11,7 @@ import ( "time" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver/receivertest" "go.uber.org/zap" @@ -159,7 +160,7 @@ func TestScraperWithCPUNodeUtilization(t *testing.T) { ) require.NoError(t, err) - err = r.Start(t.Context(), nil) + err = r.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) // we wait until the watcher starts @@ -238,7 +239,7 @@ func TestScraperWithMemoryNodeUtilization(t *testing.T) { ) require.NoError(t, err) - err = r.Start(t.Context(), nil) + err = r.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) // we wait until the watcher starts diff --git a/receiver/libhoneyreceiver/receiver.go b/receiver/libhoneyreceiver/receiver.go index 84164e3eb2c65..292a61012b304 100644 --- a/receiver/libhoneyreceiver/receiver.go +++ b/receiver/libhoneyreceiver/receiver.go @@ -86,7 +86,7 @@ func (r *libhoneyReceiver) startHTTPServer(ctx context.Context, host component.H } var err error - if r.server, err = httpCfg.ToServer(ctx, host, r.settings.TelemetrySettings, httpMux); err != nil { + if r.server, err = httpCfg.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings, httpMux); err != nil { return err } diff --git a/receiver/lokireceiver/loki.go b/receiver/lokireceiver/loki.go index 79495b241691a..251f71f43c530 100644 --- a/receiver/lokireceiver/loki.go +++ b/receiver/lokireceiver/loki.go @@ -95,7 +95,7 @@ func newLokiReceiver(conf *Config, nextConsumer consumer.Logs, settings receiver func (r *lokiReceiver) startProtocolsServers(ctx context.Context, host component.Host) error { var err error if r.conf.HTTP != nil { - r.serverHTTP, err = r.conf.HTTP.ToServer(ctx, host, r.settings.TelemetrySettings, r.httpMux, confighttp.WithDecoder("snappy", func(body io.ReadCloser) (io.ReadCloser, error) { return body, nil })) + r.serverHTTP, err = r.conf.HTTP.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings, r.httpMux, confighttp.WithDecoder("snappy", func(body io.ReadCloser) (io.ReadCloser, error) { return body, nil })) if err != nil { return fmt.Errorf("failed create http server error: %w", err) } @@ -106,7 +106,7 @@ func (r *lokiReceiver) startProtocolsServers(ctx context.Context, host component } if r.conf.GRPC != nil { - r.serverGRPC, err = r.conf.GRPC.ToServer(ctx, host, r.settings.TelemetrySettings) + r.serverGRPC, err = r.conf.GRPC.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings) if err != nil { return fmt.Errorf("failed create grpc server error: %w", err) } diff --git a/receiver/nginxreceiver/scraper.go b/receiver/nginxreceiver/scraper.go index ee3b198cd06e7..45339e5914cf1 100644 --- a/receiver/nginxreceiver/scraper.go +++ b/receiver/nginxreceiver/scraper.go @@ -37,7 +37,7 @@ func newNginxScraper( } func (r *nginxScraper) start(ctx context.Context, host component.Host) error { - httpClient, err := r.cfg.ToClient(ctx, host, r.settings) + httpClient, err := r.cfg.ToClient(ctx, host.GetExtensions(), r.settings) if err != nil { return err } diff --git a/receiver/nsxtreceiver/client.go b/receiver/nsxtreceiver/client.go index b0f7469a57e5d..878e5f87e5c66 100644 --- a/receiver/nsxtreceiver/client.go +++ b/receiver/nsxtreceiver/client.go @@ -39,7 +39,7 @@ type nsxClient struct { var errUnauthorized = errors.New("STATUS 403, unauthorized") func newClient(ctx context.Context, c *Config, settings component.TelemetrySettings, host component.Host, logger *zap.Logger) (*nsxClient, error) { - client, err := c.ToClient(ctx, host, settings) + client, err := c.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, err } diff --git a/receiver/otelarrowreceiver/otelarrow.go b/receiver/otelarrowreceiver/otelarrow.go index c1e5a40478bd5..312079068ca6c 100644 --- a/receiver/otelarrowreceiver/otelarrow.go +++ b/receiver/otelarrowreceiver/otelarrow.go @@ -123,7 +123,7 @@ func (r *otelArrowReceiver) startProtocolServers(ctx context.Context, host compo if r.netReporter != nil { serverOpts = append(serverOpts, configgrpc.WithGrpcServerOption(grpc.StatsHandler(r.netReporter.Handler()))) } - r.serverGRPC, err = r.cfg.GRPC.ToServer(ctx, host, r.settings.TelemetrySettings, serverOpts...) + r.serverGRPC, err = r.cfg.GRPC.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings, serverOpts...) if err != nil { return err } diff --git a/receiver/otlpjsonfilereceiver/file_test.go b/receiver/otlpjsonfilereceiver/file_test.go index 4451835095363..108585f0bb784 100644 --- a/receiver/otlpjsonfilereceiver/file_test.go +++ b/receiver/otlpjsonfilereceiver/file_test.go @@ -45,7 +45,7 @@ func TestFileProfilesReceiver(t *testing.T) { sink := new(consumertest.ProfilesSink) receiver, err := factory.(xreceiver.Factory).CreateProfiles(t.Context(), receivertest.NewNopSettings(metadata.Type), cfg, sink) assert.NoError(t, err) - err = receiver.Start(t.Context(), nil) + err = receiver.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) pd := testdata.GenerateProfiles(1) @@ -72,7 +72,7 @@ func TestFileTracesReceiver(t *testing.T) { sink := new(consumertest.TracesSink) receiver, err := factory.CreateTraces(t.Context(), receivertest.NewNopSettings(metadata.Type), cfg, sink) assert.NoError(t, err) - err = receiver.Start(t.Context(), nil) + err = receiver.Start(t.Context(), componenttest.NewNopHost()) require.NoError(t, err) td := testdata.GenerateTraces(1) @@ -102,7 +102,7 @@ func TestFileMetricsReceiver(t *testing.T) { sink := new(consumertest.MetricsSink) receiver, err := factory.CreateMetrics(t.Context(), receivertest.NewNopSettings(metadata.Type), cfg, sink) assert.NoError(t, err) - err = receiver.Start(t.Context(), nil) + err = receiver.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) md := testdata.GenerateMetrics(1) @@ -136,7 +136,7 @@ func TestFileMetricsReceiverWithReplay(t *testing.T) { sink := new(consumertest.MetricsSink) receiver, err := factory.CreateMetrics(t.Context(), receivertest.NewNopSettings(metadata.Type), cfg, sink) assert.NoError(t, err) - err = receiver.Start(t.Context(), nil) + err = receiver.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) md := testdata.GenerateMetrics(5) @@ -171,7 +171,7 @@ func TestFileLogsReceiver(t *testing.T) { sink := new(consumertest.LogsSink) receiver, err := factory.CreateLogs(t.Context(), receivertest.NewNopSettings(metadata.Type), cfg, sink) assert.NoError(t, err) - err = receiver.Start(t.Context(), nil) + err = receiver.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) ld := testdata.GenerateLogs(1) @@ -241,22 +241,22 @@ func TestFileMixedSignals(t *testing.T) { ms := new(consumertest.MetricsSink) mr, err := factory.CreateMetrics(t.Context(), cs, cfg, ms) assert.NoError(t, err) - err = mr.Start(t.Context(), nil) + err = mr.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) ts := new(consumertest.TracesSink) tr, err := factory.CreateTraces(t.Context(), cs, cfg, ts) assert.NoError(t, err) - err = tr.Start(t.Context(), nil) + err = tr.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) ls := new(consumertest.LogsSink) lr, err := factory.CreateLogs(t.Context(), cs, cfg, ls) assert.NoError(t, err) - err = lr.Start(t.Context(), nil) + err = lr.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) ps := new(consumertest.ProfilesSink) pr, err := factory.(xreceiver.Factory).CreateProfiles(t.Context(), cs, cfg, ps) assert.NoError(t, err) - err = pr.Start(t.Context(), nil) + err = pr.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) md := testdata.GenerateMetrics(5) @@ -314,7 +314,7 @@ func TestEmptyLine(t *testing.T) { ms := new(consumertest.MetricsSink) mr, err := NewFactory().CreateMetrics(t.Context(), cs, cfg, ms) assert.NoError(t, err) - err = mr.Start(t.Context(), nil) + err = mr.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, mr.Shutdown(t.Context())) @@ -335,7 +335,7 @@ func TestEmptyLine(t *testing.T) { ts := new(consumertest.TracesSink) tr, err := NewFactory().CreateTraces(t.Context(), cs, cfg, ts) assert.NoError(t, err) - err = tr.Start(t.Context(), nil) + err = tr.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, tr.Shutdown(t.Context())) @@ -356,7 +356,7 @@ func TestEmptyLine(t *testing.T) { ls := new(consumertest.LogsSink) lr, err := NewFactory().CreateLogs(t.Context(), cs, cfg, ls) assert.NoError(t, err) - err = lr.Start(t.Context(), nil) + err = lr.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, lr.Shutdown(t.Context())) diff --git a/receiver/prometheusreceiver/internal/targetallocator/manager.go b/receiver/prometheusreceiver/internal/targetallocator/manager.go index c0fc97fc55908..ff816b427fbb8 100644 --- a/receiver/prometheusreceiver/internal/targetallocator/manager.go +++ b/receiver/prometheusreceiver/internal/targetallocator/manager.go @@ -72,7 +72,7 @@ func (m *Manager) Start(ctx context.Context, host component.Host, sm *scrape.Man // the target allocator is disabled return nil } - httpClient, err := m.cfg.ToClient(ctx, host, m.settings.TelemetrySettings) + httpClient, err := m.cfg.ToClient(ctx, host.GetExtensions(), m.settings.TelemetrySettings) if err != nil { m.settings.Logger.Error("Failed to create http client", zap.Error(err)) return err diff --git a/receiver/prometheusreceiver/metrics_receiver.go b/receiver/prometheusreceiver/metrics_receiver.go index 5ba159363a89c..69ad2fcffe6c6 100644 --- a/receiver/prometheusreceiver/metrics_receiver.go +++ b/receiver/prometheusreceiver/metrics_receiver.go @@ -383,7 +383,7 @@ func (r *pReceiver) initAPIServer(ctx context.Context, host component.Host) erro spanNameFormatter := otelhttp.WithSpanNameFormatter(func(_ string, r *http.Request) string { return fmt.Sprintf("%s %s", r.Method, r.URL.Path) }) - r.apiServer, err = r.cfg.APIServer.ServerConfig.ToServer(ctx, host, r.settings.TelemetrySettings, otelhttp.NewHandler(mux, "", spanNameFormatter)) + r.apiServer, err = r.cfg.APIServer.ServerConfig.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings, otelhttp.NewHandler(mux, "", spanNameFormatter)) if err != nil { return err } diff --git a/receiver/prometheusremotewritereceiver/receiver.go b/receiver/prometheusremotewritereceiver/receiver.go index b54cf24de7a82..469c02c2019f4 100644 --- a/receiver/prometheusremotewritereceiver/receiver.go +++ b/receiver/prometheusremotewritereceiver/receiver.go @@ -116,7 +116,7 @@ func (prw *prometheusRemoteWriteReceiver) Start(ctx context.Context, host compon return fmt.Errorf("failed to create obsreport: %w", err) } - prw.server, err = prw.config.ToServer(ctx, host, prw.settings.TelemetrySettings, mux) + prw.server, err = prw.config.ToServer(ctx, host.GetExtensions(), prw.settings.TelemetrySettings, mux) if err != nil { return fmt.Errorf("failed to create server definition: %w", err) } diff --git a/receiver/rabbitmqreceiver/client.go b/receiver/rabbitmqreceiver/client.go index 79a44ca7dc774..330e368d6bfc0 100644 --- a/receiver/rabbitmqreceiver/client.go +++ b/receiver/rabbitmqreceiver/client.go @@ -46,7 +46,7 @@ type rabbitmqCredentials struct { } func newClient(ctx context.Context, cfg *Config, host component.Host, settings component.TelemetrySettings, logger *zap.Logger) (client, error) { - httpClient, err := cfg.ToClient(ctx, host, settings) + httpClient, err := cfg.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/receiver/riakreceiver/client.go b/receiver/riakreceiver/client.go index 1c83fbbd9407b..ee910ad42c227 100644 --- a/receiver/riakreceiver/client.go +++ b/receiver/riakreceiver/client.go @@ -39,7 +39,7 @@ type riakCredentials struct { } func newClient(ctx context.Context, cfg *Config, host component.Host, settings component.TelemetrySettings, logger *zap.Logger) (client, error) { - httpClient, err := cfg.ToClient(ctx, host, settings) + httpClient, err := cfg.ToClient(ctx, host.GetExtensions(), settings) if err != nil { return nil, fmt.Errorf("failed to create HTTP Client: %w", err) } diff --git a/receiver/signalfxreceiver/receiver.go b/receiver/signalfxreceiver/receiver.go index 04295ce140d74..05c8611b89db9 100644 --- a/receiver/signalfxreceiver/receiver.go +++ b/receiver/signalfxreceiver/receiver.go @@ -137,7 +137,7 @@ func (r *sfxReceiver) Start(ctx context.Context, host component.Host) error { mx.HandleFunc("/v2/datapoint", r.handleDatapointReq) mx.HandleFunc("/v2/event", r.handleEventReq) - r.server, err = r.config.ToServer(ctx, host, r.settings.TelemetrySettings, mx) + r.server, err = r.config.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings, mx) if err != nil { return err } diff --git a/receiver/skywalkingreceiver/skywalking_receiver.go b/receiver/skywalkingreceiver/skywalking_receiver.go index 8af7caec8b017..93a13d842fd9b 100644 --- a/receiver/skywalkingreceiver/skywalking_receiver.go +++ b/receiver/skywalkingreceiver/skywalking_receiver.go @@ -141,7 +141,7 @@ func (sr *swReceiver) startCollector(host component.Host) error { nr := mux.NewRouter() nr.HandleFunc("/v3/segments", sr.traceReceiver.HTTPHandler).Methods(http.MethodPost) - sr.collectorServer, cerr = sr.config.CollectorHTTPSettings.ToServer(ctx, host, sr.settings.TelemetrySettings, nr) + sr.collectorServer, cerr = sr.config.CollectorHTTPSettings.ToServer(ctx, host.GetExtensions(), sr.settings.TelemetrySettings, nr) if cerr != nil { return cerr } @@ -157,7 +157,7 @@ func (sr *swReceiver) startCollector(host component.Host) error { if sr.collectorGRPCEnabled() { var err error - sr.grpc, err = sr.config.CollectorGRPCServerSettings.ToServer(ctx, host, sr.settings.TelemetrySettings) + sr.grpc, err = sr.config.CollectorGRPCServerSettings.ToServer(ctx, host.GetExtensions(), sr.settings.TelemetrySettings) if err != nil { return fmt.Errorf("failed to build the options for the Skywalking gRPC Collector: %w", err) } diff --git a/receiver/solacereceiver/receiver_test.go b/receiver/solacereceiver/receiver_test.go index 78c5c5b155054..78002487b5674 100644 --- a/receiver/solacereceiver/receiver_test.go +++ b/receiver/solacereceiver/receiver_test.go @@ -276,7 +276,7 @@ func TestReceiverLifecycle(t *testing.T) { return nil, errors.New("some error") } // start the receiver - err := receiver.Start(t.Context(), nil) + err := receiver.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) assertChannelClosed(t, dialCalled) assertChannelClosed(t, receiveMessagesCalled) @@ -344,7 +344,7 @@ func TestReceiverDialFailureContinue(t *testing.T) { } } // start the receiver - err := receiver.Start(t.Context(), nil) + err := receiver.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) // expect factory to be called twice @@ -408,7 +408,7 @@ func TestReceiverUnmarshalVersionFailureExpectingDisable(t *testing.T) { close(closeDone) } // start the receiver - err := receiver.Start(t.Context(), nil) + err := receiver.Start(t.Context(), componenttest.NewNopHost()) assert.NoError(t, err) // expect dial to be called twice diff --git a/receiver/splunkenterprisereceiver/client.go b/receiver/splunkenterprisereceiver/client.go index 8fb672de594f8..5444a05a6bdab 100644 --- a/receiver/splunkenterprisereceiver/client.go +++ b/receiver/splunkenterprisereceiver/client.go @@ -56,7 +56,7 @@ func newSplunkEntClient(ctx context.Context, cfg *Config, h component.Host, s co // we already checked that url.Parse does not fail in cfg.Validate() if cfg.IdxEndpoint.Endpoint != "" { e, _ = url.Parse(cfg.IdxEndpoint.Endpoint) - c, err = cfg.IdxEndpoint.ToClient(ctx, h, s) + c, err = cfg.IdxEndpoint.ToClient(ctx, h.GetExtensions(), s) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func newSplunkEntClient(ctx context.Context, cfg *Config, h component.Host, s co } if cfg.SHEndpoint.Endpoint != "" { e, _ = url.Parse(cfg.SHEndpoint.Endpoint) - c, err = cfg.SHEndpoint.ToClient(ctx, h, s) + c, err = cfg.SHEndpoint.ToClient(ctx, h.GetExtensions(), s) if err != nil { return nil, err } @@ -78,7 +78,7 @@ func newSplunkEntClient(ctx context.Context, cfg *Config, h component.Host, s co } if cfg.CMEndpoint.Endpoint != "" { e, _ = url.Parse(cfg.CMEndpoint.Endpoint) - c, err = cfg.CMEndpoint.ToClient(ctx, h, s) + c, err = cfg.CMEndpoint.ToClient(ctx, h.GetExtensions(), s) if err != nil { return nil, err } diff --git a/receiver/splunkhecreceiver/receiver.go b/receiver/splunkhecreceiver/receiver.go index 24b57e7b2c4eb..6beea8757b0c3 100644 --- a/receiver/splunkhecreceiver/receiver.go +++ b/receiver/splunkhecreceiver/receiver.go @@ -166,7 +166,7 @@ func (r *splunkReceiver) Start(ctx context.Context, host component.Host) error { return fmt.Errorf("failed to bind to address %s: %w", r.config.Endpoint, err) } - r.server, err = r.config.ToServer(ctx, host, r.settings.TelemetrySettings, mx) + r.server, err = r.config.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings, mx) if err != nil { return err } diff --git a/receiver/splunkhecreceiver/receiver_test.go b/receiver/splunkhecreceiver/receiver_test.go index 67ec9f9b260c8..7d66e2b3979a3 100644 --- a/receiver/splunkhecreceiver/receiver_test.go +++ b/receiver/splunkhecreceiver/receiver_test.go @@ -615,7 +615,7 @@ func Test_splunkhecReceiver_AccessTokenPassthrough(t *testing.T) { if tt.metric { exporter, err := factory.CreateMetrics(t.Context(), exportertest.NewNopSettings(metadata.Type), exporterConfig) - assert.NoError(t, exporter.Start(t.Context(), nil)) + assert.NoError(t, exporter.Start(t.Context(), componenttest.NewNopHost())) defer func() { require.NoError(t, exporter.Shutdown(t.Context())) }() @@ -631,7 +631,7 @@ func Test_splunkhecReceiver_AccessTokenPassthrough(t *testing.T) { assert.NoError(t, err) } else { exporter, err := factory.CreateLogs(t.Context(), exportertest.NewNopSettings(metadata.Type), exporterConfig) - assert.NoError(t, exporter.Start(t.Context(), nil)) + assert.NoError(t, exporter.Start(t.Context(), componenttest.NewNopHost())) defer func() { require.NoError(t, exporter.Shutdown(t.Context())) }() @@ -699,7 +699,7 @@ func Test_Logs_splunkhecReceiver_IndexSourceTypePassthrough(t *testing.T) { exporterConfig.DisableCompression = true exporterConfig.Endpoint = endServer.URL exporter, err := factory.CreateLogs(t.Context(), exportertest.NewNopSettings(metadata.Type), exporterConfig) - assert.NoError(t, exporter.Start(t.Context(), nil)) + assert.NoError(t, exporter.Start(t.Context(), componenttest.NewNopHost())) assert.NoError(t, err) defer func() { require.NoError(t, exporter.Shutdown(t.Context())) @@ -815,7 +815,7 @@ func Test_Metrics_splunkhecReceiver_IndexSourceTypePassthrough(t *testing.T) { exporterConfig.Endpoint = endServer.URL exporter, err := factory.CreateMetrics(t.Context(), exportertest.NewNopSettings(metadata.Type), exporterConfig) - assert.NoError(t, exporter.Start(t.Context(), nil)) + assert.NoError(t, exporter.Start(t.Context(), componenttest.NewNopHost())) defer func() { require.NoError(t, exporter.Shutdown(t.Context())) }() diff --git a/receiver/stefreceiver/stef.go b/receiver/stefreceiver/stef.go index 00307e6ce8400..13dcf1e404984 100644 --- a/receiver/stefreceiver/stef.go +++ b/receiver/stefreceiver/stef.go @@ -43,7 +43,7 @@ func (r *stefReceiver) Start(ctx context.Context, host component.Host) error { r.stopping.Store(false) var err error - if r.serverGRPC, err = r.cfg.ToServer(ctx, host, r.settings.TelemetrySettings); err != nil { + if r.serverGRPC, err = r.cfg.ToServer(ctx, host.GetExtensions(), r.settings.TelemetrySettings); err != nil { return err } diff --git a/receiver/vcenterreceiver/scraper_test.go b/receiver/vcenterreceiver/scraper_test.go index 270fd84004850..32d45487011cc 100644 --- a/receiver/vcenterreceiver/scraper_test.go +++ b/receiver/vcenterreceiver/scraper_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/receiver/receivertest" "go.uber.org/zap" @@ -151,7 +152,7 @@ func TestStartFailures_Metrics(t *testing.T) { ctx := t.Context() for _, tc := range cases { scraper := newVmwareVcenterScraper(zap.NewNop(), tc.cfg, receivertest.NewNopSettings(metadata.Type)) - err := scraper.Start(ctx, nil) + err := scraper.Start(ctx, componenttest.NewNopHost()) if tc.err != nil { require.ErrorContains(t, err, tc.err.Error()) } else { diff --git a/receiver/webhookeventreceiver/receiver.go b/receiver/webhookeventreceiver/receiver.go index cf77fee570e30..22b2ac55ef1e2 100644 --- a/receiver/webhookeventreceiver/receiver.go +++ b/receiver/webhookeventreceiver/receiver.go @@ -111,7 +111,7 @@ func (er *eventReceiver) Start(ctx context.Context, host component.Host) error { router.GET(er.cfg.HealthPath, er.handleHealthCheck) // webhook server standup and configuration - er.server, err = er.cfg.ToServer(ctx, host, er.settings.TelemetrySettings, router) + er.server, err = er.cfg.ToServer(ctx, host.GetExtensions(), er.settings.TelemetrySettings, router) if err != nil { return err } diff --git a/receiver/zipkinreceiver/trace_receiver.go b/receiver/zipkinreceiver/trace_receiver.go index 8b864202864b1..f53387ceebd3b 100644 --- a/receiver/zipkinreceiver/trace_receiver.go +++ b/receiver/zipkinreceiver/trace_receiver.go @@ -95,7 +95,7 @@ func (zr *zipkinReceiver) Start(ctx context.Context, host component.Host) error } var err error - zr.server, err = zr.config.ToServer(ctx, host, zr.settings.TelemetrySettings, zr) + zr.server, err = zr.config.ToServer(ctx, host.GetExtensions(), zr.settings.TelemetrySettings, zr) if err != nil { return err } diff --git a/testbed/datasenders/jaeger.go b/testbed/datasenders/jaeger.go index d9b175b3f2742..9c324afba5bca 100644 --- a/testbed/datasenders/jaeger.go +++ b/testbed/datasenders/jaeger.go @@ -176,7 +176,7 @@ func (s *protoGRPCSender) start(ctx context.Context, host component.Host) error if s.clientSettings == nil { return errors.New("client settings not found") } - conn, err := s.clientSettings.ToClientConn(ctx, host, s.settings) + conn, err := s.clientSettings.ToClientConn(ctx, host.GetExtensions(), s.settings) if err != nil { return err } diff --git a/testbed/mockdatasenders/mockdatadogagentexporter/traces_exporter.go b/testbed/mockdatasenders/mockdatadogagentexporter/traces_exporter.go index dd3f557b27ea5..714fccd99d527 100644 --- a/testbed/mockdatasenders/mockdatadogagentexporter/traces_exporter.go +++ b/testbed/mockdatasenders/mockdatadogagentexporter/traces_exporter.go @@ -37,7 +37,7 @@ func createExporter(c *Config) *ddExporter { // start creates the http client func (dd *ddExporter) start(ctx context.Context, host component.Host) (err error) { - dd.client, err = dd.clientSettings.ToClient(ctx, host, componenttest.NewNopTelemetrySettings()) + dd.client, err = dd.clientSettings.ToClient(ctx, host.GetExtensions(), componenttest.NewNopTelemetrySettings()) return err }