Skip to content

feat: remove logrus and propogate context everywhere#18

Closed
Joibel wants to merge 3 commits into
mainfrom
remove-logrus
Closed

feat: remove logrus and propogate context everywhere#18
Joibel wants to merge 3 commits into
mainfrom
remove-logrus

Conversation

@Joibel

@Joibel Joibel commented Jul 18, 2025

Copy link
Copy Markdown
Owner

Practice PR to see what's borked

@Joibel
Joibel force-pushed the remove-logrus branch 2 times, most recently from 8665987 to 0c4c916 Compare July 18, 2025 16:20
@Joibel

Joibel commented Jul 18, 2025

Copy link
Copy Markdown
Owner Author

cursor review

cursor[bot]

This comment was marked as outdated.

@Joibel
Joibel requested a review from Copilot July 18, 2025 16:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the logrus logging library and propagates Go context throughout the codebase. The purpose is to modernize the logging infrastructure and improve context handling across the workflow controller.

  • Remove logrus dependency and replace with consistent context-based logging
  • Propagate context parameter through function signatures and method calls
  • Update logging patterns to use context-aware logging methods

Reviewed Changes

Copilot reviewed 300 out of 397 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
workflow/controller/operator_agent_test.go Updated test setup to use TestContext and propagate context to controller initialization
workflow/controller/operator.go Replaced logrus imports, updated logging calls to be context-aware, and propagated context through method signatures
workflow/controller/ns_watcher.go Updated namespace watcher logging to use RequireLoggerFromContext and context-aware logging calls
workflow/controller/node_counters_test.go Updated test setup to use TestContext instead of manual context creation
workflow/controller/inline_test.go Simplified test context setup using TestContext helper
workflow/controller/informer/workflow_template_convert.go Added context parameter to Get method signature
workflow/controller/informer/cluster_workflow_template_convert.go Added context parameter to Get method signature
workflow/controller/indexes/workflow_index.go Replaced logrus with context-aware logging in package initialization
workflow/controller/http_template_test.go Simplified test context setup
workflow/controller/hooks_test.go Updated all test functions to use TestContext helper
workflow/controller/hooks.go Updated function signatures to use TemplateContext instead of Context
workflow/controller/healthz_test.go Added TestContext usage and LogMiddleware for HTTP handler
workflow/controller/healthz.go Replaced logrus with context-aware logging and added LogMiddleware
workflow/controller/exit_handler_test.go Updated test functions to use TestContext helper
workflow/controller/exit_handler.go Updated function signatures and context-aware logging calls
Comments suppressed due to low confidence (2)

workflow/controller/operator.go:1936

  • The type name has changed from templateresolution.Context to templateresolution.TemplateContext. Ensure this naming change is consistent across the codebase.
func (woc *wfOperationCtx) executeTemplate(ctx context.Context, nodeName string, orgTmpl wfv1.TemplateReferenceHolder, tmplCtx *templateresolution.TemplateContext, args wfv1.Arguments, opts *executeTemplateOpts) (node *wfv1.NodeStatus, err error) {

// for before requeuing the workflow onto the workqueue.
var (
maxOperationTime = envutil.LookupEnvDurationOr(logging.WithLogger(context.Background(), logging.NewSlogLogger(logging.GetGlobalLevel(), logging.GetGlobalFormat())), "MAX_OPERATION_TIME", 30*time.Second)
maxOperationTime = envutil.LookupEnvDurationOr(logging.InitLoggerInContext(), "MAX_OPERATION_TIME", 30*time.Second)

Copilot AI Jul 18, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Using InitLoggerInContext() for environment variable lookup seems inconsistent. Consider using a dedicated context for configuration loading rather than a logger-initialized context.

Copilot uses AI. Check for mistakes.
}()
labelSelector := "!" + common.LabelKeyPhase + "," + instanceIDSelector
err := func() error {
err := func(ctx context.Context) error {

Copilot AI Jul 18, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The nested function definition could be extracted to improve readability and testability.

Copilot uses AI. Check for mistakes.
@Joibel
Joibel force-pushed the remove-logrus branch 6 times, most recently from d108012 to 9b768cf Compare July 21, 2025 10:17
@Joibel
Joibel force-pushed the remove-logrus branch 8 times, most recently from af71e05 to 982ea6b Compare July 23, 2025 12:57
@Joibel

Joibel commented Jul 23, 2025

Copy link
Copy Markdown
Owner Author

cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


Was this report helpful? Give feedback by reacting with 👍 or 👎

@Joibel
Joibel force-pushed the remove-logrus branch 4 times, most recently from df8f2de to e7f6cac Compare July 28, 2025 09:04
Joibel added 3 commits July 28, 2025 10:24
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel Joibel closed this Oct 27, 2025
@Joibel
Joibel deleted the remove-logrus branch December 8, 2025 13:35
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.

2 participants