diff --git a/composer.json b/composer.json index e142cc7b0f..c0cc0638ae 100644 --- a/composer.json +++ b/composer.json @@ -126,7 +126,7 @@ "enshrined/svg-sanitize": "0.22.*", "utopia-php/client": "^0.4.4", "open-runtimes/sdk-for-php": "^2.0", - "utopia-php/schedule": "^0.2.0", + "utopia-php/schedule": "^0.3.0", "utopia-php/usage": "^0.16.4", "utopia-php/query": "0.6.*", "utopia-php/openapi": "^0.2.4", diff --git a/composer.lock b/composer.lock index 9d2d6ffa7e..7bd5d0a730 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "62f51a18c01a9adf3155ca523d64724b", + "content-hash": "6d18c8c29cbbb950556109e8bfc61779", "packages": [ { "name": "adhocore/jwt", @@ -4518,16 +4518,16 @@ }, { "name": "utopia-php/schedule", - "version": "0.2.2", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/utopia-php/schedule.git", - "reference": "3a7ca5134df98830c6b2dd825324c46378f45f56" + "reference": "fd28416654405e865649569e111fe1d3a3cf9868" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/schedule/zipball/3a7ca5134df98830c6b2dd825324c46378f45f56", - "reference": "3a7ca5134df98830c6b2dd825324c46378f45f56", + "url": "https://api.github.com/repos/utopia-php/schedule/zipball/fd28416654405e865649569e111fe1d3a3cf9868", + "reference": "fd28416654405e865649569e111fe1d3a3cf9868", "shasum": "" }, "require": { @@ -4571,9 +4571,9 @@ ], "support": { "issues": "https://github.com/utopia-php/schedule/issues", - "source": "https://github.com/utopia-php/schedule/tree/0.2.2" + "source": "https://github.com/utopia-php/schedule/tree/0.3.0" }, - "time": "2026-08-19T10:25:02+00:00" + "time": "2026-09-17T15:41:29+00:00" }, { "name": "utopia-php/servers", diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index 820fecd928..326f4323a2 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -10,6 +10,7 @@ use Utopia\Database\Document; use Utopia\Platform\Action; use Utopia\Schedule\Occurrence; use Utopia\Schedule\Scheduler; +use Utopia\Schedule\Source\Row; use Utopia\Span\Span; use Utopia\Telemetry\Adapter as Telemetry; @@ -42,8 +43,13 @@ class ScheduleExecutions extends Action source: $source, syncSeconds: self::UPDATE_TIMER, telemetry: $telemetry, - onError: function (\Throwable $error): void { + onError: function (\Throwable $error, ?Row $row = null): void { Span::init('schedule.executions.reconcile'); + if ($row?->data instanceof Document) { + Span::add('project.id', (string) $row->data->getAttribute('projectId')); + Span::add('resource.id', (string) $row->data->getAttribute('resourceId')); + Span::add('schedule.id', $row->data->getId()); + } Span::current()?->finish(error: $error); }, ); diff --git a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php index f98d3efc5d..e2253a2d88 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php @@ -6,9 +6,11 @@ use Appwrite\Event\Message\Func as FunctionMessage; use Appwrite\Event\Publisher\Func as FunctionPublisher; use Appwrite\Schedule\Source; use Utopia\Database\Database; +use Utopia\Database\Document; use Utopia\Platform\Action; use Utopia\Schedule\Occurrence; use Utopia\Schedule\Scheduler; +use Utopia\Schedule\Source\Row; use Utopia\Span\Span; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; @@ -44,8 +46,13 @@ class ScheduleFunctions extends Action $scheduler = new Scheduler( source: $source, telemetry: $telemetry, - onError: function (\Throwable $error): void { + onError: function (\Throwable $error, ?Row $row = null): void { Span::init('schedule.functions.reconcile'); + if ($row?->data instanceof Document) { + Span::add('project.id', (string) $row->data->getAttribute('projectId')); + Span::add('resource.id', (string) $row->data->getAttribute('resourceId')); + Span::add('schedule.id', $row->data->getId()); + } Span::current()?->finish(error: $error); }, ); diff --git a/src/Appwrite/Platform/Tasks/ScheduleMessages.php b/src/Appwrite/Platform/Tasks/ScheduleMessages.php index 80f26d6bf2..e58476c076 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleMessages.php +++ b/src/Appwrite/Platform/Tasks/ScheduleMessages.php @@ -11,6 +11,7 @@ use Utopia\Database\Document; use Utopia\Platform\Action; use Utopia\Schedule\Occurrence; use Utopia\Schedule\Scheduler; +use Utopia\Schedule\Source\Row; use Utopia\Span\Span; use Utopia\Telemetry\Adapter as Telemetry; @@ -49,8 +50,13 @@ class ScheduleMessages extends Action source: $source, syncSeconds: self::UPDATE_TIMER, telemetry: $telemetry, - onError: function (\Throwable $error): void { + onError: function (\Throwable $error, ?Row $row = null): void { Span::init('schedule.messages.reconcile'); + if ($row?->data instanceof Document) { + Span::add('project.id', (string) $row->data->getAttribute('projectId')); + Span::add('resource.id', (string) $row->data->getAttribute('resourceId')); + Span::add('schedule.id', $row->data->getId()); + } Span::current()?->finish(error: $error); }, );