Commit fa8b8b2f authored by inphi's avatar inphi

op-batcher: Add Channel Output Bytes Counter

parent 1afd173e
......@@ -64,8 +64,11 @@ type Metrics struct {
ChannelClosedReason prometheus.Gauge
ChannelNumFrames prometheus.Gauge
ChannelComprRatio prometheus.Histogram
ChannelOutputBytesTotal prometheus.Counter
BatcherTxEvs opmetrics.EventVec
lastChannelOutputBytes int
}
var _ Metricer = (*Metrics)(nil)
......@@ -144,6 +147,11 @@ func NewMetrics(procName string) *Metrics {
Help: "Compression ratios of closed channel.",
Buckets: append([]float64{0.1, 0.2}, prometheus.LinearBuckets(0.3, 0.05, 14)...),
}),
ChannelOutputBytesTotal: factory.NewCounter(prometheus.CounterOpts{
Namespace: ns,
Name: "output_bytes_total",
Help: "Total number of compressed output bytes from a channel.",
}),
BatcherTxEvs: opmetrics.NewEventVec(factory, ns, "batcher_tx", "BatcherTx", []string{"stage"}),
}
......@@ -220,6 +228,10 @@ func (m *Metrics) RecordChannelClosed(id derive.ChannelID, numPendingBlocks int,
m.ChannelInputBytes.WithLabelValues(StageClosed).Set(float64(inputBytes))
m.ChannelOutputBytes.Set(float64(outputComprBytes))
outputBytesDelta := outputComprBytes - m.lastChannelOutputBytes
m.lastChannelOutputBytes = outputComprBytes
m.ChannelOutputBytesTotal.Add(float64(outputBytesDelta))
var comprRatio float64
if inputBytes > 0 {
comprRatio = float64(outputComprBytes) / float64(inputBytes)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment