XINFO [CONSUMERS key groupname] [GROUPS key] [STREAM key] [HELP]

Available since 5.0.0.

Time complexity: O(N) with N being the number of returned items for the subcommands CONSUMERS and GROUPS. The STREAM subcommand is O(log N) with N being the number of items in the stream.

This is an introspection command used in order to retrieve different information about the streams and associated consumer groups. Three forms are possible:

  • XINFO STREAM <key>

In this form the command returns general information about the stream stored at the specified key.

  1. > XINFO STREAM mystream
  2. 1) length
  3. 2) (integer) 2
  4. 3) radix-tree-keys
  5. 4) (integer) 1
  6. 5) radix-tree-nodes
  7. 6) (integer) 2
  8. 7) groups
  9. 8) (integer) 2
  10. 9) last-generated-id
  11. 10) 1538385846314-0
  12. 11) first-entry
  13. 12) 1) 1538385820729-0
  14. 2) 1) "foo"
  15. 2) "bar"
  16. 13) last-entry
  17. 14) 1) 1538385846314-0
  18. 2) 1) "field"
  19. 2) "value"

In the above example you can see that the reported information are the number of elements of the stream, details about the radix tree representing the stream mostly useful for optimization and debugging tasks, the number of consumer groups associated with the stream, the last generated ID that may not be the same as the last entry ID in case some entry was deleted. Finally the full first and last entry in the stream are shown, in order to give some sense about what is the stream content.

  • XINFO GROUPS <key>

In this form we just get as output all the consumer groups associated with the stream:

  1. > XINFO GROUPS mystream
  2. 1) 1) name
  3. 2) "mygroup"
  4. 3) consumers
  5. 4) (integer) 2
  6. 5) pending
  7. 6) (integer) 2
  8. 2) 1) name
  9. 2) "some-other-group"
  10. 3) consumers
  11. 4) (integer) 1
  12. 5) pending
  13. 6) (integer) 0

For each consumer group listed the command also shows the number of consumers known in that group and the pending messages (delivered but not yet acknowledged) in that group.

  • XINFO CONSUMERS <key> <group>

Finally it is possible to get the list of every consumer in a specific consumer group:

  1. > XINFO CONSUMERS mystream mygroup
  2. 1) 1) name
  3. 2) "Alice"
  4. 3) pending
  5. 4) (integer) 1
  6. 5) idle
  7. 6) (integer) 9104628
  8. 2) 1) name
  9. 2) "Bob"
  10. 3) pending
  11. 4) (integer) 1
  12. 5) idle
  13. 6) (integer) 83841983

We can see the idle time in milliseconds (last field) together with the consumer name and the number of pending messages for this specific consumer.

Note that you should not rely on the fields exact position, nor on the number of fields, new fields may be added in the future. So a well behaving client should fetch the whole list, and report it to the user, for example, as a dictionary data structure. Low level clients such as C clients where the items will likely be reported back in a linear array should document that the order is undefined.

Finally it is possible to get help from the command, in case the user can't remember the exact syntax, by using the HELP subcommand:

  1. > XINFO HELP
  2. 1) XINFO <subcommand> arg arg ... arg. Subcommands are:
  3. 2) CONSUMERS <key> <groupname> -- Show consumer groups of group <groupname>.
  4. 3) GROUPS <key> -- Show the stream consumer groups.
  5. 4) STREAM <key> -- Show information about the stream.
  6. 5) HELP