fix(usage): tag build and execution usage with the resource id

Build and execution usage rows carried a populated resourceInternalId but
an empty resourceId, so the console's GB-hours breakdown - which groups by
resourceId - collapsed all build compute into a single "Unknown" row.

CLO-4383 required emitting the public id alongside the internal one, but it
was only applied to the Cloud-side emitters. Set it on the CE emitters too:
Usage\Build (shared by the Builds and Jobs workers, covering functions and
sites) and the execution listener used by self-hosted.

Also drops the claim that the id is "resolved to resourceType + resourceId
in the usage pipeline" - no such resolution exists.
This commit is contained in:
Damodar Lohani committed 2026-09-03 12:22:32 +05:45
1 parent b3a843f5d5
commit 7ae9891bb6
2 files changed
+3 -2

No files matched your search

+1
View File
@@ -65,6 +65,7 @@ class Usage extends Listener
$context = (new Context())
->setResource(rtrim($resourceType, 's'))
->setResourceId((string) $resource->getId())
->setResourceInternalId((string) $resourceInternalId)
->addMetric(METRIC_EXECUTIONS, 1)
->addMetric(str_replace(['{resourceType}'], [$resourceType], METRIC_RESOURCE_TYPE_EXECUTIONS), 1)
+2 -2
View File
@@ -39,11 +39,11 @@ final class Build
$mbSeconds = 0;
}
// Per-resource breakdown now travels as resource dimensions on the
// Context (resolved to resourceType + resourceId in the usage pipeline)
// Per-resource breakdown travels as resource dimensions on the Context
// instead of per-{resourceInternalId} metric-name templates.
$usage
->setResource(rtrim($resourceType, 's'))
->setResourceId($resource->getId())
->setResourceInternalId((string) $resource->getSequence());
switch ($deployment->getAttribute('status')) {