The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): add log drain events to posthog (#40182)
kemal.earthf2ee1e0c2440
diff --git a/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx b/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsxindex b9c930d20ed..dc0ebeba058 100644--- a/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx+++ b/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx@@ -4,6 +4,7 @@ import { ReactNode, useEffect, useState } from 'react'import { useForm } from 'react-hook-form'import { toast } from 'sonner'import { z } from 'zod'+import { useTrack } from 'lib/telemetry/track'import { IS_PLATFORM, useFlag, useParams } from 'common'import Link from 'next/link'@@ -182,11 +183,7 @@ export function LogDrainDestinationSheetForm({const defaultType = defaultValues?.type || 'webhook'const [newCustomHeader, setNewCustomHeader] = useState({ name: '', value: '' })-- const baseValues = {- name: defaultValues?.name || '',- description: defaultValues?.description || '',- }+ const track = useTrack()const form = useForm<z.infer<typeof formSchema>>({resolver: zodResolver(formSchema),@@ -289,6 +286,12 @@ export function LogDrainDestinationSheetForm({}form.handleSubmit(onSubmit)(e)+ track('log_drain_save_button_clicked', {+ destination: form.getValues('type') as Exclude<+ LogDrainType,+ 'elastic' | 'postgres' | 'bigquery' | 'clickhouse' | 's3'+ >,+ })}}><div className="space-y-8 px-content">diff --git a/apps/studio/components/interfaces/LogDrains/LogDrains.tsx b/apps/studio/components/interfaces/LogDrains/LogDrains.tsxindex 9fe41b4df53..f40075bf8af 100644--- a/apps/studio/components/interfaces/LogDrains/LogDrains.tsx+++ b/apps/studio/components/interfaces/LogDrains/LogDrains.tsx@@ -27,6 +27,7 @@ import { LOG_DRAIN_TYPES, LogDrainType } from './LogDrains.constants'import { LogDrainsEmpty } from './LogDrainsEmpty'import { LogDrainsCard } from './LogDrainsCard'import { VoteLink } from './VoteLink'+import { useTrack } from 'lib/telemetry/track'export function LogDrains({onNewDrainClick,@@ -37,7 +38,7 @@ export function LogDrains({}) {const { isLoading: orgPlanLoading, plan } = useCurrentOrgPlan()const logDrainsEnabled = !orgPlanLoading && (plan?.id === 'team' || plan?.id === 'enterprise')-+ const track = useTrack()const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)const [selectedLogDrain, setSelectedLogDrain] = useState<LogDrainData | null>(null)const { ref } = useParams()@@ -192,6 +193,12 @@ export function LogDrains({onConfirm={() => {if (selectedLogDrain && ref) {deleteLogDrain({ token: selectedLogDrain.token, projectRef: ref })+ track('log_drain_confirm_button_submitted', {+ destination: selectedLogDrain.type as Exclude<+ LogDrainType,+ 'elastic' | 'postgres' | 'bigquery' | 'clickhouse' | 's3'+ >,+ })}}}onCancel={() => setIsDeleteModalOpen(false)}diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.tsindex 3afd9419f2e..b5a0869c316 100644--- a/packages/common/telemetry-constants.ts+++ b/packages/common/telemetry-constants.ts@@ -2181,6 +2181,42 @@ export interface TableQuickstartAssistantOpenedEvent {groups: TelemetryGroups}+/**+ * User clicked the save destination button in add log drains sheet.+ *+ * @group Events+ * @source studio+ * @page /dashboard/project/{ref}/settings/log-drains (LogDrainDestinationSheetForm)+ */+export interface LogDrainSaveButtonClickedEvent {+ action: 'log_drain_save_button_clicked'+ properties: {+ /**+ * Type of the destination saved+ */+ destination: 'webhook' | 'datadog' | 'loki' | 'sentry'+ }+ groups: TelemetryGroups+}++/**+ * User confirmed addition of log drain destination.+ *+ * @group Events+ * @source studio+ * @page /dashboard/project/{ref}/settings/log-drains (LogDrains)+ */+export interface LogDrainConfirmButtonSubmittedEvent {+ action: 'log_drain_confirm_button_submitted'+ properties: {+ /**+ * Type of the destination confirmed+ */+ destination: 'webhook' | 'datadog' | 'loki' | 'sentry'+ }+ groups: TelemetryGroups+}+/*** @hidden*/@@ -2305,3 +2341,5 @@ export type TelemetryEvent =| CommandMenuSearchSubmittedEvent| CommandMenuCommandClickedEvent| SidebarOpenedEvent+ | LogDrainSaveButtonClickedEvent+ | LogDrainConfirmButtonSubmittedEvent