-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 tailing metrics #6059
Add tailing metrics #6059
Conversation
@@ -106,6 +114,7 @@ func (t *Tailer) loop() { | |||
continue | |||
} | |||
|
|||
entriesSize += len(t.currEntry.Line) |
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.
This isn't necessarily the number of bytes, but it is consistent with how we calculate similar metrics in other components.
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.
why isn't this the number of bytes? wouldn't each character take up a byte? either way I agree keep it consistent, but maybe we want to consider an issue to fix this across the code base (as I think actually knowing bytes is helpful)
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.
Each character takes up 1+ bytes. The string 世界 has 2 characters but 6 bytes. That said it looks like Golang len
gives back bytes rather characters. I can't believe I didn't know this.
I wonder how many bugs I've caused with it?
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.
haha, go was clearly designed for dummies like me who only use English characters and still think ASCII is the only encoding out there.
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!
@@ -106,6 +114,7 @@ func (t *Tailer) loop() { | |||
continue | |||
} | |||
|
|||
entriesSize += len(t.currEntry.Line) |
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.
why isn't this the number of bytes? wouldn't each character take up a byte? either way I agree keep it consistent, but maybe we want to consider an issue to fix this across the code base (as I think actually knowing bytes is helpful)
t.seenStreamsMtx.Lock() | ||
defer t.seenStreamsMtx.Unlock() | ||
|
||
if _, ok := t.seenStreams[id]; ok { |
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.
If you're only writing once there's a lot of chances that sync.Map
will perform better. Not sure this is important in this case but at least I shared the options for later.
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
Add tail metrics.
Fixes #6027