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

Fix ConsumersOpened counter not incremented when use multitopic or regexp consumer #619

Merged
Merged
Changes from 1 commit
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
12 changes: 2 additions & 10 deletions pulsar/consumer_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func newConsumer(client *client, options ConsumerOptions) (Consumer, error) {
return nil, err
}
topic = tns[0].Name
return topicSubscribe(client, options, topic, messageCh, dlq, rlq)
return newInternalConsumer(client, options, topic, messageCh, dlq, rlq, false)
}

if len(options.Topics) > 1 {
Expand Down Expand Up @@ -212,6 +212,7 @@ func newInternalConsumer(client *client, options ConsumerOptions, topic string,
}
consumer.stopDiscovery = consumer.runBackgroundPartitionDiscovery(duration)

consumer.metrics.ConsumersOpened.Inc()
return consumer, nil
}

Expand Down Expand Up @@ -376,15 +377,6 @@ func (c *consumer) internalTopicSubscribeToPartitions() error {
return nil
}

func topicSubscribe(client *client, options ConsumerOptions, topic string,
messageCh chan ConsumerMessage, dlqRouter *dlqRouter, retryRouter *retryRouter) (Consumer, error) {
c, err := newInternalConsumer(client, options, topic, messageCh, dlqRouter, retryRouter, false)
if err == nil {
c.metrics.ConsumersOpened.Inc()
}
return c, err
}

func (c *consumer) Subscription() string {
return c.options.SubscriptionName
}
Expand Down