Skip to content

Commit

Permalink
adding the jetstream stream first_seq value
Browse files Browse the repository at this point in the history
  • Loading branch information
rayjanoka committed Sep 29, 2022
1 parent e3a1c26 commit f2e5fa2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions collector/jsz.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type jszCollector struct {
// Stream stats
streamMessages *prometheus.Desc
streamBytes *prometheus.Desc
streamFirstSeq *prometheus.Desc
streamLastSeq *prometheus.Desc
streamConsumerCount *prometheus.Desc

Expand Down Expand Up @@ -145,6 +146,13 @@ func newJszCollector(system, endpoint string, servers []*CollectedServer) promet
streamLabels,
nil,
),
// jetstream_stream_state_first_seq
streamFirstSeq: prometheus.NewDesc(
prometheus.BuildFQName(system, "stream", "first_seq"),
"First sequence from a stream",
streamLabels,
nil,
),
// jetstream_stream_state_last_seq
streamLastSeq: prometheus.NewDesc(
prometheus.BuildFQName(system, "stream", "last_seq"),
Expand Down Expand Up @@ -241,6 +249,7 @@ func (nc *jszCollector) Describe(ch chan<- *prometheus.Desc) {
// Stream state
ch <- nc.streamMessages
ch <- nc.streamBytes
ch <- nc.streamFirstSeq
ch <- nc.streamLastSeq
ch <- nc.streamConsumerCount

Expand Down Expand Up @@ -339,6 +348,7 @@ func (nc *jszCollector) Collect(ch chan<- prometheus.Metric) {
}
ch <- streamMetric(nc.streamMessages, float64(stream.State.Msgs))
ch <- streamMetric(nc.streamBytes, float64(stream.State.Bytes))
ch <- streamMetric(nc.streamFirstSeq, float64(stream.State.FirstSeq))
ch <- streamMetric(nc.streamLastSeq, float64(stream.State.LastSeq))
ch <- streamMetric(nc.streamConsumerCount, float64(stream.State.Consumers))

Expand Down

0 comments on commit f2e5fa2

Please sign in to comment.