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

Updates gazette_shard_read_head tracking #309

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
13 changes: 5 additions & 8 deletions consumer/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ var (
"gazette_shard_up",
"Indicates the processing status of a shard by this consumer.",
[]string{"shard", "status"}, nil)

shardReadHeadDesc = prometheus.NewDesc(
"gazette_shard_read_head",
"Current read head of the consumer (i.e., next journal byte offset to be read).",
[]string{"shard", "journal"}, nil)
)

var (
Expand All @@ -315,10 +320,6 @@ var (
Name: "gazette_shard_read_bytes_total",
Help: "Total byte-length of messages processed by completed consumer transactions.",
}, []string{"shard"})
shardReadHeadGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "gazette_shard_read_head",
Help: "Current read head of the consumer (i.e., next journal byte offset to be read).",
}, []string{"shard", "journal"})
shardTxnPhaseSecondsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "gazette_shard_phase_seconds_total",
Help: "Cumulative number of seconds processing transactions.",
Expand Down Expand Up @@ -357,8 +358,4 @@ var (
Name: "gazette_consumer_consumed_bytes_total",
Help: "Cumulative number of bytes consumed.",
})
readHeadGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "gazette_consumer_read_head",
Help: "Consumer read head",
}, []string{"journal"})
)
9 changes: 9 additions & 0 deletions consumer/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,15 @@ func (r *Resolver) Collect(ch chan<- prometheus.Metric) {
1,
shardID.String(),
status.Code.String())

for j,o := range shard.progress.readThrough {
ch <- prometheus.MustNewConstMetric(
shardReadHeadDesc,
prometheus.GaugeValue,
float64(o),
shardID.String(),
j.String())
}
}
}

Expand Down
6 changes: 0 additions & 6 deletions consumer/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ func txnRead(s *shard, txn, prev *transaction, env EnvelopeOrError, ok bool) err

// DEPRECATED metrics to be removed:
bytesConsumedTotal.Add(float64(env.End - env.Begin))
readHeadGauge.WithLabelValues(env.Journal.Name.String()).Set(float64(env.End))
// End DEPRECATED metrics.

// |env| is read-uncommitted. Queue and act on its sequencing outcome.
Expand Down Expand Up @@ -501,11 +500,6 @@ func recordMetrics(s *shard, txn *transaction) {
shardTxnTotal.WithLabelValues(s.FQN()).Inc()
shardReadMsgsTotal.WithLabelValues(s.FQN()).Add(float64(txn.consumedCount))
shardReadBytesTotal.WithLabelValues(s.FQN()).Add(float64(txn.consumedBytes))
for journal, source := range txn.checkpoint.Sources {
shardReadHeadGauge.
WithLabelValues(s.FQN(), journal.String()).
Set(float64(source.ReadThrough))
}

var (
durNotRunning = txn.beganAt.Sub(txn.prevPrepareDoneAt)
Expand Down