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

add: consumer label in quorum lost and leader elected #2

Merged
merged 1 commit into from
Jun 2, 2024
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
8 changes: 4 additions & 4 deletions surveyor/jetstream_advisories.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ func NewJetStreamAdvisoryMetrics(registry *prometheus.Registry, constLabels prom
Name: prometheus.BuildFQName("nats", "jetstream", "consumer_leader_elected"),
Help: "How many times leader elections were done for consumers",
ConstLabels: constLabels,
}, []string{"account", "stream"}),
}, []string{"account", "stream", "consumer"}),

jsConsumerQuorumLost: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: prometheus.BuildFQName("nats", "jetstream", "consumer_quorum_lost"),
Help: "How many times a consumer lost quorum leading to new leader elections",
ConstLabels: constLabels,
}, []string{"account", "stream"}),
}, []string{"account", "stream", "consumer"}),

jsStreamLeaderElected: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: prometheus.BuildFQName("nats", "jetstream", "stream_leader_elected"),
Expand Down Expand Up @@ -532,10 +532,10 @@ func (o *jsAdvisoryListener) advisoryHandler(m *nats.Msg) {
o.metrics.jsSnapthotDuration.WithLabelValues(accountName, event.Stream).Observe(event.End.Sub(event.Start).Seconds())

case *advisory.JSConsumerLeaderElectedV1:
o.metrics.jsConsumerLeaderElected.WithLabelValues(accountName, event.Stream).Inc()
o.metrics.jsConsumerLeaderElected.WithLabelValues(accountName, event.Stream, event.Consumer).Inc()

case *advisory.JSConsumerQuorumLostV1:
o.metrics.jsConsumerQuorumLost.WithLabelValues(accountName, event.Stream).Inc()
o.metrics.jsConsumerQuorumLost.WithLabelValues(accountName, event.Stream, event.Consumer).Inc()

case *advisory.JSStreamLeaderElectedV1:
o.metrics.jsStreamLeaderElected.WithLabelValues(accountName, event.Stream).Inc()
Expand Down