Skip to content

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

chore: remove unnecessary telemetry (#28127)

Pamela Chia1904d02e3342
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/CostControl/SpendCapSidePanel.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/CostControl/SpendCapSidePanel.tsx
index b93c6010623..32ce3e4b4d2 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/CostControl/SpendCapSidePanel.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/CostControl/SpendCapSidePanel.tsx
@@ -2,7 +2,6 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useTheme } from 'next-themes'
import Image from 'next/image'
import Link from 'next/link'
-import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import toast from 'react-hot-toast'
@@ -12,7 +11,6 @@ import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-que
import { useOrgSubscriptionUpdateMutation } from 'data/subscriptions/org-subscription-update-mutation'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { BASE_PATH, PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
-import Telemetry from 'lib/telemetry'
import { pricing } from 'shared-data/pricing'
import { useOrgSettingsPageStateSnapshot } from 'state/organization-settings'
import { Alert, Button, Collapsible, IconChevronRight, IconExternalLink, SidePanel, cn } from 'ui'
@@ -38,7 +36,6 @@ const SPEND_CAP_OPTIONS: {
]
const SpendCapSidePanel = () => {
- const router = useRouter()
const { slug } = useParams()
const { resolvedTheme } = useTheme()
@@ -75,18 +72,6 @@ const SpendCapSidePanel = () => {
useEffect(() => {
if (visible && subscription !== undefined) {
setSelectedOption(isSpendCapOn ? 'on' : 'off')
- Telemetry.sendActivity(
- {
- activity: 'Side Panel Viewed',
- source: 'Dashboard',
- data: {
- title: 'Spend cap',
- section: 'Cost Control',
- },
- ...(slug && { orgSlug: slug }),
- },
- router
- )
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible, isLoading, subscription, isSpendCapOn])
@@ -221,22 +206,7 @@ const SpendCapSidePanel = () => {
<div
key={option.value}
className={cn('col-span-4 group space-y-1', isFreePlan && 'opacity-75')}
- onClick={() => {
- !isFreePlan && setSelectedOption(option.value)
- Telemetry.sendActivity(
- {
- activity: 'Option Selected',
- source: 'Dashboard',
- data: {
- title: 'Spend cap',
- section: 'Cost Control',
- option: option.name,
- },
- ...(slug && { orgSlug: slug }),
- },
- router
- )
- }}
+ onClick={() => !isFreePlan && setSelectedOption(option.value)}
>
<Image
alt="Spend Cap"
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx
index 83dae173ff1..84bf3dd4bfa 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx
@@ -23,7 +23,6 @@ import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
import { formatCurrency } from 'lib/helpers'
-import Telemetry from 'lib/telemetry'
import { pickFeatures, pickFooter, plans as subscriptionsPlans } from 'shared-data/plans'
import { useOrgSettingsPageStateSnapshot } from 'state/organization-settings'
import { Button, IconCheck, IconInfo, Modal, SidePanel, cn } from 'ui'
@@ -113,18 +112,6 @@ const PlanUpdateSidePanel = () => {
useEffect(() => {
if (visible) {
setSelectedTier(undefined)
- Telemetry.sendActivity(
- {
- activity: 'Side Panel Viewed',
- source: 'Dashboard',
- data: {
- title: 'Change Subscription Plan',
- section: 'Subscription plan',
- },
- ...(slug && { orgSlug: slug }),
- },
- router
- )
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible])
@@ -245,23 +232,7 @@ const PlanUpdateSidePanel = () => {
block
type={isDowngradeOption ? 'default' : 'primary'}
disabled={subscription?.plan?.id === 'enterprise' || !canUpdateSubscription}
- onClick={() => {
- setSelectedTier(plan.id as any)
- Telemetry.sendActivity(
- {
- activity: 'Popup Viewed',
- source: 'Dashboard',
- data: {
- title: isDowngradeOption
- ? 'Downgrade'
- : 'Upgrade' + ' to ' + plan.name,
- section: 'Subscription plan',
- },
- ...(slug && { orgSlug: slug }),
- },
- router
- )
- }}
+ onClick={() => setSelectedTier(plan.id as any)}
tooltip={{
content: {
side: 'bottom',
diff --git a/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
index d8a7d8eb0b1..b5940c8cfe0 100644
--- a/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
@@ -20,7 +20,6 @@ import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useFlag } from 'hooks/ui/useFlag'
import { getCloudProviderArchitecture } from 'lib/cloudprovider-utils'
import { INSTANCE_MICRO_SPECS, PROJECT_STATUS } from 'lib/constants'
-import Telemetry from 'lib/telemetry'
import { useSubscriptionPageStateSnapshot } from 'state/subscription-page'
import {
Alert,
@@ -181,18 +180,6 @@ const ComputeInstanceSidePanel = () => {
} else {
setSelectedOption(defaultInstanceSize)
}
- Telemetry.sendActivity(
- {
- activity: 'Side Panel Viewed',
- source: 'Dashboard',
- data: {
- title: 'Change project compute size',
- section: 'Add ons',
- },
- projectRef,
- },
- router
- )
}
}, [visible, isLoading])
diff --git a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
index 17b15be7c22..1e4d23be906 100644
--- a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
@@ -14,7 +14,6 @@ import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useFlag } from 'hooks/ui/useFlag'
import { formatCurrency } from 'lib/helpers'
-import Telemetry from 'lib/telemetry'
import { useSubscriptionPageStateSnapshot } from 'state/subscription-page'
import {
Alert,
@@ -94,18 +93,6 @@ const CustomDomainSidePanel = () => {
} else {
setSelectedOption('cd_none')
}
- Telemetry.sendActivity(
- {
- activity: 'Side Panel Viewed',
- source: 'Dashboard',
- data: {
- title: 'Custom domains',
- section: 'Add ons',
- },
- projectRef,
- },
- router
- )
}
}, [visible, isLoading])
@@ -186,22 +173,7 @@ const CustomDomainSidePanel = () => {
type="large-cards"
size="tiny"
id="custom-domain"
- onChange={(event: any) => {
- setSelectedOption(event.target.value)
- Telemetry.sendActivity(
- {
- activity: 'Option Selected',
- source: 'Dashboard',
- data: {
- title: 'Custom domains',
- section: 'Add ons',
- option: event.target.label,
- },
- projectRef,
- },
- router
- )
- }}
+ onChange={(event: any) => setSelectedOption(event.target.value)}
>
<Radio
name="custom-domain"
diff --git a/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx
index 1aa0bf91e6e..6ad94791487 100644
--- a/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx
@@ -13,7 +13,6 @@ import type { AddonVariantId } from 'data/subscriptions/types'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { formatCurrency } from 'lib/helpers'
-import Telemetry from 'lib/telemetry'
import { useSubscriptionPageStateSnapshot } from 'state/subscription-page'
import {
Alert,
@@ -85,18 +84,6 @@ const IPv4SidePanel = () => {
} else {
setSelectedOption('ipv4_none')
}
- Telemetry.sendActivity(
- {
- activity: 'Side Panel Viewed',
- source: 'Dashboard',
- data: {
- title: 'IPv4',
- section: 'Add ons',
- },
- projectRef,
- },
- router
- )
}
}, [visible, isLoading])
@@ -161,22 +148,7 @@ const IPv4SidePanel = () => {
type="large-cards"
size="tiny"
id="ipv4"
- onChange={(event: any) => {
- setSelectedOption(event.target.value)
- Telemetry.sendActivity(
- {
- activity: 'Option Selected',
- source: 'Dashboard',
- data: {
- title: 'IPv4',
- section: 'Add ons',
- option: event.target.label,
- },
- projectRef,
- },
- router
- )
- }}
+ onChange={(event: any) => setSelectedOption(event.target.value)}
>
<Radio
name="ipv4"
diff --git a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
index cbc92592c1f..bfae607bcde 100644
--- a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
@@ -18,7 +18,6 @@ import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { BASE_PATH } from 'lib/constants'
import { formatCurrency } from 'lib/helpers'
-import Telemetry from 'lib/telemetry'
import { useSubscriptionPageStateSnapshot } from 'state/subscription-page'
import {
Alert,
@@ -126,18 +125,6 @@ const PITRSidePanel = () => {
setSelectedCategory('off')
setSelectedOption('pitr_0')
}
- Telemetry.sendActivity(
- {
- activity: 'Side Panel Viewed',
- source: 'Dashboard',
- data: {
- title: 'Point in Time Recovery',
- section: 'Add ons',
- },
- projectRef,
- },
- router
- )
}
}, [visible, isLoading])
@@ -230,19 +217,6 @@ const PITRSidePanel = () => {
} else {
setSelectedOption('pitr_7')
}
- Telemetry.sendActivity(
- {
- activity: 'Option Selected',
- source: 'Dashboard',
- data: {
- title: 'Point in Time Recovery',
- section: 'Add ons',
- option: option.name,
- },
- projectRef,
- },
- router
- )
}}
>
<img
diff --git a/apps/studio/components/ui/PageTelemetry.tsx b/apps/studio/components/ui/PageTelemetry.tsx
index 25b65147ba1..7e288960b6e 100644
--- a/apps/studio/components/ui/PageTelemetry.tsx
+++ b/apps/studio/components/ui/PageTelemetry.tsx
@@ -1,9 +1,8 @@
import * as Sentry from '@sentry/nextjs'
-import { useIsLoggedIn, useParams, useTelemetryProps, useUser } from 'common'
+import { useTelemetryProps, useUser } from 'common'
import { useRouter } from 'next/router'
import { PropsWithChildren, useEffect } from 'react'
-import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { post } from 'lib/common/fetch'
import { API_URL, IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
import { getAnonId } from 'lib/telemetry'
@@ -11,9 +10,7 @@ import { useAppStateSnapshot } from 'state/app-state'
const PageTelemetry = ({ children }: PropsWithChildren<{}>) => {
const router = useRouter()
- const { ref } = useParams()
const telemetryProps = useTelemetryProps()
- const selectedOrganization = useSelectedOrganization()
const snap = useAppStateSnapshot()
useEffect(() => {
@@ -24,8 +21,6 @@ const PageTelemetry = ({ children }: PropsWithChildren<{}>) => {
if (consent !== null) snap.setIsOptedInTelemetry(consent === 'true')
}, [])
- const isLoggedIn = useIsLoggedIn()
-
useEffect(() => {
function handleRouteChange(url: string) {
if (snap.isOptedInTelemetry) handlePageTelemetry(url)
@@ -91,17 +86,6 @@ const PageTelemetry = ({ children }: PropsWithChildren<{}>) => {
language: telemetryProps?.language,
},
})
-
- if (isLoggedIn) {
- post(`${API_URL}/telemetry/pageview`, {
- ...(ref && { projectRef: ref }),
- ...(selectedOrganization && { orgSlug: selectedOrganization.slug }),
- referrer: referrer,
- title: document.title,
- path: router.route,
- location: router.asPath,
- })
- }
}
}
diff --git a/apps/studio/lib/telemetry.ts b/apps/studio/lib/telemetry.ts
index 3b37e3a0637..3efdfed495b 100644
--- a/apps/studio/lib/telemetry.ts
+++ b/apps/studio/lib/telemetry.ts
@@ -75,45 +75,6 @@ const sendIdentify = (user: User, gaProps?: TelemetryProps) => {
})
}
-/**
- * @deprecated use sendEvent instead.
- */
-const sendActivity = (
- event: {
- activity: string
- source: string
- projectRef?: string
- orgSlug?: string
- data?: object
- },
- router: NextRouter
-) => {
- if (!IS_PLATFORM) return
-
- const consent =
- typeof window !== 'undefined'
- ? localStorage.getItem(LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT)
- : null
- if (consent !== 'true') return
-
- const { activity, source, projectRef, orgSlug, data } = event
-
- const properties = {
- activity,
- source,
- page: {
- path: router.route,
- location: router.asPath,
- referrer: document?.referrer || '',
- title: document?.title || '',
- },
- ...(data && { data }),
- ...(projectRef && { projectRef }),
- ...(orgSlug && { orgSlug }),
- }
- return post(`${API_URL}/telemetry/activity`, properties)
-}
-
/**
* Generates a unique identifier for an anonymous user based on their gotrue id.
*/
@@ -129,7 +90,6 @@ export const getAnonId = async (id: string) => {
const Telemetry = {
sendEvent,
sendIdentify,
- sendActivity,
}
export default Telemetry