Skip to content

fix: Test flake for DataDog agent logs #1026

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

Merged
merged 1 commit into from
Apr 18, 2022
Merged
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
14 changes: 12 additions & 2 deletions cli/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ func start() *cobra.Command {
root := &cobra.Command{
Use: "start",
RunE: func(cmd *cobra.Command, args []string) error {
logger := slog.Make(sloghuman.Sink(os.Stderr))
if traceDatadog {
tracer.Start()
tracer.Start(tracer.WithLogStartup(false), tracer.WithLogger(&datadogLogger{
logger: logger.Named("datadog"),
}))
defer tracer.Stop()
}

Expand Down Expand Up @@ -153,7 +156,6 @@ func start() *cobra.Command {
return xerrors.Errorf("parse ssh keygen algorithm %s: %w", sshKeygenAlgorithmRaw, err)
}

logger := slog.Make(sloghuman.Sink(os.Stderr))
options := &coderd.Options{
AccessURL: accessURLParsed,
Logger: logger.Named("coderd"),
Expand Down Expand Up @@ -534,3 +536,11 @@ func configureTLS(listener net.Listener, tlsMinVersion, tlsClientAuth, tlsCertFi

return tls.NewListener(listener, tlsConfig), nil
}

type datadogLogger struct {
logger slog.Logger
}

func (d *datadogLogger) Log(msg string) {
d.logger.Debug(context.Background(), msg)
}