Tag migrations-worker Sentry events with source projectId and endpoint

When a publishable exception bubbles to Sentry from the migrations worker,
include the source projectId and endpoint in the event extras so on-call
can correlate the event with the failing migration without a round-trip
to the database. Only emitted for Appwrite-source migrations because the
credentials shape varies by source type; the apiKey is never included.
This commit is contained in:
Prem Palanisamy
2026-05-25 16:33:56 +01:00
parent 22be6514fb
commit 71082bca69
+12 -2
View File
@@ -577,11 +577,21 @@ class Migrations extends Action
}
if ($publish) {
call_user_func($this->logError, $th, 'appwrite-worker', 'appwrite-queue-' . self::getName(), [
$extras = [
'migrationId' => $migration->getId(),
'source' => $migration->getAttribute('source') ?? '',
'destination' => $migration->getAttribute('destination') ?? '',
]);
];
// Include source identifiers for Appwrite sources to make Sentry events
// self-debuggable. Never include the apiKey or any other secret.
if ($migration->getAttribute('source') === SourceAppwrite::getName()) {
$credentials = $migration->getAttribute('credentials', []) ?? [];
$extras['sourceProjectId'] = $credentials['projectId'] ?? '';
$extras['sourceEndpoint'] = $credentials['endpoint'] ?? '';
}
call_user_func($this->logError, $th, 'appwrite-worker', 'appwrite-queue-' . self::getName(), $extras);
}
} finally {
try {