Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objstore: do not set last successful time metric before 1st upload #921

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ We use *breaking* word for marking changes that are not backward compatible (rel
### Added
- [#811](https://github.com/improbable-eng/thanos/pull/811) Remote write receiver

### Fixed
- [#921](https://github.com/improbable-eng/thanos/pull/921) `thanos_objstore_bucket_last_successful_upload_time` now does not appear when no blocks have been uploaded so far

## [v0.3.2](https://github.com/improbable-eng/thanos/releases/tag/v0.3.2) - 2019.03.04

### Added
Expand Down
12 changes: 6 additions & 6 deletions pkg/objstore/objstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ func BucketWithMetrics(name string, b Bucket, r prometheus.Registerer) Bucket {
ConstLabels: prometheus.Labels{"bucket": name},
Buckets: []float64{0.005, 0.01, 0.02, 0.04, 0.08, 0.15, 0.3, 0.6, 1, 1.5, 2.5, 5, 10, 20, 30},
}, []string{"operation"}),
lastSuccessfullUploadTime: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "thanos_objstore_bucket_last_successful_upload_time",
Help: "Second timestamp of the last successful upload to the bucket.",
ConstLabels: prometheus.Labels{"bucket": name}}),
lastSuccessfullUploadTime: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "thanos_objstore_bucket_last_successful_upload_time",
Help: "Second timestamp of the last successful upload to the bucket.",
}, []string{"bucket"}),
}
if r != nil {
r.MustRegister(bkt.ops, bkt.opsFailures, bkt.opsDuration, bkt.lastSuccessfullUploadTime)
Expand All @@ -211,7 +211,7 @@ type metricBucket struct {
ops *prometheus.CounterVec
opsFailures *prometheus.CounterVec
opsDuration *prometheus.HistogramVec
lastSuccessfullUploadTime prometheus.Gauge
lastSuccessfullUploadTime *prometheus.GaugeVec
}

func (b *metricBucket) Iter(ctx context.Context, dir string, f func(name string) error) error {
Expand Down Expand Up @@ -287,7 +287,7 @@ func (b *metricBucket) Upload(ctx context.Context, name string, r io.Reader) err
b.opsFailures.WithLabelValues(op).Inc()
} else {
//TODO: Use SetToCurrentTime() once we update the Prometheus client_golang
b.lastSuccessfullUploadTime.Set(float64(time.Now().UnixNano()) / 1e9)
b.lastSuccessfullUploadTime.WithLabelValues(b.bkt.Name()).Set(float64(time.Now().UnixNano()) / 1e9)
}
b.ops.WithLabelValues(op).Inc()
b.opsDuration.WithLabelValues(op).Observe(time.Since(start).Seconds())
Expand Down