Improve snackbar and fix sentry (#7181)

- Improve snackbar to enable displaying multi-line message (so far we
only displayed the first few words which was very frustrating)

- Followup on previous issue to enable tim@apple.dev on the demo
workspace (prefilled automatically)

- Fix sentry tracing which had been broken when migrating from v7 to v8
This commit is contained in:
Félix Malfait
2024-09-21 06:33:15 +02:00
committed by GitHub
parent 20d06b3c0f
commit 6d5d73fbe8
13 changed files with 84 additions and 62 deletions

View File

@ -6,15 +6,17 @@ export function SentryCronMonitor(monitorSlug: string, schedule: string) {
propertyKey: string,
descriptor: PropertyDescriptor,
) {
if (!Sentry.isInitialized()) {
return descriptor;
}
const originalMethod = descriptor.value;
descriptor.value = async function (...args: any[]) {
if (!Sentry.isInitialized()) {
return await originalMethod.apply(this, args);
}
let checkInId: string | undefined;
try {
Sentry.captureCheckIn(
checkInId = Sentry.captureCheckIn(
{
monitorSlug,
status: 'in_progress',
@ -25,13 +27,14 @@ export function SentryCronMonitor(monitorSlug: string, schedule: string) {
value: schedule,
},
checkinMargin: 1,
maxRuntime: 1,
maxRuntime: 5,
timezone: 'UTC',
},
);
const result = await originalMethod.apply(this, args);
Sentry.captureCheckIn({
checkInId,
monitorSlug,
status: 'ok',
});
@ -39,6 +42,7 @@ export function SentryCronMonitor(monitorSlug: string, schedule: string) {
return result;
} catch (error) {
Sentry.captureCheckIn({
checkInId,
monitorSlug,
status: 'error',
});