Skip to content

Commit

Permalink
Instrument s3 client DeleteObject requests. (#4649)
Browse files Browse the repository at this point in the history
Signed-off-by: Callum Styan <[email protected]>
  • Loading branch information
cstyan authored Nov 4, 2021
1 parent e95d193 commit 678495a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/storage/chunk/aws/s3_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,15 @@ func (a *S3ObjectClient) Stop() {}

// DeleteObject deletes the specified objectKey from the appropriate S3 bucket
func (a *S3ObjectClient) DeleteObject(ctx context.Context, objectKey string) error {
_, err := a.S3.DeleteObject(&s3.DeleteObjectInput{
Bucket: aws.String(a.bucketFromKey(objectKey)),
Key: aws.String(objectKey),
})
if err != nil {
return err
}
return instrument.CollectedRequest(ctx, "S3.DeleteObject", s3RequestDuration, instrument.ErrorCode, func(ctx context.Context) error {
deleteObjectInput := &s3.DeleteObjectInput{
Bucket: aws.String(a.bucketFromKey(objectKey)),
Key: aws.String(objectKey),
}

return nil
_, err := a.S3.DeleteObjectWithContext(ctx, deleteObjectInput)
return err
})
}

// bucketFromKey maps a key to a bucket name
Expand Down

0 comments on commit 678495a

Please sign in to comment.