Skip to content

Clean up logging and remove double-logged errors#127

Merged
yushan8 merged 3 commits into
mainfrom
validate-logs
Jun 29, 2026
Merged

Clean up logging and remove double-logged errors#127
yushan8 merged 3 commits into
mainfrom
validate-logs

Conversation

@yushan8

@yushan8 yushan8 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Removed double-logged errors (logged then returned — caller logs again):

  • core/workspace/gitrequest.go — 5 Errorw calls in Apply() (fetch, diff, patch, commit, submodule). The orchestrator already logs when ApplyRequests fails.
  • core/bazel/bazel.go — Errorw for bazel executable detection. Caller logs.
  • core/bazel/query.go — Errorf in wrapQueryFailure. The error message already carries stderr; logging it separately was redundant.
  • orchestrator/native_orchestrator.go — 11 Errorw calls across the entire GetTargetGraph method. All errors are returned as ClassifiedError and the controller boundary emits failure metrics + logs.

Corrected log levels:

  • controller/getchangedtargets.go:55 — validation failure Error → removed (linter removed the log entirely since it's returned with classification)
  • controller/getchangedtargets.go:293 — background goroutine cache-write skip Error → Warn (not a service failure, can't return)
  • controller/gettargetgraph.go:107 — treehash cache miss Info → Debug (normal hot-path noise)
  • core/bazel/bazel.go:94 — constructor detail Info → Debugw
  • core/bazel/query.go:40 — bazel query detail Infow → Debugw

Fixed unstructured logging:

  • orchestrator/native_orchestrator.go:137 — Errorf → Errorw with zap.Error()
  • core/bazel/query.go:103 — Debugf → Debugw with zap.Int()

@yushan8 yushan8 requested review from a team as code owners June 29, 2026 18:21
@yushan8 yushan8 changed the title Clean up logging Clean up logging and remove doulbe-logged errors Jun 29, 2026
@yushan8 yushan8 changed the title Clean up logging and remove doulbe-logged errors Clean up logging and remove double-logged errors Jun 29, 2026

@sbalabanov sbalabanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in many cases it is beneficial to wrap the error with fmt.Errorf to include additional metadata and preserve call stack in the error chain.

@yushan8 yushan8 merged commit 47afc3f into main Jun 29, 2026
8 checks passed
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