@@ -156,7 +156,7 @@ func (a *agent) runLoop(ctx context.Context) {
156
156
go a .reportLifecycleLoop (ctx )
157
157
158
158
for retrier := retry .New (100 * time .Millisecond ,10 * time .Second );retrier .Wait (ctx ); {
159
- a .logger .Info (ctx ,"running loop " )
159
+ a .logger .Info (ctx ,"connecting to coderd " )
160
160
err := a .run (ctx )
161
161
// Cancel after the run is complete to clean up any leaked resources!
162
162
if err == nil {
@@ -169,7 +169,7 @@ func (a *agent) runLoop(ctx context.Context) {
169
169
return
170
170
}
171
171
if errors .Is (err ,io .EOF ) {
172
- a .logger .Info (ctx ,"likely disconnected fromcoder" , slog . Error ( err ) )
172
+ a .logger .Info (ctx ,"disconnected fromcoderd" )
173
173
continue
174
174
}
175
175
a .logger .Warn (ctx ,"run exited with error" ,slog .Error (err ))
@@ -197,7 +197,7 @@ func (a *agent) reportLifecycleLoop(ctx context.Context) {
197
197
break
198
198
}
199
199
200
- a .logger .Debug (ctx ,"post lifecycle state" ,slog .F ("state" ,state ))
200
+ a .logger .Debug (ctx ,"reporting lifecycle state" ,slog .F ("state" ,state ))
201
201
202
202
err := a .client .PostLifecycle (ctx , agentsdk.PostLifecycleRequest {
203
203
State :state ,
@@ -242,7 +242,7 @@ func (a *agent) run(ctx context.Context) error {
242
242
if err != nil {
243
243
return xerrors .Errorf ("fetch metadata: %w" ,err )
244
244
}
245
- a .logger .Info (ctx ,"fetched metadata" )
245
+ a .logger .Info (ctx ,"fetched metadata" , slog . F ( "metadata" , metadata ) )
246
246
247
247
// Expand the directory and send it back to coderd so external
248
248
// applications that rely on the directory can use it.
@@ -330,13 +330,10 @@ func (a *agent) run(ctx context.Context) error {
330
330
go NewWorkspaceAppHealthReporter (
331
331
a .logger ,metadata .Apps ,a .client .PostAppHealth )(appReporterCtx )
332
332
333
- a .logger .Debug (ctx ,"running tailnet with derpmap" ,slog .F ("derpmap" ,metadata .DERPMap ))
334
-
335
333
a .closeMutex .Lock ()
336
334
network := a .network
337
335
a .closeMutex .Unlock ()
338
336
if network == nil {
339
- a .logger .Debug (ctx ,"creating tailnet" )
340
337
network ,err = a .createTailnet (ctx ,metadata .DERPMap )
341
338
if err != nil {
342
339
return xerrors .Errorf ("create tailnet: %w" ,err )
@@ -385,10 +382,9 @@ func (a *agent) run(ctx context.Context) error {
385
382
network .SetDERPMap (metadata .DERPMap )
386
383
}
387
384
388
- a .logger .Debug (ctx ,"running coordinator" )
385
+ a .logger .Debug (ctx ,"runningtailnet connection coordinator" )
389
386
err = a .runCoordinator (ctx ,network )
390
387
if err != nil {
391
- a .logger .Debug (ctx ,"coordinator exited" ,slog .Error (err ))
392
388
return xerrors .Errorf ("run coordinator: %w" ,err )
393
389
}
394
390
return nil
@@ -474,7 +470,9 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
474
470
for {
475
471
conn ,err := reconnectingPTYListener .Accept ()
476
472
if err != nil {
477
- logger .Debug (ctx ,"accept pty failed" ,slog .Error (err ))
473
+ if ! a .isClosed () {
474
+ logger .Debug (ctx ,"accept pty failed" ,slog .Error (err ))
475
+ }
478
476
break
479
477
}
480
478
wg .Add (1 )
@@ -529,7 +527,9 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
529
527
for {
530
528
conn ,err := speedtestListener .Accept ()
531
529
if err != nil {
532
- a .logger .Debug (ctx ,"speedtest listener failed" ,slog .Error (err ))
530
+ if ! a .isClosed () {
531
+ a .logger .Debug (ctx ,"speedtest listener failed" ,slog .Error (err ))
532
+ }
533
533
break
534
534
}
535
535
wg .Add (1 )
@@ -600,7 +600,7 @@ func (a *agent) runCoordinator(ctx context.Context, network *tailnet.Conn) error
600
600
return err
601
601
}
602
602
defer coordinator .Close ()
603
- a .logger .Info (ctx ,"connected to coordinationserver " )
603
+ a .logger .Info (ctx ,"connected to coordinationendpoint " )
604
604
sendNodes ,errChan := tailnet .ServeCoordinator (coordinator ,func (nodes []* tailnet.Node )error {
605
605
return network .UpdateNodes (nodes ,false )
606
606
})
@@ -646,7 +646,6 @@ func (a *agent) runStartupScript(ctx context.Context, script string) error {
646
646
}
647
647
648
648
func (a * agent )init (ctx context.Context ) {
649
- a .logger .Info (ctx ,"generating host key" )
650
649
// Clients' should ignore the host key when connecting.
651
650
// The agent needs to authenticate with coderd to SSH,
652
651
// so SSH authentication doesn't improve security.