-
-
Notifications
You must be signed in to change notification settings - Fork 522
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
feat: log docker info from compose #591
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -804,26 +804,29 @@ func NewDockerProvider(provOpts ...DockerProviderOption) (*DockerProvider, error | |
} | ||
|
||
// log docker server info only once | ||
logOnce.Do(p.logDockerServerInfo) | ||
logOnce.Do(func() { | ||
logDockerServerInfo(context.Background(), p.client, p.Logger) | ||
}) | ||
|
||
return p, nil | ||
} | ||
|
||
func (p *DockerProvider) logDockerServerInfo() { | ||
func logDockerServerInfo(ctx context.Context, client client.APIClient, logger Logging) { | ||
infoMessage := `%v - Connected to docker: | ||
Server Version: %v | ||
API Version: %v | ||
Operating System: %v | ||
Total Memory: %v MB | ||
` | ||
|
||
info, err := p.client.Info(context.Background()) | ||
info, err := client.Info(ctx) | ||
if err != nil { | ||
p.Logger.Printf("failed getting information about docker server: %s", err) | ||
logger.Printf("failed getting information about docker server: %s", err) | ||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed this I wonder if we should raise an error here, as if the docker info failed, then we cannot continue. In the meantime, we can live with the return, as this function is called after the docker client creation, so it's expected using the client is healthy |
||
} | ||
|
||
p.Logger.Printf(infoMessage, packagePath, | ||
info.ServerVersion, p.client.ClientVersion(), | ||
logger.Printf(infoMessage, packagePath, | ||
info.ServerVersion, client.ClientVersion(), | ||
info.OperatingSystem, info.MemTotal/1024/1024) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, such a cool feature in Go 😮