chore: always record database namespace/tenant in deleteByGroup

Namespace and tenant describe the database regardless of outcome, so
record them (along with the target collection) up front instead of only
on the error path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
loks0nandClaude Opus 4.8 committed 2026-06-01 13:24:32 +01:00
1 parent 4433b10eaf
commit 85b5328f2e
1 file changed
+4 -5
@@ -612,6 +612,10 @@ class Databases extends Action
*/
protected function deleteByGroup(string $collectionId, array $queries, Database $database, ?callable $callback = null): void
{
Span::add('database.namespace', $database->getNamespace());
Span::add('database.tenant', $database->getTenant());
Span::add('delete_by_group.collection', $collectionId);
try {
$count = $database->deleteDocuments(
$collectionId,
@@ -620,11 +624,6 @@ class Databases extends Action
$callback
);
} catch (\Throwable $th) {
Span::add('database.namespace', $database->getNamespace());
if ($database->getSharedTables()) {
Span::add('database.tenant', $database->getTenant());
}
Span::add('delete_by_group.collection', $collectionId);
Span::add('delete_by_group.error', $th->getMessage());
return;
}