@@ -74,12 +74,6 @@ func (s *Sandbox) doRequestWithInfiniteRetries(
7474 return response , requestCount , nil
7575 }
7676
77- logger .L ().Debug (ctx , "failed to do request to envd, retrying" ,
78- logger .WithSandboxID (s .Runtime .SandboxID ),
79- logger .WithEnvdVersion (s .Config .Envd .Version ),
80- zap .Int64 ("timeout_ms" , s .internalConfig .EnvdInitRequestTimeout .Milliseconds ()),
81- zap .Error (err ))
82-
8377 select {
8478 case <- ctx .Done ():
8579 return nil , requestCount , fmt .Errorf ("%w with cause: %w" , ctx .Err (), context .Cause (ctx ))
@@ -119,6 +113,14 @@ func (s *Sandbox) initEnvd(ctx context.Context) (e error) {
119113
120114 response , count , err := s .doRequestWithInfiniteRetries (ctx , http .MethodPost , address )
121115 if err != nil {
116+ logger .L ().Error (ctx , "failed to init envd after retries" ,
117+ logger .WithSandboxID (s .Runtime .SandboxID ),
118+ logger .WithEnvdVersion (s .Config .Envd .Version ),
119+ zap .Int64 ("timeout_ms" , s .internalConfig .EnvdInitRequestTimeout .Milliseconds ()),
120+ zap .Int64 ("attempts" , count ),
121+ zap .Error (err ),
122+ )
123+
122124 envdInitCalls .Add (ctx , count , metric .WithAttributes (attributesFail ... ))
123125
124126 return fmt .Errorf ("failed to init envd: %w" , err )
@@ -149,6 +151,13 @@ func (s *Sandbox) initEnvd(ctx context.Context) (e error) {
149151 return fmt .Errorf ("unexpected status code: %d" , response .StatusCode )
150152 }
151153
154+ logger .L ().Debug (ctx , "succeeded to init envd" ,
155+ logger .WithSandboxID (s .Runtime .SandboxID ),
156+ logger .WithEnvdVersion (s .Config .Envd .Version ),
157+ zap .Int64 ("timeout_ms" , s .internalConfig .EnvdInitRequestTimeout .Milliseconds ()),
158+ zap .Int64 ("attempts" , count ),
159+ )
160+
152161 span .SetStatus (codes .Ok , fmt .Sprintf ("envd init returned %d" , response .StatusCode ))
153162
154163 return nil
0 commit comments