Chore/track branching 2 (#37350)

* add review branch w ai

* track create branch

* track update push branch event

* track create merge request

* track create and close merge request

* track merge attempts and results

* add delete branch event

* combine handle update

* fix lint
This commit is contained in:
Pamela Chia authored and GitHub committed 2025-07-22 20:51:08 +08:00
1 parent 008cca006d
commit f9e330f3ca
8 files changed
+428 -214

No files matched your search

@@ -22,6 +22,7 @@ import { useCheckGithubBranchValidity } from 'data/integrations/github-branch-ch
import { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query'
import { projectKeys } from 'data/projects/keys'
import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { BASE_PATH, IS_PLATFORM } from 'lib/constants'
@@ -83,12 +84,26 @@ export const CreateBranchModal = () => {
onError: () => {},
})
const { mutate: sendEvent } = useSendEventMutation()
const { mutate: createBranch, isLoading: isCreating } = useBranchCreateMutation({
onSuccess: async (data) => {
toast.success(`Successfully created preview branch "${data.name}"`)
if (projectRef) {
await Promise.all([queryClient.invalidateQueries(projectKeys.detail(projectRef))])
}
sendEvent({
action: 'branch_create_button_clicked',
properties: {
branchType: data.persistent ? 'persistent' : 'preview',
gitlessBranching,
},
groups: {
project: ref ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
setShowCreateBranchModal(false)
router.push(`/project/${data.project_ref}`)
},
@@ -13,6 +13,9 @@ import {
} from 'ui'
import { GitBranchIcon } from 'lucide-react'
import { Admonition } from 'ui-patterns'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
interface OutOfDateNoticeProps {
isBranchOutOfDateMigrations: boolean
@@ -41,6 +44,12 @@ export const OutOfDateNotice = ({
}: OutOfDateNoticeProps) => {
const [isDialogOpen, setIsDialogOpen] = useState(false)
const hasOutdatedMigrations = isBranchOutOfDateMigrations && missingMigrationsCount > 0
const selectedOrg = useSelectedOrganization()
const project = useSelectedProject()
const { mutate: sendEvent } = useSendEventMutation()
const isBranch = project?.parent_project_ref !== undefined
const parentProjectRef = isBranch ? project?.parent_project_ref : project?.ref
const getTitle = () => {
if (hasOutdatedMigrations && (hasMissingFunctions || hasOutOfDateFunctions)) {
@@ -57,12 +66,24 @@ export const OutOfDateNotice = ({
return 'Update this branch to get the latest changes from the production branch.'
}
const handleUpdateClick = () => {
onPush()
}
const handleUpdate = (shouldCloseDialog = false) => {
if (shouldCloseDialog) {
setIsDialogOpen(false)
}
// Track branch update
sendEvent({
action: 'branch_updated',
properties: {
modifiedEdgeFunctions: hasEdgeFunctionModifications,
source: 'out_of_date_notice',
},
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
const handleConfirmUpdate = () => {
setIsDialogOpen(false)
onPush()
}
@@ -98,7 +119,9 @@ export const OutOfDateNotice = ({
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={handleConfirmUpdate}>Update anyway</AlertDialogAction>
<AlertDialogAction onClick={() => handleUpdate(true)}>
Update anyway
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
@@ -106,7 +129,7 @@ export const OutOfDateNotice = ({
<Button
type="default"
loading={isPushing}
onClick={handleUpdateClick}
onClick={() => handleUpdate()}
icon={<GitBranchIcon size={16} strokeWidth={1.5} />}
className="shrink-0"
>
@@ -5,6 +5,8 @@ import { useAiAssistantStateSnapshot } from 'state/ai-assistant-state'
import { Branch } from 'data/branches/branches-query'
import { tablesToSQL } from 'lib/helpers'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
interface ReviewWithAIProps {
currentBranch?: Branch
@@ -22,6 +24,8 @@ export const ReviewWithAI = ({
disabled = false,
}: ReviewWithAIProps) => {
const aiSnap = useAiAssistantStateSnapshot()
const selectedOrg = useSelectedOrganization()
const { mutate: sendEvent } = useSendEventMutation()
// Get parent project for production schema
const parentProject = useProjectByRef(parentProjectRef)
@@ -40,6 +44,15 @@ export const ReviewWithAI = ({
const handleReviewWithAssistant = () => {
if (!currentBranch || !mainBranch) return
// Track review with assistant button pressed
sendEvent({
action: 'branch_review_with_assistant_clicked',
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
// Prepare diff content for the assistant
const sqlSnippets = []
@@ -3,19 +3,24 @@ import { GitMerge } from 'lucide-react'
import { useBranchesQuery } from 'data/branches/branches-query'
import { useParams } from 'common'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useRouter } from 'next/router'
import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { toast } from 'sonner'
export const MergeRequestButton = () => {
const { ref } = useParams()
const router = useRouter()
const projectDetails = useSelectedProject()
const selectedOrg = useSelectedOrganization()
const projectRef = projectDetails?.parent_project_ref || ref
const { data: branches } = useBranchesQuery({ projectRef }, { enabled: Boolean(projectDetails) })
const { mutate: sendEvent } = useSendEventMutation()
const { mutate: updateBranch, isLoading: isUpdating } = useBranchUpdateMutation({
onError: () => {
toast.error(`Failed to open merge request`)
@@ -44,6 +49,17 @@ export const MergeRequestButton = () => {
onSuccess: () => {
toast.success('Merge request created')
router.push(`/project/${selectedBranch.project_ref}/merge`)
sendEvent({
action: 'branch_create_merge_request_button_clicked',
properties: {
branchType: selectedBranch.persistent ? 'persistent' : 'preview',
origin: 'header',
},
groups: {
project: projectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
},
}
)
@@ -18,6 +18,7 @@ import NoPermission from 'components/ui/NoPermission'
import { useBranchDeleteMutation } from 'data/branches/branch-delete-mutation'
import { Branch, useBranchesQuery } from 'data/branches/branches-query'
import { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
@@ -35,6 +36,8 @@ const BranchesPage: NextPageWithLayout = () => {
const [selectedBranchToDelete, setSelectedBranchToDelete] = useState<Branch>()
const { mutate: sendEvent } = useSendEventMutation()
const isBranch = project?.parent_project_ref !== undefined
const projectRef =
project !== undefined ? (isBranch ? project.parent_project_ref : ref) : undefined
@@ -95,6 +98,18 @@ const BranchesPage: NextPageWithLayout = () => {
if (selectedBranchToDelete.project_ref === ref) {
router.push(`/project/${selectedBranchToDelete.parent_project_ref}/branches`)
}
// Track delete button click
sendEvent({
action: 'branch_delete_button_clicked',
properties: {
branchType: selectedBranchToDelete.persistent ? 'persistent' : 'preview',
origin: 'branches_page',
},
groups: {
project: projectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
},
}
)
@@ -23,6 +23,7 @@ import NoPermission from 'components/ui/NoPermission'
import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation'
import { Branch, useBranchesQuery } from 'data/branches/branches-query'
import { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
@@ -83,6 +84,8 @@ const MergeRequestsPage: NextPageWithLayout = () => {
const isError = isErrorConnections || isErrorBranches
const { mutate: sendEvent } = useSendEventMutation()
const { mutate: updateBranch, isLoading: isUpdating } = useBranchUpdateMutation({
onError: () => {
toast.error(`Failed to update the branch`)
@@ -100,6 +103,20 @@ const MergeRequestsPage: NextPageWithLayout = () => {
{
onSuccess: () => {
toast.success('Merge request created')
// Track merge request creation
sendEvent({
action: 'branch_create_merge_request_button_clicked',
properties: {
branchType: branch.persistent ? 'persistent' : 'preview',
origin: 'merge_page',
},
groups: {
project: projectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
router.push(`/project/${branch.project_ref}/merge`)
},
}
@@ -118,6 +135,15 @@ const MergeRequestsPage: NextPageWithLayout = () => {
{
onSuccess: () => {
toast.success('Merge request closed')
// Track merge request closed
sendEvent({
action: 'branch_close_merge_request_button_clicked',
groups: {
project: projectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
},
}
)
@@ -282,6 +308,7 @@ const MergeRequestsPageWrapper = ({ children }: PropsWithChildren<{}>) => {
const router = useRouter()
const { ref } = useParams()
const project = useSelectedProject()
const selectedOrg = useSelectedOrganization()
const gitlessBranching = useIsBranching2Enabled()
const isBranch = project?.parent_project_ref !== undefined
@@ -291,6 +318,8 @@ const MergeRequestsPageWrapper = ({ children }: PropsWithChildren<{}>) => {
const { data: branches } = useBranchesQuery({ projectRef })
const previewBranches = (branches || []).filter((b) => !b.is_default)
const { mutate: sendEvent } = useSendEventMutation()
const { mutate: updateBranch, isLoading: isUpdating } = useBranchUpdateMutation({
onError: () => {
toast.error(`Failed to update the branch`)
@@ -308,6 +337,20 @@ const MergeRequestsPageWrapper = ({ children }: PropsWithChildren<{}>) => {
{
onSuccess: () => {
toast.success('Merge request created')
// Track merge request creation
sendEvent({
action: 'branch_create_merge_request_button_clicked',
properties: {
branchType: branch.persistent ? 'persistent' : 'preview',
origin: 'branch_selector',
},
groups: {
project: projectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
router.push(`/project/${branch.project_ref}/merge`)
},
}
+70
View File
@@ -22,9 +22,11 @@ import { useBranchMergeMutation } from 'data/branches/branch-merge-mutation'
import { useBranchPushMutation } from 'data/branches/branch-push-mutation'
import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation'
import { useBranchesQuery } from 'data/branches/branches-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useBranchMergeDiff } from 'hooks/branches/useBranchMergeDiff'
import { useWorkflowManagement } from 'hooks/branches/useWorkflowManagement'
import { useProjectByRef, useSelectedProject } from 'hooks/misc/useSelectedProject'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import type { NextPageWithLayout } from 'types'
import {
Badge,
@@ -43,6 +45,7 @@ const MergePage: NextPageWithLayout = () => {
const router = useRouter()
const { ref } = useParams()
const project = useSelectedProject()
const selectedOrg = useSelectedOrganization()
const [isSubmitting, setIsSubmitting] = useState(false)
const [workflowFinalStatus, setWorkflowFinalStatus] = useState<string | null>(null)
@@ -192,18 +195,44 @@ const MergePage: NextPageWithLayout = () => {
if (data?.workflow_run_id) {
addWorkflowRun(data.workflow_run_id)
}
// Track branch update
sendEvent({
action: 'branch_updated',
properties: {
source: 'merge_page',
},
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
},
onError: (error) => {
toast.error(`Failed to update branch: ${error.message}`)
},
})
const { mutate: sendEvent } = useSendEventMutation()
const { mutate: mergeBranch, isLoading: isMerging } = useBranchMergeMutation({
onSuccess: (data) => {
setIsSubmitting(false)
if (data.workflowRunId) {
toast.success('Branch merge initiated!')
addWorkflowRun(data.workflowRunId)
// Track successful merge
sendEvent({
action: 'branch_merge_succeeded',
properties: {
branchType: currentBranch?.persistent ? 'persistent' : 'preview',
},
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
} else {
toast.info('No changes to merge')
}
@@ -211,6 +240,19 @@ const MergePage: NextPageWithLayout = () => {
onError: (error) => {
setIsSubmitting(false)
toast.error(`Failed to merge branch: ${error.message}`)
// Track failed merge
sendEvent({
action: 'branch_merge_failed',
properties: {
branchType: currentBranch?.persistent ? 'persistent' : 'preview',
error: error.message,
},
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
},
})
@@ -218,6 +260,17 @@ const MergePage: NextPageWithLayout = () => {
onSuccess: () => {
toast.success('Branch closed successfully')
router.push(`/project/${parentProjectRef}/branches`)
// Track delete button click
sendEvent({
action: 'branch_delete_button_clicked',
properties: {
origin: 'merge_page',
},
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
},
onError: (error) => {
toast.error(`Failed to close branch: ${error.message}`)
@@ -243,6 +296,16 @@ const MergePage: NextPageWithLayout = () => {
const handleMerge = () => {
if (!currentBranch?.id || !parentProjectRef || !ref) return
setIsSubmitting(true)
// Track merge attempt
sendEvent({
action: 'branch_merge_submitted',
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
mergeBranch({
id: currentBranch.id,
branchProjectRef: ref,
@@ -381,6 +444,13 @@ const MergePage: NextPageWithLayout = () => {
onSuccess: () => {
toast.success('Successfully closed merge request')
router.push(`/project/${project?.ref}/branches?tab=prs`)
sendEvent({
action: 'branch_close_merge_request_button_clicked',
groups: {
project: parentProjectRef ?? 'Unknown',
organization: selectedOrg?.slug ?? 'Unknown',
},
})
},
}
)
+226 -207
View File
@@ -9,6 +9,11 @@
* @module telemetry-frontend
*/
type TelemetryGroups = {
project: string
organization: string
}
/**
* Triggered when a user signs up. When signing up with Email and Password, this is only triggered once user confirms their email.
*
@@ -66,10 +71,7 @@ export interface ConnectionStringCopiedEvent {
*/
connectionMethod: 'direct' | 'transaction_pooler' | 'session_pooler'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -91,10 +93,7 @@ export interface CronJobCreatedEvent {
*/
schedule: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -116,10 +115,7 @@ export interface CronJobUpdatedEvent {
*/
schedule: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -131,10 +127,7 @@ export interface CronJobUpdatedEvent {
*/
export interface CronJobDeletedEvent {
action: 'cron_job_deleted'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -146,10 +139,7 @@ export interface CronJobDeletedEvent {
*/
export interface CronJobCreateClickedEvent {
action: 'cron_job_create_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -161,10 +151,7 @@ export interface CronJobCreateClickedEvent {
*/
export interface CronJobUpdateClickedEvent {
action: 'cron_job_update_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -176,10 +163,7 @@ export interface CronJobUpdateClickedEvent {
*/
export interface CronJobDeleteClickedEvent {
action: 'cron_job_delete_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -191,10 +175,7 @@ export interface CronJobDeleteClickedEvent {
*/
export interface CronJobHistoryClickedEvent {
action: 'cron_job_history_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -213,10 +194,7 @@ export interface FeaturePreviewEnabledEvent {
*/
feature: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -235,10 +213,7 @@ export interface FeaturePreviewDisabledEvent {
*/
feature: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -256,10 +231,7 @@ export interface ProjectCreationSimpleVersionSubmittedEvent {
properties: {
instanceSize: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -277,9 +249,7 @@ export interface ProjectCreationSimpleVersionConfirmModalOpenedEvent {
properties: {
instanceSize: string
}
groups: {
organization: string
}
groups: Omit<TelemetryGroups, 'project'>
}
/**
@@ -357,10 +327,7 @@ export interface ProjectCreationSecondStepSubmittedEvent {
*/
export interface RealtimeInspectorListenChannelClickedEvent {
action: 'realtime_inspector_listen_channel_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -372,10 +339,7 @@ export interface RealtimeInspectorListenChannelClickedEvent {
*/
export interface RealtimeInspectorBroadcastSentEvent {
action: 'realtime_inspector_broadcast_sent'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -387,10 +351,7 @@ export interface RealtimeInspectorBroadcastSentEvent {
*/
export interface RealtimeInspectorMessageClickedEvent {
action: 'realtime_inspector_message_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -402,10 +363,7 @@ export interface RealtimeInspectorMessageClickedEvent {
*/
export interface RealtimeInspectorCopyMessageClickedEvent {
action: 'realtime_inspector_copy_message_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -417,10 +375,7 @@ export interface RealtimeInspectorCopyMessageClickedEvent {
*/
export interface RealtimeInspectorFiltersAppliedEvent {
action: 'realtime_inspector_filters_applied'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -432,10 +387,7 @@ export interface RealtimeInspectorFiltersAppliedEvent {
*/
export interface RealtimeInspectorDatabaseRoleUpdatedEvent {
action: 'realtime_inspector_database_role_updated'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -457,10 +409,7 @@ export interface RealtimeToggleTableClickedEvent {
*/
origin: 'tableSidePanel' | 'tableGridHeader'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -478,10 +427,7 @@ export interface SqlEditorQuickstartClickedEvent {
*/
quickstartName: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -499,10 +445,7 @@ export interface SqlEditorTemplateClickedEvent {
*/
templateName: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -514,10 +457,7 @@ export interface SqlEditorTemplateClickedEvent {
*/
export interface SqlEditorResultDownloadCsvClickedEvent {
action: 'sql_editor_result_download_csv_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -529,10 +469,7 @@ export interface SqlEditorResultDownloadCsvClickedEvent {
*/
export interface SqlEditorResultCopyMarkdownClickedEvent {
action: 'sql_editor_result_copy_markdown_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -544,10 +481,7 @@ export interface SqlEditorResultCopyMarkdownClickedEvent {
*/
export interface SqlEditorResultCopyJsonClickedEvent {
action: 'sql_editor_result_copy_json_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -558,10 +492,7 @@ export interface SqlEditorResultCopyJsonClickedEvent {
*/
export interface AssistantPromptSubmittedEvent {
action: 'assistant_prompt_submitted'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -572,10 +503,7 @@ export interface AssistantPromptSubmittedEvent {
*/
export interface AssistantDebugSubmittedEvent {
action: 'assistant_debug_submitted'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -593,10 +521,7 @@ export interface AssistantSuggestionRunQueryClickedEvent {
queryType: string
category?: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -617,10 +542,7 @@ export interface AssistantSqlDiffHandlerEvaluatedEvent {
*/
handlerAccepted: boolean
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -638,10 +560,7 @@ export interface AssistantEditInSqlEditorClickedEvent {
isInSQLEditor: boolean
isInNewSnippet: boolean
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -653,10 +572,7 @@ export interface AssistantEditInSqlEditorClickedEvent {
*/
export interface CustomReportAddSQLBlockClicked {
action: 'custom_report_add_sql_block_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -668,10 +584,7 @@ export interface CustomReportAddSQLBlockClicked {
*/
export interface CustomReportAssistantSQLBlockAddedEvent {
action: 'custom_report_assistant_sql_block_added'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -941,10 +854,7 @@ export interface SignInButtonClickedEvent {
*/
export interface HelpButtonClickedEvent {
action: 'help_button_clicked'
groups: {
project?: string
organization?: string
}
groups: Partial<TelemetryGroups>
}
/**
@@ -955,10 +865,7 @@ export interface HelpButtonClickedEvent {
*/
export interface SendFeedbackButtonClickedEvent {
action: 'send_feedback_button_clicked'
groups: {
project?: string
organization?: string
}
groups: Partial<TelemetryGroups>
}
/**
@@ -976,10 +883,7 @@ export interface ExampleProjectCardClickedEvent {
*/
cardTitle: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -999,10 +903,7 @@ export interface ImportDataButtonClickedEvent {
*/
tableType: 'New Table' | 'Existing Table'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1014,10 +915,7 @@ export interface ImportDataButtonClickedEvent {
*/
export interface ImportDataAddedEvent {
action: 'import_data_added'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1029,10 +927,7 @@ export interface ImportDataAddedEvent {
*/
export interface SqlEditorQueryRunButtonClickedEvent {
action: 'sql_editor_query_run_button_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1054,7 +949,7 @@ export interface StudioPricingPlanCtaClickedEvent {
*/
currentPlan?: string
}
groups: { organization: string }
groups: Omit<TelemetryGroups, 'project'>
}
/**
@@ -1073,7 +968,7 @@ export interface StudioPricingSidePanelOpenedEvent {
*/
origin?: string
}
groups: { organization: string }
groups: Omit<TelemetryGroups, 'project'>
}
/**
@@ -1085,10 +980,7 @@ export interface StudioPricingSidePanelOpenedEvent {
*/
export interface ReportsDatabaseGrafanaBannerClickedEvent {
action: 'reports_database_grafana_banner_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1108,10 +1000,7 @@ export interface EdgeFunctionDeployButtonClickedEvent {
*/
origin: 'functions_editor' | 'functions_ai_assistant'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1123,10 +1012,7 @@ export interface EdgeFunctionDeployButtonClickedEvent {
*/
export interface EdgeFunctionDeployUpdatesConfirmClickedEvent {
action: 'edge_function_deploy_updates_confirm_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1147,10 +1033,7 @@ export interface EdgeFunctionAiAssistantButtonClickedEvent {
*/
origin: 'no_functions_block' | 'secondary_action' | 'functions_editor_chat'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1170,10 +1053,7 @@ export interface EdgeFunctionViaEditorButtonClickedEvent {
*/
origin: 'no_functions_block' | 'secondary_action'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1194,10 +1074,7 @@ export interface EdgeFunctionTemplateClickedEvent {
*/
origin: 'functions_page' | 'editor_page'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1217,10 +1094,7 @@ export interface EdgeFunctionViaCliButtonClickedEvent {
*/
origin: 'no_functions_block' | 'secondary_action'
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1232,10 +1106,7 @@ export interface EdgeFunctionViaCliButtonClickedEvent {
*/
export interface EdgeFunctionDeployUpdatesButtonClickedEvent {
action: 'edge_function_deploy_updates_button_clicked'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1253,10 +1124,7 @@ export interface EdgeFunctionTestSendButtonClickedEvent {
*/
httpMethod: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1268,10 +1136,7 @@ export interface EdgeFunctionTestSendButtonClickedEvent {
*/
export interface EdgeFunctionTestSidePanelOpenedEvent {
action: 'edge_function_test_side_panel_opened'
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1286,10 +1151,7 @@ export interface SupportTicketSubmittedEvent {
properties: {
ticketCategory: string
}
groups: {
project?: string
organization?: string
}
groups: Partial<TelemetryGroups>
}
/**
@@ -1302,10 +1164,7 @@ export interface SupportTicketSubmittedEvent {
*/
export interface AiAssistantInSupportFormClickedEvent {
action: 'ai_assistant_in_support_form_clicked'
groups: {
project?: string
organization?: string
}
groups: Partial<TelemetryGroups>
}
/**
@@ -1337,9 +1196,7 @@ export interface OrganizationMfaEnforcementUpdated {
properties: {
mfaEnforced: boolean
}
groups: {
organization: string
}
groups: Omit<TelemetryGroups, 'project'>
}
/**
@@ -1357,10 +1214,7 @@ export interface ForeignDataWrapperCreatedEvent {
*/
wrapperType: string
}
groups: {
project: string
organization: string
}
groups: TelemetryGroups
}
/**
@@ -1378,10 +1232,166 @@ export interface StorageBucketCreatedEvent {
*/
bucketType?: string
}
groups: {
project: string
organization: string
groups: TelemetryGroups
}
/**
* Triggered when a new branch is created.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/branches
*/
export interface BranchCreateButtonClickedEvent {
action: 'branch_create_button_clicked'
properties: {
/**
* The type of branch created, e.g. preview, persistent
*/
branchType: 'preview' | 'persistent'
/**
* Whether the branch was created with a git branch association
*/
gitlessBranching: boolean
}
groups: TelemetryGroups
}
/**
* Triggered when a branch delete button is clicked.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/branches
*/
export interface BranchDeleteButtonClickedEvent {
action: 'branch_delete_button_clicked'
properties: {
/**
* The type of branch being deleted, e.g. preview, persistent
*/
branchType?: 'preview' | 'persistent'
/**
* Where the delete action was initiated from
*/
origin: 'branches_page' | 'merge_page'
}
groups: TelemetryGroups
}
/**
* Triggered when a create merge request is clicked for a branch.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/branches
*/
export interface BranchCreateMergeRequestButtonClickedEvent {
action: 'branch_create_merge_request_button_clicked'
properties: {
/**
* The type of branch being merged, e.g. preview, persistent
*/
branchType: 'preview' | 'persistent'
origin: 'header' | 'merge_page' | 'branch_selector'
}
groups: TelemetryGroups
}
/**
* Triggered when a merge request is closed.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/branches/merge-requests
*/
export interface BranchCloseMergeRequestButtonClickedEvent {
action: 'branch_close_merge_request_button_clicked'
groups: TelemetryGroups
}
/**
* Triggered when a user clicks the merge button successfully to attempt merging a branch.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/merge
*/
export interface BranchMergeSubmittedEvent {
action: 'branch_merge_submitted'
groups: TelemetryGroups
}
/**
* Triggered when a branch merge is successful.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/merge
*/
export interface BranchMergeSucceededEvent {
action: 'branch_merge_succeeded'
properties: {
/**
* The type of branch being merged, e.g. preview, persistent
*/
branchType: 'preview' | 'persistent'
}
groups: TelemetryGroups
}
/**
* Triggered when a branch merge fails.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/merge
*/
export interface BranchMergeFailedEvent {
action: 'branch_merge_failed'
properties: {
/**
* The type of branch being merged, e.g. preview, persistent
*/
branchType: 'preview' | 'persistent'
/**
* The error message or reason for failure
*/
error?: string
}
groups: TelemetryGroups
}
/**
* Triggered when a branch is updated on push with latest changes from production.
* Does not include renaming and linking to GitHub branch.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/merge
*/
export interface BranchUpdatedEvent {
action: 'branch_updated'
properties: {
/**
* The source of the update action
*/
source: 'merge_page' | 'out_of_date_notice'
modifiedEdgeFunctions?: boolean
}
groups: TelemetryGroups
}
/**
* Triggered when a user clicks the review with assistant button for a merge.
*
* @group Events
* @source studio
* @page /dashboard/project/{ref}/merge
*/
export interface BranchReviewWithAssistantClickedEvent {
action: 'branch_review_with_assistant_clicked'
groups: TelemetryGroups
}
/**
@@ -1465,3 +1475,12 @@ export type TelemetryEvent =
| OrganizationMfaEnforcementUpdated
| ForeignDataWrapperCreatedEvent
| StorageBucketCreatedEvent
| BranchCreateButtonClickedEvent
| BranchDeleteButtonClickedEvent
| BranchCreateMergeRequestButtonClickedEvent
| BranchCloseMergeRequestButtonClickedEvent
| BranchMergeSubmittedEvent
| BranchMergeSucceededEvent
| BranchMergeFailedEvent
| BranchUpdatedEvent
| BranchReviewWithAssistantClickedEvent