-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
FeaturePackage: cloudflareIssues related to the Sentry Cloudflare Workers SDKIssues related to the Sentry Cloudflare Workers SDK
Description
Description
When scheudling an alarm via a DurableObject the first setAlarm will have its own trace, which works as it should:
Once the alarm is being triggered and sets another alarm, it will show up in the same trace:
export class Counter extends DurableObject {
async alarm(): Promise<void> {
const alarmsRemaining = (await this.ctx.storage.get<number>('alarmsRemaining')) ?? 0;
const alarmNumber = 5 - alarmsRemaining; // 1, 2, 3, 4
console.log(`Alarm ${alarmNumber} fired at ${new Date().toISOString()}`);
// Do some work in this alarm
await new Promise((resolve) => setTimeout(resolve, 500));
console.log(`Alarm ${alarmNumber} completed work`);
// Schedule next alarm if there are more remaining
if (alarmsRemaining > 1) {
await this.ctx.storage.put('alarmsRemaining', alarmsRemaining - 1);
const nextAlarmTime = Date.now() + 2000;
await this.ctx.storage.setAlarm(nextAlarmTime);
console.log(`Scheduled alarm ${alarmNumber + 1} for ${new Date(nextAlarmTime).toISOString()}`);
} else {
await this.ctx.storage.delete('alarmsRemaining');
console.log('All 4 alarms completed');
}
}
}
Expected outcome
When an alarm is being triggered inside an alarm (or from somewhere else) it should create a new trace. Best case case would be to also set a Span Link from the first alarm to the second. This way we can identify WHEN and IF the next alarm has been triggered.
Metadata
Metadata
Assignees
Labels
FeaturePackage: cloudflareIssues related to the Sentry Cloudflare Workers SDKIssues related to the Sentry Cloudflare Workers SDK