Skip to content

Commit

Permalink
Don't assume AWS SDK sets ContentLength for get object
Browse files Browse the repository at this point in the history
  • Loading branch information
hifi committed Jan 5, 2024
1 parent e71e685 commit 122fbbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions s3/replica_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (c *ReplicaClient) SnapshotReader(ctx context.Context, generation string, i
return nil, err
}
internal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, "GET").Inc()
internal.OperationBytesCounterVec.WithLabelValues(ReplicaClientType, "GET").Add(float64(*out.ContentLength))
internal.OperationBytesCounterVec.WithLabelValues(ReplicaClientType, "GET").Add(float64(aws.Int64Value(out.ContentLength)))

return out.Body, nil
}
Expand Down Expand Up @@ -386,7 +386,7 @@ func (c *ReplicaClient) WALSegmentReader(ctx context.Context, pos litestream.Pos
return nil, err
}
internal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, "GET").Inc()
internal.OperationBytesCounterVec.WithLabelValues(ReplicaClientType, "GET").Add(float64(*out.ContentLength))
internal.OperationBytesCounterVec.WithLabelValues(ReplicaClientType, "GET").Add(float64(aws.Int64Value(out.ContentLength)))

return out.Body, nil
}
Expand Down

0 comments on commit 122fbbd

Please sign in to comment.