Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

sample just 10% of dashboard error event (#41743)

Jordi Enric9a40a8f292aa
diff --git a/apps/studio/components/ui/AlertError.tsx b/apps/studio/components/ui/AlertError.tsx
index 09cd64cfaf0..3e472f13f88 100644
--- a/apps/studio/components/ui/AlertError.tsx
+++ b/apps/studio/components/ui/AlertError.tsx
@@ -63,9 +63,11 @@ export const AlertError = ({
useEffect(() => {
if (!hasTrackedRef.current) {
hasTrackedRef.current = true
- track('dashboard_error_created', {
- source: 'admonition',
- })
+ if (Math.random() < 0.1) {
+ track('dashboard_error_created', {
+ source: 'admonition',
+ })
+ }
}
}, [track])
diff --git a/apps/studio/lib/toast-errors.tsx b/apps/studio/lib/toast-errors.tsx
index 6c8724046d4..3fe7ddadf35 100644
--- a/apps/studio/lib/toast-errors.tsx
+++ b/apps/studio/lib/toast-errors.tsx
@@ -11,9 +11,11 @@ export const ToastErrorTracker = () => {
toasts.forEach((toast) => {
if (toast.type === 'error' && !trackRef.current.has(toast.id)) {
trackRef.current.add(toast.id)
- track('dashboard_error_created', {
- source: 'toast',
- })
+ if (Math.random() < 0.1) {
+ track('dashboard_error_created', {
+ source: 'toast',
+ })
+ }
}
})
}, [toasts, track])