Repository navigation
Remove utopia-php/logger and report errors through spans - #13457
Merged
Merged
Conversation
Contributor
Greptile SummaryThe PR replaces the legacy logger-based error-reporting path with span-based Sentry export and removes obsolete logger resources and configuration.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (9): Last reviewed commit: "Merge main into logger removal branch" | Re-trigger Greptile |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
loks0n
force-pushed
the
refactor/remove-utopia-logger
branch
3 times, most recently
from
September 4, 2026 18:41
ae85bfe to
9888c57
Compare
Every error handler built a Utopia\Logger\Log by hand and pushed it to a third-party provider over utopia-php/fetch. That path leaks the curl handle, its socket and an eventfd until PHP's cycle collector runs (utopia-php/logger#52), fetch is archived, and every span already carries the same error. Errors now flow through Utopia\Span: handlers call Span::add() for the attributes they used to tag, set the throwable on the current span, and app/init/span.php adds the utopia-php/span Sentry exporter when _APP_LOGGING_CONFIG holds a sentry:// DSN. Client errors are marked error.publish=false so only server failures are exported, matching the old publish rules. Removed: the logger and realtimeLogger registry entries, the log/logger container resources, the Log parameter on workers, proxy rules and the embeddings endpoint, _APP_LOGGING_PROVIDER, _APP_LOGGING_CONFIG_REALTIME and the _APP_EXPERIMENT_LOGGING_* variables. LogOwl, Raygun and AppSignal are no longer supported; Sentry is the only exporter. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01D9ybk4YF5Q5L2xQzqhqdCT
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01D9ybk4YF5Q5L2xQzqhqdCT
The exporters derive error.type/message/code/file/line/trace from the throwable set with setError(); the hand-set copies were noise. Keep error.publish (sampler input) and error.action (caller label). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01D9ybk4YF5Q5L2xQzqhqdCT
Mirror appwrite-labs/edge: the Sentry sampler reads the exception on the span (AppwriteException::isPublishable(), otherwise code 0 or 5xx) so handlers no longer stamp error.publish. Classifier is a match on known keys. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01D9ybk4YF5Q5L2xQzqhqdCT
main added Appwrite\Execution\Store with its own Logger; report the best-effort mirror failure as span attributes like Lock does. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01D9ybk4YF5Q5L2xQzqhqdCT
loks0n
force-pushed
the
refactor/remove-utopia-logger
branch
from
September 4, 2026 18:49
9888c57 to
6f91a14
Compare
2 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every error handler built a
Utopia\Logger\Logby hand and pushed it to a provider throughutopia-php/fetch. That path leaks the curl handle, its socket and an eventfd until PHP's cycle collector runs (utopia-php/logger#52, reproduced on a live worker: 135 fds and 67CLOSE_WAITsockets after an hour), andutopia-php/fetchis archived so it cannot be fixed at the source. Meanwhile every request, job, task and realtime event already runs inside aUtopia\Spanthat carries the same throwable, so the logger was a second, hand-maintained copy of what the span knows.What changed
utopia-php/loggeris removed fromcomposer.jsonandcomposer.lock.app/init/span.phpadds theutopia-php/spanSentry exporter when_APP_LOGGING_CONFIGis asentry://PROJECT_ID:KEY@HOST/DSN, with environment, release and server name filled from the existing env vars. The exporter only ships spans that carry an error, and handlers now seterror.publish=falseon expected client errors so the old publish rules (AppwriteException::isPublishable(), code 0 or >= 500) still decide what reaches Sentry.$log->addTag()/addExtra()is nowSpan::add(), with dotted keys (project.id,function.id,deployment.id,database.id,dns.domain,email.skipped,webhook.signed,lock.target, ...). TheLogparameter is gone from workers, proxy rule actions,Proxy\Action::verifyRule(), the embeddings endpoint andAppwrite\Locking\Lock.Log. CLI tasks and realtime server callbacks, which run outside a request span, open one so the failure still reaches the exporters.logErrorcontainer resource (used byMigrationsandPlatform\Action) keeps its signature and writes to the span.loggerandrealtimeLoggerregistry entries, thelogandloggercontainer resources,_APP_LOGGING_PROVIDER,_APP_LOGGING_CONFIG_REALTIME,_APP_EXPERIMENT_LOGGING_PROVIDERand_APP_EXPERIMENT_LOGGING_CONFIG._APP_LOGGING_CONFIGand_APP_LOGGING_FORMATstay.Behaviour changes to be aware of
_APP_LOGGING_CONFIGlike everything else._APP_EXPERIMENT_LOGGING_CONFIG) is dropped.lock.error,embedding.error) rather than standalone events, because they do not fail the request.Doctorreports the logging adapter as enabled only for asentry://DSN.Verification
pint --test, PHPStan (level fromphpstan.neon) andphp -lclean on all 36 changed files.tests/unit/Locking/LockTest.php(18),tests/unit/Platform/Workers/DatabasesTest.php,MailsTest.php(3),NotificationsTest.php(25) pass.LockTestandNotificationsTestnow assert on span attributes throughSpan\Storage\Memoryinstead of onLogtags.Downstream
appwrite-labs/cloud extends these actions and still injects
login 18 files (Workers/Mails.php,Certificates.php,Deletes.php,Builds.php,Databases.php,Patches.php,DedicatedDatabases.php, the proxy rule actions, and its ownapp/*.phphandlers). Those must be migrated toSpan::add()in the same release that bumpsappwrite/server-ce, or the workers fail at boot on the missinglogresource.🤖 Generated with Claude Code
https://claude.ai/code/session_01D9ybk4YF5Q5L2xQzqhqdCT
Takeover validation (2026-09-04)
Refreshed with current main and reran CI. In an isolated PHP 8.5.9/Swoole container with garbage collection disabled, 2,000 error exports through the old logger grew file descriptors from 8 to 2,008 and RSS by about 156 MiB. The replacement span exporter delivered all 2,000 valid events while descriptors stayed at 8. Local p95 export latency was 3.96 ms versus 3.81 ms for the old path; this is a transport microbenchmark, not application throughput.
A second drill ran 20 concurrent coroutines through success, HTTP 500, connection refusal, and recovery (2,000 exports per phase). Descriptors stayed at 8 in every phase. The local sink received 6,000 valid, distinct error events, and the exporter reported all 4,000 expected transport failures. Delivery recovered after the failures.
Staging deployment and soak validation remain pending. Both regions have pre-rollout process/socket/memory, health-latency, API, worker, and queue metric baselines. No claim of a completed staging validation is made from these local drills.