Skip to content

Commit 8443f78

Browse files
committed
add attributes to runlock dequeue span
1 parent b0b0df6 commit 8443f78

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

internal-packages/run-engine/src/engine/locking.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ export class RunLocker {
144144
}
145145

146146
/** Locks resources using RedLock. It won't lock again if we're already inside a lock with the same resources. */
147-
async lock<T>(name: string, resources: string[], routine: () => Promise<T>): Promise<T> {
147+
async lock<T>(
148+
name: string,
149+
resources: string[],
150+
routine: () => Promise<T>,
151+
attributes?: Attributes
152+
): Promise<T> {
148153
const currentContext = this.asyncLocalStorage.getStore();
149154
const joinedResources = [...resources].sort().join(",");
150155

@@ -187,7 +192,7 @@ export class RunLocker {
187192
return result;
188193
},
189194
{
190-
attributes: { name, resources, timeout: this.duration },
195+
attributes: { name, resources, timeout: this.duration, ...attributes },
191196
}
192197
);
193198
}

internal-packages/run-engine/src/engine/systems/dequeueSystem.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,16 @@ export class DequeueSystem {
573573
},
574574
placementTags: [placementTag("paid", isPaying ? "true" : "false")],
575575
} satisfies DequeuedMessage;
576+
},
577+
{
578+
run_id: runId,
579+
org_id: orgId,
580+
environment_id: message.message.environmentId,
581+
environment_type: message.message.environmentType,
582+
worker_queue_length: message.workerQueueLength ?? 0,
583+
consumer_id: consumerId,
584+
worker_queue: workerQueue,
585+
blocking_pop: blockingPop ?? true,
576586
}
577587
);
578588

0 commit comments

Comments
 (0)