@@ -200,22 +200,22 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
200200 return errors .New ("record cannot be nil" )
201201 }
202202
203- url := fmt .Sprintf ("%s/orgs/%s/artifacts/metadata/deployment-record" , c .baseURL , c .org )
203+ singleUrl := fmt .Sprintf ("%s/orgs/%s/artifacts/metadata/deployment-record" , c .baseURL , c .org )
204204
205205 body , err := buildRequestBody (record )
206206 if err != nil {
207207 return fmt .Errorf ("failed to marshal record: %w" , err )
208208 }
209209
210- respBody , statusCode , lastErr := c .postWithRetry (ctx , url , body )
210+ respBody , statusCode , lastErr := c .postWithRetry (ctx , singleUrl , body )
211211
212212 var clientErr * ClientError
213213 switch {
214214 case errors .As (lastErr , & clientErr ):
215215 dtmetrics .PostDeploymentRecordClientError .Inc ()
216216 slog .Warn ("client error, aborting" ,
217217 "status_code" , statusCode ,
218- "url" , url ,
218+ "url" , singleUrl ,
219219 "resp_msg" , string (respBody ),
220220 )
221221 return fmt .Errorf ("client error: %w" , lastErr )
@@ -250,22 +250,22 @@ func (c *Client) PostCluster(ctx context.Context, records []*DeploymentRecord, c
250250 return nil , nil
251251 }
252252
253- url := fmt .Sprintf ("%s/orgs/%s/artifacts/metadata/deployment-record/cluster/%s" , c .baseURL , c .org , url .PathEscape (cluster ))
253+ clusterUrl := fmt .Sprintf ("%s/orgs/%s/artifacts/metadata/deployment-record/cluster/%s" , c .baseURL , c .org , url .PathEscape (cluster ))
254254
255255 body , err := buildClusterRequestBody (records )
256256 if err != nil {
257257 return nil , fmt .Errorf ("failed to marshal records: %w" , err )
258258 }
259259
260- respBody , statusCode , lastErr := c .postWithRetry (ctx , url , body )
260+ respBody , statusCode , lastErr := c .postWithRetry (ctx , clusterUrl , body )
261261
262262 var clientErr * ClientError
263263 switch {
264264 case errors .As (lastErr , & clientErr ):
265265 dtmetrics .PostDeploymentRecordClientError .Inc ()
266266 slog .Warn ("client error, aborting" ,
267267 "status_code" , statusCode ,
268- "url" , url ,
268+ "url" , clusterUrl ,
269269 "resp_msg" , string (respBody ),
270270 )
271271 return nil , fmt .Errorf ("client error: %w" , lastErr )
0 commit comments