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

Reduce the amount of configuration logging, and make it line-delimeted friendly #4505

Merged
merged 3 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/gatewayapi/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@
// Publish the IRs.
// Also validate the ir before sending it.
for key, val := range result.InfraIR {
r.Logger.WithValues("infra-ir", key).Info(val.JSONString())
Copy link
Contributor

@arkodg arkodg Oct 25, 2024

Choose a reason for hiding this comment

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

shouldnt this be changed to .Debug ? and they won't show up because the default logging is Info

// DefaultEnvoyGatewayLogging returns a new EnvoyGatewayLogging with default configuration parameters.

cc @zirain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

r.Logger embeds a logr.Logger. That interface doesn't believe in named levels beyond Info() and Error(), but it supports arbitrary levels of verbosity with V().

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, that's right. there's no Debug in logr.Logger

Copy link
Contributor

Choose a reason for hiding this comment

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

level description
v=0 Generally useful for this to always be visible to a cluster operator.
v=1 A reasonable default log level if you don’t want verbosity.
v=2 Useful steady state information about the service and important log messages that may correlate to significant changes in the system.This is the recommended default log level for most systems.
v=3 Extended information about changes.
v=4 Debug level verbosity.
v=5 Trace level verbosity.
v=6 Display requested resources.
v=7 Display HTTP request headers.
v=8 Display HTTP request contents.
v=9 Display HTTP request contents without truncation of contents.

if we want something like debug, should change the level to 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to switch this to 4; it was previously always-on, so I wasn't sure how much it should be hidden, but 4 makes sense to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to 4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

if vlog := r.Logger.V(4); vlog.Enabled() {
vlog.WithValues("infra-ir", key).Info(val.JSONString())
}

Check warning on line 178 in internal/gatewayapi/runner/runner.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/runner/runner.go#L176-L178

Added lines #L176 - L178 were not covered by tests
if err := val.Validate(); err != nil {
r.Logger.Error(err, "unable to validate infra ir, skipped sending it")
errChan <- err
Expand All @@ -184,7 +186,9 @@
}

for key, val := range result.XdsIR {
r.Logger.WithValues("xds-ir", key).Info(val.JSONString())
if vlog := r.Logger.V(4); vlog.Enabled() {
vlog.WithValues("xds-ir", key).Info(val.JSONString())
}

Check warning on line 191 in internal/gatewayapi/runner/runner.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/runner/runner.go#L189-L191

Added lines #L189 - L191 were not covered by tests
if err := val.Validate(); err != nil {
r.Logger.Error(err, "unable to validate xds ir, skipped sending it")
errChan <- err
Expand Down
2 changes: 1 addition & 1 deletion internal/ir/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}

func (i *Infra) JSONString() string {
j, _ := json.MarshalIndent(i, "", "\t")
j, _ := json.Marshal(i)

Check warning on line 39 in internal/ir/infra.go

View check run for this annotation

Codecov / codecov/patch

internal/ir/infra.go#L39

Added line #L39 was not covered by tests
return string(j)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
}

func (x *Xds) JSONString() string {
j, _ := json.MarshalIndent(x.Printable(), "", "\t")
j, _ := json.Marshal(x.Printable())

Check warning on line 184 in internal/ir/xds.go

View check run for this annotation

Codecov / codecov/patch

internal/ir/xds.go#L184

Added line #L184 was not covered by tests
return string(j)
}

Expand Down
2 changes: 1 addition & 1 deletion release-notes/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ new features: |

# Fixes for bugs identified in previous versions.
bug fixes: |
Add a bug fix here
Only log endpoint configuration in verbose logging mode (`-v 4` or higher)

# Enhancements that improve performance.
performance improvements: |
Expand Down