How can i get list of my custom created core-nats subscriptions in c# #690
Replies: 8 comments 7 replies
-
yes, if the monitoring is enabled you can just query the server using HTTP as explained in nats-io/nats.go#1682 as you pointed out. Should be fairly straight forward using
I think you can get fairly detailed information using |
Beta Was this translation helpful? Give feedback.
-
AFAIR , the HTTP end-point here only reports connection on that server, so if you're in a cluster, you'll have to know the correct server to query, and have HTTP monitoring turned on too. This is also good if you don't have access to the system account. However, if you do have access, it's a bit easier. You can use req/reply along with PING to get multiple answers from all servers at once, and pick your result. Or, if you know the server you want, ask it directly and just take one response. So and pass something like this JsonSerializer.Serialize(new { |
Beta Was this translation helpful? Give feedback.
-
Thank you @mtmk , @darkwatchuk for your responses, but i just tried the connz?subs=1 & connz?subs=detailed, only to get a bunch of encoded subscriptions? "subscriptions_list": [ is this expected? I also tried the subsz?subs=true & i got many results but some contained my subscriptions Is there some settings i can do to get only user created subscriptions & not internal subscriptions? |
Beta Was this translation helpful? Give feedback.
-
The _INBOX.> subscriptions will probably be as a result of any request/response as your requests will go out with a "Reply to this INBOX", apart from setting your own INBOX so you can track these specifically, there's not much you can do I don't think as you're sending something and then subscribing on the temporary inbox. Other ones you've seen will be as a result from your subscribe to an a stream/subject (e.g. Orders.burgers). KV watchers will come across as $KV. You should be able to use the test argument on subsz for getting a list of connections using a topic. Again this works on from http and the system account. This is good for reference too... https://docs.nats.io/running-a-nats-service/configuration/sys_accounts |
Beta Was this translation helpful? Give feedback.
-
@darkwatchuk , @mtmk , there should be someway i can get list of my own custom subscriptions. I agree what you have suggested in blog works to get all subscribers, but we dont even have ability to assign any uniqueID for a CustomSubscriber. Currently i have observed that those consumers which have queueGroup property are the ones ive created, but only based on this can i be 100% sure i get only custom created consumers? Can we attach some metadata like in consumerConfig for jetstream to distingish these as custom created?
PS: Also would it be possible to get some extra detail like last activity time on subscriber. this would help a lot too |
Beta Was this translation helpful? Give feedback.
-
This seems like a valid question , I am working on a similar project where I am trying to gain more visibility for infra teams who mainly do monitoring & alerts. @mtmk @darkwatchuk is it feasible for subscribers to give more info like last message consumed by core-nats subscriber? Trying to manage this by ourselves in a microservice like environment poses a concern , since we need to keep track of individual subscribers in caches in each microservice & then query each microservice for data (not to mention the overhead for updating the cache on each message consumed ). Could this be taken as an improvement or its not feasible as per NATS design? |
Beta Was this translation helpful? Give feedback.
-
Yes, I agree. Visibility on Microservices isn't that great. I plan to add it to a monitoring platform I'm writing so have only dipped in to it a bit for viability, but not gone anywhere in depth on it at the moment. I guess that because Microservices is based on core NATS request/reply, and core NATS was built for speed and not tracking/guarantees then this is not really possible (that's a the JetStream layer), but you'd really need to get the NATS guys views on this one! |
Beta Was this translation helpful? Give feedback.
-
do you see this implemented on client side? |
Beta Was this translation helpful? Give feedback.
-
I basically want to have visibility on how many subscribtions i have created in core nats. As mentioned here https://github.com/nats-io/nats.go/discussions/1682 , we can query nats server using http requirest using system events. Is that possible to do in c#?
Is there anyway i can get to know list of custom created subscriptions for visibility ?
Beta Was this translation helpful? Give feedback.
All reactions