Repository navigation
refactor: replace CLI and migration logError callbacks with spans - #13491
Conversation
Greptile SummaryThis PR replaces injected CLI and migration error callbacks with span-based terminal-error and recovered-warning reporting.
Confidence Score: 5/5The PR appears safe to merge; no outstanding correctness or repository-rule violations remain. The previously reported early-worker diagnostic loss is fixed because error-bearing spans now bypass selective tracing filters, and the resolved span-storage concern is also fixed with unconditional cleanup in a finally block. The only post-review change relaxes an assertion to the warning-span convention already used by related tests and does not introduce a demonstrated failure. Important Files Changed
Reviews (5): Last reviewed commit: "test: satisfy Rector nullable exception ..." | Re-trigger Greptile |
| $span = Span::current() ?? Span::init("worker.{$workerName}"); | ||
| $span->finish(error: $error); |
There was a problem hiding this comment.
When project-selective tracing is enabled, an error before project resolution creates this fallback span without project.id. The sampler rejects that span because it cannot match the configured project. Since this callback also removes direct console error output, the worker failure can produce no terminal diagnostics unless another error exporter is configured.
Knowledge Base Used:
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/worker.php
Line: 155-156
Comment:
**Early worker errors disappear**
When project-selective tracing is enabled, an error before project resolution creates this fallback span without `project.id`. The sampler rejects that span because it cannot match the configured project. Since this callback also removes direct console error output, the worker failure can produce no terminal diagnostics unless another error exporter is configured.
**Knowledge Base Used:**
- [Application bootstrap and runtime lifecycle](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/application-bootstrap.md)
- [Background processing and scheduling](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/background-processing.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
8c3b489 to
6b3f96d
Compare
What does this PR do?
Remove
logErrorcallback injection from CLI tasks and migration workers. Global CLI/worker error handlers export terminal failures once; recovered migration and embedding failures attach warning attributes usingSpan::add(). The sampler exports warning listener spans and marks recovered failures as warnings without attaching a Throwable or changing successful HTTP responses into Sentry errors. Partial embedding responses also expose the existing error count on the span.CLI success now finishes its operation span, and worker errors before project/span initialization still get an error span. Pagination read failures propagate instead of potentially reprocessing the previous page;
skipValidation()restores validation on both success and failure.Realtime and presence reporting keep their existing handling for this first pass.
Test Plan
versionproduces one success span; an unknown task produces one terminal error span and exits 1.No new HTTP/queue end-to-end drill or staging deployment has been performed. Existing migration HTTP E2E remains a CI gate; partial embedding warning behavior has not been exercised against a live embedding backend.
Related PRs and Issues
Cloud follow-up: https://github.com/appwrite-labs/cloud/pull/5670 (held while this CE change goes first). Cloud overrides
Migrations::action(): remove its logger parameter and forwarded argument when updating its server-ce dependency. Do not bump Cloud to this CE commit without that coordinated signature update.