From a6ea885badeb42a4799b6d1796c1adf457b13128 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 2 Jul 2026 03:04:06 +0000 Subject: [PATCH] fix(usage): pass resource on ExecutionCompleted dispatches Two dispatch sites in the Functions worker (async execution paths) were constructing ExecutionCompleted without a resource: payload. The cloud usage listener then received an empty Document and wrote resourceId='' on the resulting metric row while resourceInternalId was populated from $execution. Result: async function metrics (executions, executions.compute, executions.mb_seconds) landed in ClickHouse with a NULL resourceId and blocked joins/filters against the resource. The cloud Regions/Events/Executions/Create.php sibling already gets this right; just mirror the same argument set here. --- src/Appwrite/Platform/Workers/Functions.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 73c1db9444..cf21163809 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -327,6 +327,7 @@ class Functions extends Action $bus->dispatch(new ExecutionCompleted( execution: $execution->getArrayCopy(), project: $project->getArrayCopy(), + resource: $function->getArrayCopy(), )); } @@ -630,6 +631,7 @@ class Functions extends Action execution: $execution->getArrayCopy(), project: $project->getArrayCopy(), spec: $spec, + resource: $function->getArrayCopy(), )); }