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 log verbosity #2455

Merged
merged 3 commits into from
Aug 22, 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
6 changes: 3 additions & 3 deletions internal/framework/events/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ func (el *EventLoop) Start(ctx context.Context) error {
el.currentBatchID++
batchLogger := el.logger.WithName("eventHandler").WithValues("batchID", el.currentBatchID)

batchLogger.Info("Handling events from the batch", "total", len(batch))
batchLogger.V(1).Info("Handling events from the batch", "total", len(batch))

el.handler.HandleEventBatch(ctx, batchLogger, batch)

batchLogger.Info("Finished handling the batch")
batchLogger.V(1).Info("Finished handling the batch")
handlingDone <- struct{}{}
}(el.currentBatch)
}
Expand Down Expand Up @@ -120,7 +120,7 @@ func (el *EventLoop) Start(ctx context.Context) error {
// Add the event to the current batch.
el.nextBatch = append(el.nextBatch, e)

el.logger.Info(
el.logger.V(1).Info(
"added an event to the next batch",
"type", fmt.Sprintf("%T", e),
"total", len(el.nextBatch),
Expand Down
7 changes: 6 additions & 1 deletion internal/mode/static/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@
}

cfg.Logger.Info("Starting manager")
go func() {
<-ctx.Done()
cfg.Logger.Info("Shutting down")
}()

Check warning on line 288 in internal/mode/static/manager.go

View check run for this annotation

Codecov / codecov/patch

internal/mode/static/manager.go#L285-L288

Added lines #L285 - L288 were not covered by tests

return mgr.Start(ctx)
}

Expand All @@ -306,7 +311,7 @@
func createManager(cfg config.Config, nginxChecker *nginxConfiguredOnStartChecker) (manager.Manager, error) {
options := manager.Options{
Scheme: scheme,
Logger: cfg.Logger,
Logger: cfg.Logger.V(1),

Check warning on line 314 in internal/mode/static/manager.go

View check run for this annotation

Codecov / codecov/patch

internal/mode/static/manager.go#L314

Added line #L314 was not covered by tests
Metrics: getMetricsOptions(cfg.MetricsConfig),
// Note: when the leadership is lost, the manager will return an error in the Start() method.
// However, it will not wait for any Runnable it starts to finish, meaning any in-progress operations
Expand Down
4 changes: 2 additions & 2 deletions internal/mode/static/nginx/file/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (m *ManagerImpl) ReplaceFiles(files []File) error {
return fmt.Errorf("failed to delete file %q: %w", path, err)
}

m.logger.Info("Deleted file", "path", path)
m.logger.V(1).Info("Deleted file", "path", path)
}

// In some cases, NGINX reads files in runtime, like a JWK. If you remove such file, NGINX will fail
Expand All @@ -118,7 +118,7 @@ func (m *ManagerImpl) ReplaceFiles(files []File) error {
}

m.lastWrittenPaths = append(m.lastWrittenPaths, file.Path)
m.logger.Info("Wrote file", "path", file.Path)
m.logger.V(1).Info("Wrote file", "path", file.Path)
}

return nil
Expand Down
2 changes: 2 additions & 0 deletions tests/framework/ngf.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
"--namespace", cfg.Namespace,
"--wait",
"--set", "nginxGateway.productTelemetry.enable=false",
"--set", "nginxGateway.config.logging.level=debug",
}
if cfg.ChartVersion != "" {
args = append(args, "--version", cfg.ChartVersion)
Expand Down Expand Up @@ -95,6 +96,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
"--namespace", cfg.Namespace,
"--wait",
"--set", "nginxGateway.productTelemetry.enable=false",
"--set", "nginxGateway.config.logging.level=debug",
}
if cfg.ChartVersion != "" {
args = append(args, "--version", cfg.ChartVersion)
Expand Down
Loading