Error 404 when using pulsar admin API to get topic stats

88 views Asked by At

I am trying to get the stats of all the topics in a namespace by using the pulsar admin API. I am using Pulser 2.7.3. I first use this request to get the name of all the topics in the namespace : GET /admin/v2/:schema/:tenant/:namespace/getList, which doesn't work but if I remove the "getList" it works.

Then for each topic I use the request indicated in the pulsar documentation to get the stats: GET /admin/v2/:schema/:tenant/:namespace/:topic/stats/getStats And I get a 404 error. I have checked multiple times, and there isn't any typo or error in the schema, tenant, namespace and topic. I tried by modifying slightly the request (removing the "getStats", etc..) but it's still not working.

Any clues what might be causing the error?

1

There are 1 answers

2
Daniel Nesaraj On

The relevant admin API is documented at: https://pulsar.apache.org/admin-rest-api/?version=2.7.3

The former API you mentioned to list topics under a namespace gives you the topic name in [persistent|non-persistent]://tenant/namespace/topic format from which you need to extract only the topic part and supply it to the GET /admin/v2/{persistent|non-persistent}/:tenant/:namespace/:topic/stats/ API. That should give you the topic-wise stats. (Tested against pulsar 2.7.2)

Note: in case of partitioned topics, each partition is going to show up as separate topic.