-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flags to the sub
command
#1059
Conversation
cli/sub_command.go
Outdated
} else { | ||
fmt.Printf("[#%d] Received JetStream message: consumer: %s > %s / subject: %s / delivered: %d / consumer seq: %d / stream seq: %d\n", ctr, info.Stream(), info.Consumer(), msg.Subject, info.Delivered(), info.ConsumerSequence(), info.StreamSequence()) | ||
fmt.Printf("[#%d]%s Received JetStream message: consumer: %s > %s / subject: %s / delivered: %d / consumer seq: %d / stream seq: %d\n", ctr, timeStamp, info.Stream(), info.Consumer(), msg.Subject, info.Delivered(), info.ConsumerSequence(), info.StreamSequence()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be confusing here since the message itself have a timestamp from js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to me, delta-time can not be confused and even with timestamps you can measure the difference between the time the message was received and the timestamp in the message itself. Also if c.jetStream is false then there is no other timestamp printed so no confusion possible.
But I'm not strongly attached so I can remove it if c.jetStream is true if you want that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I'd say lets print it only if its delta, that would be useful but haing timestamp here thats different from the message timestamp (which we arent showing) would definitely be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont follow, this one on line 566 still prints timestamp unconditionally
And we're duplicating the lines here just for the timestamp.
Lets just remove timestamp and delta completely from all jetstream related messages that seems the easiest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it from just the JS line that had a (JS) time stamp only (there's no JS data time stamp printed in the case c.jetStream is false).
I also thing in non-JS mode ( c.jetStream is false) it would look strange to not have the timestamp printed just because the message happens to be a JS message (!).
But if you prefer no timestamps at all for the JS stuff I just did that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont mind it on the jetstream ones if its done as I requested, but if I cant have that I'd rather just not have it at all.
So for example, down in the PR we print a JS ACK subject where we have both the timestamp of the message and still the timestamp. This is confusing and what I keep asking to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I had mis-understood what you were asking for then. How about how it is now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pleasse remove all timeStamp
from an line anywhere that mentions jetstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so removed not just if c.jetStream
cli/sub_command.go
Outdated
} | ||
|
||
prettyPrintMsg(msg, c.headersOnly, c.translate) | ||
if !c.sOnly { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather do if c.sOnly { return }
and then dont create a big nested block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cli/sub_command.go
Outdated
prettyPrintMsg(msg, c.headersOnly, c.translate) | ||
if !c.sOnly { | ||
return | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of returning early is so that this else is not needed and so the code below remains unchanged and the extra indent isnt needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
- `--subjects-only` only prints the subject for each message received - `--timestamp` adds a time stamp of when the message is received - `--delta-time` adds a time since the start of the command of when the message is received Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds the following flags to
nats sub
:--subjects-only
only prints the subject for each message received--timestamp
adds a time stamp of when the message is received--delta-time
adds a time since the start of the command of when the message is received