@@ -79,6 +79,10 @@ func (a *APIStore) PostSandboxesSandboxIDResume(c *gin.Context, sandboxID api.Sa
7979 logger .L ().Debug (ctx , "Waiting for sandbox to pause" , logger .WithSandboxID (sandboxID ))
8080 err = a .orchestrator .WaitForStateChange (ctx , teamID , sandboxID )
8181 if err != nil {
82+ telemetry .ReportCriticalError (ctx , "error waiting for sandbox to pause" , err ,
83+ telemetry .WithSandboxID (sandboxID ),
84+ telemetry .WithTeamID (teamID .String ()),
85+ )
8286 a .sendAPIStoreError (c , http .StatusInternalServerError , "Error waiting for sandbox to pause" )
8387
8488 return
@@ -104,7 +108,10 @@ func (a *APIStore) PostSandboxesSandboxIDResume(c *gin.Context, sandboxID api.Sa
104108
105109 return
106110 default :
107- logger .L ().Error (ctx , "Sandbox is in an unknown state" , logger .WithSandboxID (sandboxID ), zap .String ("state" , string (sandboxData .State )))
111+ telemetry .ReportCriticalError (ctx , "Sandbox is in an unknown state" , fmt .Errorf ("state: %s" , sandboxData .State ),
112+ telemetry .WithSandboxID (sandboxID ),
113+ telemetry .WithTeamID (teamID .String ()),
114+ )
108115 a .sendAPIStoreError (c , http .StatusInternalServerError , "Sandbox is in an unknown state" )
109116
110117 return
@@ -121,7 +128,10 @@ func (a *APIStore) PostSandboxesSandboxIDResume(c *gin.Context, sandboxID api.Sa
121128 return
122129 }
123130
124- logger .L ().Error (ctx , "Error getting last snapshot" , logger .WithSandboxID (sandboxID ), zap .Error (err ))
131+ telemetry .ReportCriticalError (ctx , "Error getting last snapshot" , err ,
132+ telemetry .WithSandboxID (sandboxID ),
133+ telemetry .WithTeamID (teamID .String ()),
134+ )
125135 a .sendAPIStoreError (c , http .StatusInternalServerError , "Error when getting snapshot" )
126136
127137 return
@@ -158,7 +168,12 @@ func (a *APIStore) PostSandboxesSandboxIDResume(c *gin.Context, sandboxID api.Sa
158168 if snap .EnvSecure {
159169 accessToken , tokenErr := a .getEnvdAccessToken (build .EnvdVersion , sandboxID )
160170 if tokenErr != nil {
161- logger .L ().Error (ctx , "Secure envd access token error" , zap .Error (tokenErr .Err ), logger .WithTemplateID (snap .EnvID ), logger .WithBuildID (build .ID .String ()), logger .WithSandboxID (sandboxID ))
171+ telemetry .ReportErrorByCode (ctx , tokenErr .Code , "Secure envd access token error" , tokenErr .Err ,
172+ telemetry .WithTemplateID (snap .EnvID ),
173+ telemetry .WithBuildID (build .ID .String ()),
174+ telemetry .WithSandboxID (sandboxID ),
175+ telemetry .WithTeamID (teamID .String ()),
176+ )
162177 a .sendAPIStoreError (c , tokenErr .Code , tokenErr .ClientMsg )
163178
164179 return
0 commit comments