Skip to content

Conversation

@zymap
Copy link
Member

@zymap zymap commented Sep 9, 2019

Add command topic stats, internal-stats, partition-stats

  • topic stats *
➜  pulsarctl git:(topic-stats) ✗ ./pulsarctl topic stats -h
USED FOR:
    This command is used for getting the stats for an existing topic and its connected producers and consumers. (All the rates are computed over a 1 minute window and are relative the last completed 1 minute period)

REQUIRED PERMISSION:
    This command requires namespace admin permissions.

EXAMPLES:
    #Get the non-partitioned topic <topic-name> stats
    pulsarctl topic stats <topic-name>

    #Get the partitioned topic <topic-name> stats
    pulsarctl topic stats --partition <topic-name>

    #Get the partitioned topic <topic-name> stats and per partition stats
    pulsarctl topic stats --partition --per-partition <topic-name>

OUTPUT:
    #Get the non-partitioned topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "Disabled"
    }

    #Get the partitioned topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "",
      "metadata": {
        "partitions": 1
      },
      "partitions": {}
    }

    #Get the partitioned topic stats and per partition topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "",
      "metadata": {
        "partitions": 1
      },
      "partitions": {
        "<topic-name>": {
          "msgRateIn": 0,
          "msgRateOut": 0,
          "msgThroughputIn": 0,
          "msgThroughputOut": 0,
          "averageMsgSize": 0,
          "storageSize": 0,
          "publishers": [],
          "subscriptions": {},
          "replication": {},
          "deduplicationStatus": ""
        }
      }
    }

    #the topic name is not specified
    [✖]  only one argument is allowed to be used as a name

    #the specified topic is not exist or the specified topic is a partitioned-topic and you don't specified --partition or the specified topic is a non-partitioned topic and you specified --partition
    code: 404 reason: Topic not found

    #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic>
    [✖]  Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic>

    #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic>
    [✖]  Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic>

    #the topic name is not in the format of <tenant>/<namespace>/<topic>
    [✖]  Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic>

    #the namespace name is not in the format of <tenant>/<namespace>
    [✖]  The complete name of namespace is invalid. complete name : <namespace-complete-name>

    #the tenant name and(or) namespace name is empty
    [✖]  Invalid tenant or namespace. [<tenant>/<namespace>]

    #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%)  is allowed
    [✖]  Tenant name include unsupported special chars. tenant : [<namespace>]

    #the namespace name contains unsupported special chars. the  alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed
    [✖]  Namespace name include unsupported special chars. namespace : [<namespace>]

Usage: pulsarctl topics stats [flags]

  • topic internal-stats *
➜  pulsarctl-yong git:(topic-stats) ./pulsarctl topic internal-stats -h
USED FOR:
    This command is used for getting the internal stats for an existing non-partitioned topic.

REQUIRED PERMISSION:
    This command requires namespace admin permissions.

EXAMPLES:
    #Get internal stats for an existing non-partitioned-topic <topic-name>
    pulsarctl topic internal-stats <topic-name>

OUTPUT:
    #normal output
    {
      "entriesAddedCounter": 0,
      "numberOfEntries": 0,
      "totalSize": 0,
      "currentLedgerEntries": 0,
      "currentLedgerSize": 0,
      "lastLedgerCreatedTimestamp": "",
      "lastLedgerCreationFailureTimestamp": "",
      "waitingCursorsCount": 0,
      "pendingAddEntriesCount": 0,
      "lastConfirmedEntry": "",
      "state": "",
      "ledgers": [
        {
          "ledgerId": 0,
          "entries": 0,
          "size": 0,
          "offloaded": false
        }
      ],
      "cursors": {}
    }

    #the topic name is not specified
    [✖]  only one argument is allowed to be used as a name

    #the specified topic is not exist or the specified topic is a partitioned topic
    [✖]  code: 404 reason: Topic not found

    #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic>
    [✖]  Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic>

    #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic>
    [✖]  Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic>

    #the topic name is not in the format of <tenant>/<namespace>/<topic>
    [✖]  Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic>

    #the namespace name is not in the format of <tenant>/<namespace>
    [✖]  The complete name of namespace is invalid. complete name : <namespace-complete-name>

    #the tenant name and(or) namespace name is empty
    [✖]  Invalid tenant or namespace. [<tenant>/<namespace>]

    #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%)  is allowed
    [✖]  Tenant name include unsupported special chars. tenant : [<namespace>]

    #the namespace name contains unsupported special chars. the  alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed
    [✖]  Namespace name include unsupported special chars. namespace : [<namespace>]

Usage: pulsarctl topics internal-stats [flags]

Aliases: internal-stats,

@zymap zymap requested review from sijie and wolfstudy September 9, 2019 14:36
@zymap zymap self-assigned this Sep 9, 2019
@zymap zymap added this to the 0.0.1 milestone Sep 9, 2019
@zymap zymap changed the base branch from topic-partitioned-commands to master September 11, 2019 06:50
@sijie
Copy link
Member

sijie commented Sep 15, 2019

please rebase and fix CI

@zymap
Copy link
Member Author

zymap commented Sep 16, 2019

@sijie PTAL

@zymap zymap force-pushed the topic-stats branch 2 times, most recently from 3df4dbe to 3632476 Compare September 17, 2019 02:45
@zymap
Copy link
Member Author

zymap commented Sep 17, 2019

@sijie PTAL

@sijie sijie merged commit ff038da into master Sep 17, 2019
@sijie sijie deleted the topic-stats branch September 17, 2019 12:56
tisonkun pushed a commit to tisonkun/pulsar-client-go that referenced this pull request Aug 15, 2023
Add command topic `stats`, `internal-stats`, `partition-stats`

* topic stats *
```
➜  pulsarctl git:(topic-stats) ✗ ./pulsarctl topic stats -h
USED FOR:
    This command is used for getting the stats for an existing topic and its connected producers and consumers. (All the rates are computed over a 1 minute window and are relative the last completed 1 minute period)

REQUIRED PERMISSION:
    This command requires namespace admin permissions.

EXAMPLES:
    #Get the non-partitioned topic <topic-name> stats
    pulsarctl topic stats <topic-name>

    #Get the partitioned topic <topic-name> stats
    pulsarctl topic stats --partition <topic-name>

    #Get the partitioned topic <topic-name> stats and per partition stats
    pulsarctl topic stats --partition --per-partition <topic-name>

OUTPUT:
    #Get the non-partitioned topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "Disabled"
    }

    #Get the partitioned topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "",
      "metadata": {
        "partitions": 1
      },
      "partitions": {}
    }

    #Get the partitioned topic stats and per partition topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "",
      "metadata": {
        "partitions": 1
      },
      "partitions": {
        "<topic-name>": {
          "msgRateIn": 0,
          "msgRateOut": 0,
          "msgThroughputIn": 0,
          "msgThroughputOut": 0,
          "averageMsgSize": 0,
          "storageSize": 0,
          "publishers": [],
          "subscriptions": {},
          "replication": {},
          "deduplicationStatus": ""
        }
      }
    }

    #the topic name is not specified
    [✖]  only one argument is allowed to be used as a name

    #the specified topic is not exist or the specified topic is a partitioned-topic and you don't specified --partition or the specified topic is a non-partitioned topic and you specified --partition
    code: 404 reason: Topic not found

    #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic>
    [✖]  Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic>

    #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic>
    [✖]  Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic>

    #the topic name is not in the format of <tenant>/<namespace>/<topic>
    [✖]  Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic>

    #the namespace name is not in the format of <tenant>/<namespace>
    [✖]  The complete name of namespace is invalid. complete name : <namespace-complete-name>

    #the tenant name and(or) namespace name is empty
    [✖]  Invalid tenant or namespace. [<tenant>/<namespace>]

    #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%)  is allowed
    [✖]  Tenant name include unsupported special chars. tenant : [<namespace>]

    #the namespace name contains unsupported special chars. the  alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed
    [✖]  Namespace name include unsupported special chars. namespace : [<namespace>]

Usage: pulsarctl topics stats [flags]

```

* topic internal-stats *
```
➜  pulsarctl-yong git:(topic-stats) ./pulsarctl topic internal-stats -h
USED FOR:
    This command is used for getting the internal stats for an existing non-partitioned topic.

REQUIRED PERMISSION:
    This command requires namespace admin permissions.

EXAMPLES:
    #Get internal stats for an existing non-partitioned-topic <topic-name>
    pulsarctl topic internal-stats <topic-name>

OUTPUT:
    #normal output
    {
      "entriesAddedCounter": 0,
      "numberOfEntries": 0,
      "totalSize": 0,
      "currentLedgerEntries": 0,
      "currentLedgerSize": 0,
      "lastLedgerCreatedTimestamp": "",
      "lastLedgerCreationFailureTimestamp": "",
      "waitingCursorsCount": 0,
      "pendingAddEntriesCount": 0,
      "lastConfirmedEntry": "",
      "state": "",
      "ledgers": [
        {
          "ledgerId": 0,
          "entries": 0,
          "size": 0,
          "offloaded": false
        }
      ],
      "cursors": {}
    }

    #the topic name is not specified
    [✖]  only one argument is allowed to be used as a name

    #the specified topic is not exist or the specified topic is a partitioned topic
    [✖]  code: 404 reason: Topic not found

    #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic>
    [✖]  Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic>

    #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic>
    [✖]  Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic>

    #the topic name is not in the format of <tenant>/<namespace>/<topic>
    [✖]  Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic>

    #the namespace name is not in the format of <tenant>/<namespace>
    [✖]  The complete name of namespace is invalid. complete name : <namespace-complete-name>

    #the tenant name and(or) namespace name is empty
    [✖]  Invalid tenant or namespace. [<tenant>/<namespace>]

    #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%)  is allowed
    [✖]  Tenant name include unsupported special chars. tenant : [<namespace>]

    #the namespace name contains unsupported special chars. the  alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed
    [✖]  Namespace name include unsupported special chars. namespace : [<namespace>]

Usage: pulsarctl topics internal-stats [flags]

Aliases: internal-stats,
```
tisonkun pushed a commit to apache/pulsar-client-go that referenced this pull request Aug 16, 2023
Add command topic `stats`, `internal-stats`, `partition-stats`

* topic stats *
```
➜  pulsarctl git:(topic-stats) ✗ ./pulsarctl topic stats -h
USED FOR:
    This command is used for getting the stats for an existing topic and its connected producers and consumers. (All the rates are computed over a 1 minute window and are relative the last completed 1 minute period)

REQUIRED PERMISSION:
    This command requires namespace admin permissions.

EXAMPLES:
    #Get the non-partitioned topic <topic-name> stats
    pulsarctl topic stats <topic-name>

    #Get the partitioned topic <topic-name> stats
    pulsarctl topic stats --partition <topic-name>

    #Get the partitioned topic <topic-name> stats and per partition stats
    pulsarctl topic stats --partition --per-partition <topic-name>

OUTPUT:
    #Get the non-partitioned topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "Disabled"
    }

    #Get the partitioned topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "",
      "metadata": {
        "partitions": 1
      },
      "partitions": {}
    }

    #Get the partitioned topic stats and per partition topic stats
    {
      "msgRateIn": 0,
      "msgRateOut": 0,
      "msgThroughputIn": 0,
      "msgThroughputOut": 0,
      "averageMsgSize": 0,
      "storageSize": 0,
      "publishers": [],
      "subscriptions": {},
      "replication": {},
      "deduplicationStatus": "",
      "metadata": {
        "partitions": 1
      },
      "partitions": {
        "<topic-name>": {
          "msgRateIn": 0,
          "msgRateOut": 0,
          "msgThroughputIn": 0,
          "msgThroughputOut": 0,
          "averageMsgSize": 0,
          "storageSize": 0,
          "publishers": [],
          "subscriptions": {},
          "replication": {},
          "deduplicationStatus": ""
        }
      }
    }

    #the topic name is not specified
    [✖]  only one argument is allowed to be used as a name

    #the specified topic is not exist or the specified topic is a partitioned-topic and you don't specified --partition or the specified topic is a non-partitioned topic and you specified --partition
    code: 404 reason: Topic not found

    #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic>
    [✖]  Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic>

    #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic>
    [✖]  Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic>

    #the topic name is not in the format of <tenant>/<namespace>/<topic>
    [✖]  Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic>

    #the namespace name is not in the format of <tenant>/<namespace>
    [✖]  The complete name of namespace is invalid. complete name : <namespace-complete-name>

    #the tenant name and(or) namespace name is empty
    [✖]  Invalid tenant or namespace. [<tenant>/<namespace>]

    #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%)  is allowed
    [✖]  Tenant name include unsupported special chars. tenant : [<namespace>]

    #the namespace name contains unsupported special chars. the  alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed
    [✖]  Namespace name include unsupported special chars. namespace : [<namespace>]

Usage: pulsarctl topics stats [flags]

```

* topic internal-stats *
```
➜  pulsarctl-yong git:(topic-stats) ./pulsarctl topic internal-stats -h
USED FOR:
    This command is used for getting the internal stats for an existing non-partitioned topic.

REQUIRED PERMISSION:
    This command requires namespace admin permissions.

EXAMPLES:
    #Get internal stats for an existing non-partitioned-topic <topic-name>
    pulsarctl topic internal-stats <topic-name>

OUTPUT:
    #normal output
    {
      "entriesAddedCounter": 0,
      "numberOfEntries": 0,
      "totalSize": 0,
      "currentLedgerEntries": 0,
      "currentLedgerSize": 0,
      "lastLedgerCreatedTimestamp": "",
      "lastLedgerCreationFailureTimestamp": "",
      "waitingCursorsCount": 0,
      "pendingAddEntriesCount": 0,
      "lastConfirmedEntry": "",
      "state": "",
      "ledgers": [
        {
          "ledgerId": 0,
          "entries": 0,
          "size": 0,
          "offloaded": false
        }
      ],
      "cursors": {}
    }

    #the topic name is not specified
    [✖]  only one argument is allowed to be used as a name

    #the specified topic is not exist or the specified topic is a partitioned topic
    [✖]  code: 404 reason: Topic not found

    #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic>
    [✖]  Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic>

    #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic>
    [✖]  Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic>

    #the topic name is not in the format of <tenant>/<namespace>/<topic>
    [✖]  Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic>

    #the namespace name is not in the format of <tenant>/<namespace>
    [✖]  The complete name of namespace is invalid. complete name : <namespace-complete-name>

    #the tenant name and(or) namespace name is empty
    [✖]  Invalid tenant or namespace. [<tenant>/<namespace>]

    #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%)  is allowed
    [✖]  Tenant name include unsupported special chars. tenant : [<namespace>]

    #the namespace name contains unsupported special chars. the  alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed
    [✖]  Namespace name include unsupported special chars. namespace : [<namespace>]

Usage: pulsarctl topics internal-stats [flags]

Aliases: internal-stats,
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants