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

skip aws logging on successful upload #762

Merged
merged 5 commits into from
Aug 26, 2024
Merged

skip aws logging on successful upload #762

merged 5 commits into from
Aug 26, 2024

Conversation

frostbyte73
Copy link
Member

No description provided.

@frostbyte73 frostbyte73 requested a review from a team as a code owner August 26, 2024 16:24
Copy link

@boks1971 boks1971 left a comment

Choose a reason for hiding this comment

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

Is that slice going to become too large? Should we put a limit on number of messages?

Copy link

@boks1971 boks1971 left a comment

Choose a reason for hiding this comment

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

Also, I guess all of them will have the same timestamp in the logs. Is that okay?

@frostbyte73
Copy link
Member Author

Is that slice going to become too large? Should we put a limit on number of messages?

That is probably a good idea. I have no idea how many logs they put out but it seems to be a lot

@frostbyte73 frostbyte73 merged commit ea6112c into main Aug 26, 2024
8 checks passed
@frostbyte73 frostbyte73 deleted the aws-logging branch August 26, 2024 17:42
func (l *S3Logger) Log(args ...interface{}) {
msg := "aws sdk:"
for range len(args) {
msg += " %v"
Copy link
Contributor

Choose a reason for hiding this comment

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

Tin my experience, building log strings this way cause enough men copies that it can have a significant performance impact. strings.Builder should be more efficient


l.mu.Lock()
if len(l.msgs) >= 10 {
l.msgs = append(l.msgs[1:], msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

If my understanding of go slices is correct, this will cause the array backing to slice to grow indefinitely until the logger gets destroyed as the beginning of the array will never be reclaimed. We may want to either copy the leftover part of the slice to the beginning of the array, or use ring buffer implementation?

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

Successfully merging this pull request may close these issues.

3 participants