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

Update tcshandler logging for seelog. #693

Merged
merged 1 commit into from
Feb 2, 2017
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: 7 additions & 7 deletions agent/tcs/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ const (
func StartMetricsSession(params TelemetrySessionParams) {
disabled, err := params.isTelemetryDisabled()
if err != nil {
log.Warn("Error getting telemetry config", "err", err)
log.Warnf("Error getting telemetry config: %v", err)
return
}

if !disabled {
statsEngine := stats.NewDockerStatsEngine(params.Cfg, params.DockerClient, params.ContainerChangeEventStream)
err := statsEngine.MustInit(params.TaskEngine, params.Cfg.Cluster, params.ContainerInstanceArn)
if err != nil {
log.Warn("Error initializing metrics engine", "err", err)
log.Warnf("Error initializing metrics engine: %v", err)
return
}
err = StartSession(params, statsEngine)
if err != nil {
log.Warn("Error starting metrics session with backend", "err", err)
log.Warnf("Error starting metrics session with backend: %v", err)
return
}
} else {
Expand All @@ -76,7 +76,7 @@ func StartSession(params TelemetrySessionParams, statsEngine stats.Engine) error
if tcsError == nil || tcsError == io.EOF {
backoff.Reset()
} else {
log.Info("Error from tcs; backing off", "err", tcsError)
log.Infof("Error from tcs; backing off: %v", tcsError)
params.time().Sleep(backoff.Duration())
}
}
Expand All @@ -85,10 +85,10 @@ func StartSession(params TelemetrySessionParams, statsEngine stats.Engine) error
func startTelemetrySession(params TelemetrySessionParams, statsEngine stats.Engine) error {
tcsEndpoint, err := params.ECSClient.DiscoverTelemetryEndpoint(params.ContainerInstanceArn)
if err != nil {
log.Error("Unable to discover poll endpoint", "err", err)
log.Errorf("Unable to discover poll endpoint: ", err)
return err
}
log.Debug("Connecting to TCS endpoint " + tcsEndpoint)
log.Debugf("Connecting to TCS endpoint %v", tcsEndpoint)
url := formatURL(tcsEndpoint, params.Cfg.Cluster, params.ContainerInstanceArn)
return startSession(url, params.Cfg.AWSRegion, params.CredentialProvider, params.AcceptInvalidCert, statsEngine, defaultHeartbeatTimeout, defaultHeartbeatJitter, defaultPublishMetricsInterval, params.DeregisterInstanceEventStream)
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func startSession(url string, region string, credentialProvider *credentials.Cre
client.AddRequestHandler(ackPublishMetricHandler(timer))
err = client.Connect()
if err != nil {
log.Error("Error connecting to TCS: " + err.Error())
log.Errorf("Error connecting to TCS: %v", err.Error())
return err
}
return client.Serve()
Expand Down