Skip to content

Commit

Permalink
show max topics limit in heroku kafka:info
Browse files Browse the repository at this point in the history
some clusters have a max number of topics. If there is one, display it
in the CLI output like so:

```
Topics:    0 / 10 topics, see heroku kafka:topics
```
  • Loading branch information
tcrayford committed Jan 31, 2017
1 parent 0b7fef7 commit 05210bc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions commands/info.js
Expand Up @@ -29,10 +29,17 @@ function formatInfo (info) {

// we hide __consumer_offsets in topic listing; don't count it
const topicCount = cluster.topics.filter((topic) => topic !== '__consumer_offsets').length
lines.push({
name: 'Topics',
values: [`${topicCount} ${humanize.pluralize(topicCount, 'topic')}, see heroku kafka:topics`]
})
if (cluster.limits && cluster.limits.max_topics) {
lines.push({
name: 'Topics',
values: [`${topicCount} / ${cluster.limits.max_topics} ${humanize.pluralize(topicCount, 'topic')}, see heroku kafka:topics`]
})
} else {
lines.push({
name: 'Topics',
values: [`${topicCount} ${humanize.pluralize(topicCount, 'topic')}, see heroku kafka:topics`]
})
}

if (cluster.topic_prefix) {
lines.push({ name: 'Prefix', values: [cluster.topic_prefix] })
Expand Down

0 comments on commit 05210bc

Please sign in to comment.