Files
supabase/apps/studio/lib/breadcrumbs.ts
Charis d8f7cc0d57 feat(support form): attach dashboard logs (#39539)
* o11y: mirror and sanitize breadcrumbs

Mirror Sentry breadcrumbs as the basis for our own support logging. Also
adds more sanitization to breadcrumbs.

* feat(support form): toggle for attaching dashboard  logs

Add a toggle to the support form when the category is "Dashboard bug",
to attach recent dashboard logs. Users can preview the attached logs and
opt out.

* feat(support links): dedicated support link component

Add a new component for support links, which:
- Uses the serializer for support link params to ensure
serialization/deserialization pairs correctly
- Snapshots breadcrumbs so the attached log on the support form will be
cut off at the support link click (otherwise we will get support form
actions cluttering up the log)

* tests(support form): extend timeout on flaky test

* Minor clean up

* fix(support form): allow url to specifically indicate no specified project

* minor nits

* Fix tests

* Fix tests

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-22 08:57:49 -04:00

22 lines
611 B
TypeScript

import type * as Sentry from '@sentry/nextjs'
import { RingBuffer } from './ringBuffer'
export const MIRRORED_BREADCRUMBS = new RingBuffer<Sentry.Breadcrumb>(50)
export const getMirroredBreadcrumbs = (): Sentry.Breadcrumb[] => {
return MIRRORED_BREADCRUMBS.toArray()
}
let BREADCRUMB_SNAPSHOT: Sentry.Breadcrumb[] | null = null
export const takeBreadcrumbSnapshot = (): void => {
BREADCRUMB_SNAPSHOT = getMirroredBreadcrumbs()
}
export const getOwnershipOfBreadcrumbSnapshot = (): Sentry.Breadcrumb[] | null => {
const snapshot = BREADCRUMB_SNAPSHOT
BREADCRUMB_SNAPSHOT = null
return snapshot
}