Skip to content

Commit

Permalink
[FEAT] Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
rita.canavarro committed Jul 21, 2023
1 parent ce6f803 commit b9b2602
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/shipper/shipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newMetrics(reg prometheus.Registerer) *metrics {
})
m.uploadedBytes = promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "thanos_shipper_uploaded_bytes_total",
Help: "Total number of uploaded bytes.",
Help: "Total number of uploaded bytes from TSDB blocks.",
})

return &m
Expand Down Expand Up @@ -391,19 +391,17 @@ func (s *Shipper) upload(ctx context.Context, meta *metadata.Meta) error {
}

err := block.Upload(ctx, s.logger, s.bucket, updir, s.hashFunc)

if err != nil {
return errors.Wrap(err, "while upploading the block")
}

files, err := block.GatherFileStats(updir, s.hashFunc, s.logger)

fileStats, err := block.GatherFileStats(updir, s.hashFunc, s.logger)
if err != nil {
//The block upload should not stop due to issues gathering data for a metric
// The block upload should not stop due to issues gathering data for a metric.
return nil
}

for _, x := range files {
for _, x := range fileStats {
s.metrics.uploadedBytes.Add(float64(x.SizeBytes))
}

Expand Down

0 comments on commit b9b2602

Please sign in to comment.