Skip to content

Commit

Permalink
remove logger field
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Dec 18, 2023
1 parent 637aef4 commit 7d6a27b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions extension/observer/ecsobserver/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var _ extension.Extension = (*ecsObserver)(nil)

// ecsObserver implements component.ServiceExtension interface.
type ecsObserver struct {
logger *zap.Logger
telemetrySettings component.TelemetrySettings
sd *serviceDiscovery

Expand All @@ -25,13 +24,13 @@ type ecsObserver struct {

// Start runs the service discovery in background
func (e *ecsObserver) Start(_ context.Context, _ component.Host) error {
e.logger.Info("Starting ECSDiscovery")
e.telemetrySettings.Logger.Info("Starting ECSDiscovery")
// Ignore the ctx parameter as it is not for long running operation
ctx, cancel := context.WithCancel(context.Background())
e.cancel = cancel
go func() {
if err := e.sd.runAndWriteFile(ctx); err != nil {
e.logger.Error("ECSDiscovery stopped by error", zap.Error(err))
e.telemetrySettings.Logger.Error("ECSDiscovery stopped by error", zap.Error(err))
// Stop the collector
_ = e.telemetrySettings.ReportComponentStatus(component.NewFatalErrorEvent(err))
}
Expand All @@ -40,7 +39,7 @@ func (e *ecsObserver) Start(_ context.Context, _ component.Host) error {
}

func (e *ecsObserver) Shutdown(_ context.Context) error {
e.logger.Info("Stopping ECSDiscovery")
e.telemetrySettings.Logger.Info("Stopping ECSDiscovery")
e.cancel()
return nil
}
1 change: 0 additions & 1 deletion extension/observer/ecsobserver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func createExtensionWithFetcher(params extension.CreateSettings, sdCfg *Config,
return nil, err
}
return &ecsObserver{
logger: params.Logger,
telemetrySettings: params.TelemetrySettings,
sd: sd,
}, nil
Expand Down

0 comments on commit 7d6a27b

Please sign in to comment.