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

feat: Add consumer created time to consumer label #214

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions collector/jsz.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func newJszCollector(system, endpoint string, servers []*CollectedServer) promet
consumerLabels = append(consumerLabels, "consumer_leader")
consumerLabels = append(consumerLabels, "is_consumer_leader")
consumerLabels = append(consumerLabels, "consumer_desc")
consumerLabels = append(consumerLabels, "consumer_created")

nc := &jszCollector{
httpClient: &http.Client{
Expand Down Expand Up @@ -290,7 +291,7 @@ func (nc *jszCollector) Collect(ch chan<- prometheus.Metric) {
}
var serverID, serverName, clusterName, jsDomain, clusterLeader string
var streamName, streamLeader string
var consumerName, consumerDesc, consumerLeader string
var consumerName, consumerDesc, consumerLeader, consumerCreated string
var isMetaLeader, isStreamLeader, isConsumerLeader string
var accountName string
var accountID string
Expand Down Expand Up @@ -358,6 +359,7 @@ func (nc *jszCollector) Collect(ch chan<- prometheus.Metric) {
// Now with the consumers.
for _, consumer := range stream.Consumer {
consumerName = consumer.Name
consumerCreated = consumer.Created.Local().Format(time.RFC3339)
if consumer.Config != nil {
consumerDesc = consumer.Config.Description
}
Expand All @@ -378,7 +380,7 @@ func (nc *jszCollector) Collect(ch chan<- prometheus.Metric) {
// Stream Labels
accountName, accountID, streamName, streamLeader, isStreamLeader,
// Consumer Labels
consumerName, consumerLeader, isConsumerLeader, consumerDesc,
consumerName, consumerLeader, isConsumerLeader, consumerDesc, consumerCreated,
)
}
ch <- consumerMetric(nc.consumerDeliveredConsumerSeq, float64(consumer.Delivered.Consumer))
Expand Down