Skip to content

Commit

Permalink
Handle updated LoadTLSConfig function signature
Browse files Browse the repository at this point in the history
  • Loading branch information
swar8080 committed Apr 17, 2024
1 parent 666111c commit 8f09ac9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion exporter/rabbitmqexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
6 changes: 3 additions & 3 deletions exporter/rabbitmqexporter/rabbitmq_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/rabbitmqexporter/rabbitmq_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8f09ac9

Please sign in to comment.