Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: improve clarity of the agent logs#6345

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kylecarbs merged 1 commit intomainfromagentlogs
Feb 27, 2023
Merged
Changes fromall 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
25 changes: 12 additions & 13 deletionsagent/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -156,7 +156,7 @@ func (a *agent) runLoop(ctx context.Context) {
go a.reportLifecycleLoop(ctx)

for retrier := retry.New(100*time.Millisecond, 10*time.Second); retrier.Wait(ctx); {
a.logger.Info(ctx, "running loop")
a.logger.Info(ctx, "connecting to coderd")
err := a.run(ctx)
// Cancel after the run is complete to clean up any leaked resources!
if err == nil {
Expand All@@ -169,7 +169,7 @@ func (a *agent) runLoop(ctx context.Context) {
return
}
if errors.Is(err, io.EOF) {
a.logger.Info(ctx, "likelydisconnected fromcoder", slog.Error(err))
a.logger.Info(ctx, "disconnected fromcoderd")
continue
}
a.logger.Warn(ctx, "run exited with error", slog.Error(err))
Expand DownExpand Up@@ -197,7 +197,7 @@ func (a *agent) reportLifecycleLoop(ctx context.Context) {
break
}

a.logger.Debug(ctx, "post lifecycle state", slog.F("state", state))
a.logger.Debug(ctx, "reporting lifecycle state", slog.F("state", state))

err := a.client.PostLifecycle(ctx, agentsdk.PostLifecycleRequest{
State: state,
Expand DownExpand Up@@ -242,7 +242,7 @@ func (a *agent) run(ctx context.Context) error {
if err != nil {
return xerrors.Errorf("fetch metadata: %w", err)
}
a.logger.Info(ctx, "fetched metadata")
a.logger.Info(ctx, "fetched metadata", slog.F("metadata", metadata))

// Expand the directory and send it back to coderd so external
// applications that rely on the directory can use it.
Expand DownExpand Up@@ -330,13 +330,10 @@ func (a *agent) run(ctx context.Context) error {
go NewWorkspaceAppHealthReporter(
a.logger, metadata.Apps, a.client.PostAppHealth)(appReporterCtx)

a.logger.Debug(ctx, "running tailnet with derpmap", slog.F("derpmap", metadata.DERPMap))

a.closeMutex.Lock()
network := a.network
a.closeMutex.Unlock()
if network == nil {
a.logger.Debug(ctx, "creating tailnet")
network, err = a.createTailnet(ctx, metadata.DERPMap)
if err != nil {
return xerrors.Errorf("create tailnet: %w", err)
Expand DownExpand Up@@ -385,10 +382,9 @@ func (a *agent) run(ctx context.Context) error {
network.SetDERPMap(metadata.DERPMap)
}

a.logger.Debug(ctx, "running coordinator")
a.logger.Debug(ctx, "runningtailnet connectioncoordinator")
err = a.runCoordinator(ctx, network)
if err != nil {
a.logger.Debug(ctx, "coordinator exited", slog.Error(err))
return xerrors.Errorf("run coordinator: %w", err)
}
return nil
Expand DownExpand Up@@ -474,7 +470,9 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
for {
conn, err := reconnectingPTYListener.Accept()
if err != nil {
logger.Debug(ctx, "accept pty failed", slog.Error(err))
if !a.isClosed() {
logger.Debug(ctx, "accept pty failed", slog.Error(err))
}
break
}
wg.Add(1)
Expand DownExpand Up@@ -529,7 +527,9 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
for {
conn, err := speedtestListener.Accept()
if err != nil {
a.logger.Debug(ctx, "speedtest listener failed", slog.Error(err))
if !a.isClosed() {
a.logger.Debug(ctx, "speedtest listener failed", slog.Error(err))
}
break
}
wg.Add(1)
Expand DownExpand Up@@ -600,7 +600,7 @@ func (a *agent) runCoordinator(ctx context.Context, network *tailnet.Conn) error
return err
}
defer coordinator.Close()
a.logger.Info(ctx, "connected to coordinationserver")
a.logger.Info(ctx, "connected to coordinationendpoint")
sendNodes, errChan := tailnet.ServeCoordinator(coordinator, func(nodes []*tailnet.Node) error {
return network.UpdateNodes(nodes, false)
})
Expand DownExpand Up@@ -646,7 +646,6 @@ func (a *agent) runStartupScript(ctx context.Context, script string) error {
}

func (a *agent) init(ctx context.Context) {
a.logger.Info(ctx, "generating host key")
// Clients' should ignore the host key when connecting.
// The agent needs to authenticate with coderd to SSH,
// so SSH authentication doesn't improve security.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp