-
Notifications
You must be signed in to change notification settings - Fork 103
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
Remove noisy log + prevent panic after parse #1291
Remove noisy log + prevent panic after parse #1291
Conversation
…hipping is disabled on purpose
dc8f7ac
to
beb879a
Compare
pkg/log/logshipper/logshipper.go
Outdated
if shouldEnable { | ||
parsedUrl, err := url.Parse(ls.knapsack.LogIngestServerURL()) |
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'm surprised you need this.
https://go.dev/play/p/P2NKDl7t9U_q makes it look like parsing ""
will return empty url object. But I guess I'm not sure how to best handle that. So maybe this is good enough
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.
It will return an empty URL object (and will therefore not panic on parsedUrl.String), but I figured no reason to perform the parse if we don't need to
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.
Simplified this
parsedUrl, err := url.Parse(ls.knapsack.LogIngestServerURL()) | ||
if err != nil || parsedUrl.String() == "" { | ||
if err != nil { |
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.
thank you for fixing!
Prevents filling logs with
error parsing log ingest server url, shipping disabled
when shipping is disabled on purpose via sending down an empty URL.Also prevents a potential panic trying to access
parsedUrl.String()
when parsedUrl can be nil in the event of an actual parse error.