Skip to content

Commit 6b975cd

Browse files
committed
add record digest to no artifact debug message, add container name to log messages
1 parent e29627a commit 6b975cd

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pkg/deploymentrecord/client.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
273273
slog.Debug("no artifact attestation found, no record created",
274274
"attempt", attempt,
275275
"status_code", resp.StatusCode,
276+
"container_name", record.Name,
277+
"digest", record.Digest,
276278
)
277279
return &NoArtifactError{err: fmt.Errorf("no attestation found for %s", record.Digest)}
278280
case resp.StatusCode >= 400 && resp.StatusCode < 500:
@@ -284,6 +286,7 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
284286
"attempt", attempt,
285287
"status_code", resp.StatusCode,
286288
"retry_after", resp.Header.Get("Retry-After"),
289+
"container_name", record.Name,
287290
"resp_msg", string(respBody),
288291
)
289292
lastErr = fmt.Errorf("rate limited, attempt %d", attempt)
@@ -294,6 +297,7 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
294297
slog.Warn("client error, aborting",
295298
"attempt", attempt,
296299
"status_code", resp.StatusCode,
300+
"container_name", record.Name,
297301
"resp_msg", string(respBody),
298302
)
299303
return &ClientError{err: fmt.Errorf("unexpected client err with status code %d", resp.StatusCode)}
@@ -303,6 +307,7 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
303307
slog.Debug("retriable error",
304308
"attempt", attempt,
305309
"status_code", resp.StatusCode,
310+
"container_name", record.Name,
306311
"resp_msg", string(respBody),
307312
)
308313
lastErr = fmt.Errorf("server error, attempt %d", attempt)
@@ -312,6 +317,8 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
312317
dtmetrics.PostDeploymentRecordHardFail.Inc()
313318
slog.Error("all retries exhausted",
314319
"count", c.retries,
315-
"error", lastErr)
320+
"error", lastErr,
321+
"container_name", record.Name,
322+
)
316323
return fmt.Errorf("all retries exhausted: %w", lastErr)
317324
}

0 commit comments

Comments
 (0)