nats-io / natscli

The NATS Command Line Interface
Apache License 2.0
453 stars 94 forks source link

Add stream ingest rate sampling #1083

Closed jarretlavallee closed 2 weeks ago

jarretlavallee commented 1 month ago

Proposed change

Please add a nats stream rate <stream> that samples the last sequence and displays it as a rate over time.

Use case

Often it is useful to understand the rate of messages going into a stream in real time. It would be beneficial to have a command that could sample stream info to show the rate of messages being published to a stream.

Contribution

No response

ripienaar commented 2 weeks ago

I made a little thing like this

asciicast

This is kind of one size fits all, but I wonder if it would be better to instead allow for some generic uses by saing like:

$ nats s graph "State.Msgs" --rate

This would pick that specific field and draw it as a rate / second, else the absolute value. This allows you to do complex things like draw the rate of messages removed vs the "deleted" messages as some ratio or something like that.

But this would be much harder to use of course. Probably whats shown in the video is enough, there just isnt that much to graph.

What do you think @jarretlavallee and @derekcollison

jarretlavallee commented 2 weeks ago

That looks great to me. It is a much better approach than I was initially thinking. Being able to do comparisons would be very beneficial as well.

derekcollison commented 2 weeks ago

This looks really good to me..

ripienaar commented 2 weeks ago

OK give nats s graph and nats c graph a go

https://github.com/nats-io/natscli/pull/1089