diff --git a/exporter/rabbitmqexporter/factory.go b/exporter/rabbitmqexporter/factory.go index 6004ad0f2495..b87ced0fe0ec 100644 --- a/exporter/rabbitmqexporter/factory.go +++ b/exporter/rabbitmqexporter/factory.go @@ -141,7 +141,7 @@ func newTLSFactory(config *Config) tlsFactory { if config.Connection.TLSConfig != nil { return config.Connection.TLSConfig.LoadTLSConfig } - return func() (*tls.Config, error) { + return func(context.Context) (*tls.Config, error) { return nil, nil } } diff --git a/exporter/rabbitmqexporter/rabbitmq_exporter.go b/exporter/rabbitmqexporter/rabbitmq_exporter.go index c6f01297cdda..40d068e3f076 100644 --- a/exporter/rabbitmqexporter/rabbitmq_exporter.go +++ b/exporter/rabbitmqexporter/rabbitmq_exporter.go @@ -28,7 +28,7 @@ type rabbitmqExporter struct { } type publisherFactory = func(publisher.DialConfig) (publisher.Publisher, error) -type tlsFactory = func() (*tls.Config, error) +type tlsFactory = func(context.Context) (*tls.Config, error) func newRabbitmqExporter(cfg *Config, set component.TelemetrySettings, publisherFactory publisherFactory, tlsFactory tlsFactory, routingKey string, connectionName string) *rabbitmqExporter { exporter := &rabbitmqExporter{ @@ -42,7 +42,7 @@ func newRabbitmqExporter(cfg *Config, set component.TelemetrySettings, publisher return exporter } -func (e *rabbitmqExporter) start(_ context.Context, host component.Host) error { +func (e *rabbitmqExporter) start(ctx context.Context, host component.Host) error { m, err := newMarshaler(e.config.EncodingExtensionID, host) if err != nil { return err @@ -63,7 +63,7 @@ func (e *rabbitmqExporter) start(_ context.Context, host component.Host) error { PublishConfirmationTimeout: e.config.Connection.PublishConfirmationTimeout, } - tlsConfig, err := e.tlsFactory() + tlsConfig, err := e.tlsFactory(ctx) if err != nil { return err } diff --git a/exporter/rabbitmqexporter/rabbitmq_exporter_test.go b/exporter/rabbitmqexporter/rabbitmq_exporter_test.go index 3f0f401d5154..7ede372ff1d2 100644 --- a/exporter/rabbitmqexporter/rabbitmq_exporter_test.go +++ b/exporter/rabbitmqexporter/rabbitmq_exporter_test.go @@ -86,7 +86,7 @@ func TestStart_TLSError(t *testing.T) { var pubFactory = func(publisher.DialConfig) (publisher.Publisher, error) { return &pub, nil } - tlsFactory := func() (*tls.Config, error) { + tlsFactory := func(context.Context) (*tls.Config, error) { return nil, errors.New("simulating tls config error") } exporter := newRabbitmqExporter(cfg, exportertest.NewNopCreateSettings().TelemetrySettings, pubFactory, tlsFactory, routingKey, connectionName)