diff --git a/pkg/storage/fs/s3ng/blobstore/blobstore.go b/pkg/storage/fs/s3ng/blobstore/blobstore.go index 5007e07b30..b3ecaa5756 100644 --- a/pkg/storage/fs/s3ng/blobstore/blobstore.go +++ b/pkg/storage/fs/s3ng/blobstore/blobstore.go @@ -105,10 +105,6 @@ func (p *PrometheusAwareReadSeekCloser) Close() error { // Upload stores some data in the blobstore under the given key func (bs *Blobstore) Upload(node *node.Node, reader io.Reader) error { - reader = &PrometheusAwareReader{ - r: reader, - m: metrics.Tx, - } size := int64(-1) if file, ok := reader.(*os.File); ok { info, err := file.Stat() @@ -118,6 +114,11 @@ func (bs *Blobstore) Upload(node *node.Node, reader io.Reader) error { size = info.Size() } + reader = &PrometheusAwareReader{ + r: reader, + m: metrics.Tx, + } + _, err := bs.client.PutObject(context.Background(), bs.bucket, bs.path(node), reader, size, minio.PutObjectOptions{ContentType: "application/octet-stream"}) if err != nil {