Skip to content
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

Merged

Conversation

MasslessParticle
Copy link
Contributor

Add tail metrics.

Fixes #6027

@MasslessParticle MasslessParticle requested a review from a team as a code owner April 29, 2022 19:49
@@ -106,6 +114,7 @@ func (t *Tailer) loop() {
continue
}

entriesSize += len(t.currEntry.Line)
Copy link
Contributor Author

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.

Copy link
Collaborator

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)

Copy link
Contributor Author

@MasslessParticle MasslessParticle Apr 29, 2022

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?

Copy link
Collaborator

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.

Copy link
Collaborator

@trevorwhitney trevorwhitney left a 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)
Copy link
Collaborator

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 {
Copy link
Contributor

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.

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional metrics for monitoring tailer component
3 participants