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

Adding the jetstream stream first_seq value #190

Merged
merged 1 commit into from
Sep 29, 2022
Merged
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
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