Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(agent): update error handling on shutdown #4012

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions agent/runner/runstrategy_verbose.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func (s *Runner) RunVerboseStrategy(ctx context.Context, cfg agentConfig.Config)
s.ui.Infof("%s Starting Agent with name %s...", consoleUI.Emoji_Truck, cfg.Name)

session, err := StartSession(ctx, cfg, &verboseObserver{ui: s.ui}, s.logger)

if err != nil && errors.Is(err, ErrOtlpServerStart) {
s.ui.Errorf("%s Tracetest Agent binds to the OpenTelemetry ports 4317 and 4318 which are used to receive trace information from your system. The agent tried to bind to these ports, but failed.", consoleUI.Emoji_RedCircle)

s.ui.Finish()
if err != nil {
if errors.Is(err, ErrOtlpServerStart) {
s.ui.Errorf("%s Tracetest Agent binds to the OpenTelemetry ports 4317 and 4318 which are used to receive trace information from your system. The agent tried to bind to these ports, but failed.", consoleUI.Emoji_RedCircle)
s.ui.Finish()
}
return err
}

Expand Down
4 changes: 3 additions & 1 deletion agent/runner/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ type Session struct {
}

func (s *Session) Close() {
s.client.Close()
if s != nil && s.client != nil {
s.client.Close()
}
}

func (s *Session) WaitUntilDisconnected() {
Expand Down
Loading