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

Use logger with formatter #4747

Merged
merged 2 commits into from
Jan 20, 2024
Merged

Use logger with formatter #4747

merged 2 commits into from
Jan 20, 2024

Conversation

andrewwdye
Copy link
Contributor

@andrewwdye andrewwdye commented Jan 19, 2024

Why are the changes needed?

Fixed a bunch of places where we weren't using the correct logger function, i.e., logger.Error(...) instead of logger.Errorf(...)

Before

❯ rg "logger.(Fatal|Error|Info|Warn|Debug)\(" -g '!flyte' | rg "%"
flytepropeller/pkg/controller/nodes/executor.go:				logger.Warn(ctx, "failed to save recovered checkpoint uri for [%+v]: [%+v]",
flytepropeller/pkg/controller/nodes/task/backoff/handler.go:	logger.Debug(ctx, "BackOff params [BackOffBaseSecond: %v] [BackOffExponent: %v] [MaxBackOffDuration: %v]",
flytepropeller/pkg/controller/nodes/subworkflow/launchplan/admin.go:		logger.Info(ctx, "Failed to add ExecID [%v] to auto refresh cache", executionID)
flytepropeller/cmd/kubectl-flyte/cmd/root.go:		logger.Error(context.TODO(), "Error in initializing: %v", err)
flytestdlib/random/weighted_random_list.go:			logger.Debug(ctx, "ignoring entry due to empty weight %v", e)
flytestdlib/storage/protobuf_store.go:			logger.Warn(ctx, "Failed to close reference [%v]. Error: %v", reference, err)
flyteadmin/scheduler/executor/executor_impl.go:		logger.Error(ctx, "failed to generate execution identifier for schedule %+v due to %v", s, err)
flyteadmin/scheduler/executor/executor_impl.go:			logger.Error(ctx, "failed to create execution create request %+v due to %v", executionRequest, err)
flyteadmin/scheduler/executor/executor_impl.go:		logger.Error(ctx, "failed to create execution create request %+v due to %v after all retries", executionRequest, err)
flyteadmin/tests/execution_test.go:		logger.Fatal(ctx, "Failed to open DB connection due to %v", err)
flyteadmin/tests/bootstrap.go:		logger.Fatal(ctx, "Failed to open DB connection due to %v", err)
flyteadmin/tests/bootstrap.go:		logger.Fatal(ctx, "Failed to open DB connection due to %v", err)
flyteadmin/dataproxy/service.go:				logger.Debug(ctx, "File already exists at location [%v] but hashes do not match", knownLocation)
flyteadmin/dataproxy/service.go:			logger.Debug(ctx, "File already exists at location [%v] but allowing rewrite", knownLocation)
flytecopilot/cmd/root.go:		logger.Error(context.TODO(), "Error in initializing: %v", err)
flyteidl/clients/go/admin/pkce/auth_flow_orchestrator.go:			logger.Fatal(ctx, "Couldn't start the callback http server on host %v due to %v", redirectURL.Host,
flyteplugins/go/tasks/plugins/webapi/athena/plugin.go:	logger.Info(ctx, "Deleted query execution [%v]", resp)
flyteplugins/go/tasks/plugins/webapi/snowflake/plugin.go:	logger.Info(ctx, "Deleted query execution [%v]", resp)
flyteplugins/go/tasks/plugins/webapi/databricks/plugin.go:	logger.Info(ctx, "Deleted query execution [%v]", resp)
flyteplugins/go/tasks/plugins/webapi/bigquery/plugin.go:	logger.Info(ctx, "Cancelled job [%s]", formatJobReference(resourceMeta.JobReference))
flyteplugins/go/tasks/plugins/array/awsbatch/jobs_store.go:					logger.Warn(ctx, "Received an update for unrequested job id [%v]", jobDetail.JobId)
flyteplugins/go/tasks/plugins/array/awsbatch/monitor.go:		logger.Info(ctx, "Job not found in cache, adding it. [%v]", jobName)
flyteplugins/go/tasks/pluginmachinery/ioutils/paths.go:		logger.Error(context.Background(), "Failed to construct path. Base[%v] Error: %v", base, err)

After

❯ rg "logger.(Fatal|Error|Info|Warn|Debug)\(" -g '!flyte' | rg "%"

How was this patch tested?

  • Run existing unit tests

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Signed-off-by: Andrew Dye <[email protected]>
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. housekeeping Issues that help maintain flyte and keep it tech-debt free labels Jan 19, 2024
Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (2866d5a) 58.18% compared to head (3526294) 58.18%.
Report is 2 commits behind head on master.

Files Patch % Lines
flyteadmin/scheduler/executor/executor_impl.go 0.00% 3 Missing ⚠️
flyteadmin/dataproxy/service.go 50.00% 1 Missing ⚠️
...eplugins/go/tasks/pluginmachinery/ioutils/paths.go 0.00% 1 Missing ⚠️
...gins/go/tasks/plugins/array/awsbatch/jobs_store.go 0.00% 1 Missing ⚠️
...teplugins/go/tasks/plugins/webapi/athena/plugin.go 0.00% 1 Missing ⚠️
...plugins/go/tasks/plugins/webapi/bigquery/plugin.go 0.00% 1 Missing ⚠️
...ugins/go/tasks/plugins/webapi/databricks/plugin.go 0.00% 1 Missing ⚠️
...lugins/go/tasks/plugins/webapi/snowflake/plugin.go 0.00% 1 Missing ⚠️
flytepropeller/pkg/controller/nodes/executor.go 0.00% 1 Missing ⚠️
...g/controller/nodes/subworkflow/launchplan/admin.go 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4747      +/-   ##
==========================================
- Coverage   58.18%   58.18%   -0.01%     
==========================================
  Files         626      626              
  Lines       53833    53833              
==========================================
- Hits        31322    31321       -1     
- Misses      20003    20004       +1     
  Partials     2508     2508              
Flag Coverage Δ
unittests 58.18% <23.52%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Future-Outlier
Copy link
Member

image
I suggest to consider Fatal too.
I search for it from here.
https://github.com/flyteorg/flytestdlib/blob/fe5ccfe19b803b1eeab40600a484be0fe05467c6/logger/logger.go#L147-L149
Else LGTM!

@andrewwdye
Copy link
Contributor Author

Thanks @Future-Outlier. Oversight on my part. Updated PR and description.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 19, 2024
@andrewwdye andrewwdye merged commit 6f5c471 into master Jan 20, 2024
43 of 45 checks passed
@andrewwdye andrewwdye deleted the fix-logger-formatter-usage branch January 20, 2024 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Issues that help maintain flyte and keep it tech-debt free lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants