Skip to content

Commit

Permalink
Use histogram instead
Browse files Browse the repository at this point in the history
  • Loading branch information
suzaku committed May 20, 2019
1 parent 7141468 commit 7ec96ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions drainer/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ var (
Help: "save checkpoint tso of drainer.",
})

checkpointDelayGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
checkpointDelayHistogram = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: "binlog",
Subsystem: "drainer",
Name: "checkpoint_delay_seconds",
Help: "How much the downstream checkpoint lag behind",
Buckets: prometheus.ExponentialBuckets(0.00005, 2, 18),
})

executeHistogram = prometheus.NewHistogram(
Expand Down Expand Up @@ -131,7 +132,7 @@ func init() {
registry.MustRegister(ddlJobsCounter)
registry.MustRegister(errorCount)
registry.MustRegister(checkpointTSOGauge)
registry.MustRegister(checkpointDelayGauge)
registry.MustRegister(checkpointDelayHistogram)
registry.MustRegister(eventCounter)
registry.MustRegister(executeHistogram)
registry.MustRegister(binlogReachDurationHistogram)
Expand Down
2 changes: 1 addition & 1 deletion drainer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (s *Syncer) handleSuccess(fakeBinlog chan *pb.Binlog, lastTS *int64) {
eventCounter.WithLabelValues("savepoint").Add(1)
}
delay := oracle.GetPhysical(time.Now()) - oracle.ExtractPhysical(uint64(ts))
checkpointDelayGauge.Set(float64(delay) / 1e3)
checkpointDelayHistogram.Observe(float64(delay) / 1e3)
}
}

Expand Down

0 comments on commit 7ec96ef

Please sign in to comment.