chore: add bucket creation tracking (#37213)
This commit is contained in:
@@ -18,6 +18,8 @@ import {
|
||||
import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
|
||||
import { useBucketCreateMutation } from 'data/storage/bucket-create-mutation'
|
||||
import { useIcebergWrapperCreateMutation } from 'data/storage/iceberg-wrapper-create-mutation'
|
||||
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
|
||||
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
||||
import { BASE_PATH, IS_PLATFORM } from 'lib/constants'
|
||||
import {
|
||||
Alert_Shadcn_,
|
||||
@@ -74,6 +76,8 @@ export type CreateBucketForm = z.infer<typeof FormSchema>
|
||||
|
||||
const CreateBucketModal = ({ visible, onClose }: CreateBucketModalProps) => {
|
||||
const { ref } = useParams()
|
||||
const org = useSelectedOrganization()
|
||||
const { mutate: sendEvent } = useSendEventMutation()
|
||||
const router = useRouter()
|
||||
|
||||
const { mutateAsync: createBucket, isLoading: isCreating } = useBucketCreateMutation()
|
||||
@@ -134,6 +138,11 @@ const CreateBucketModal = ({ visible, onClose }: CreateBucketModalProps) => {
|
||||
file_size_limit: fileSizeLimit,
|
||||
allowed_mime_types: allowedMimeTypes,
|
||||
})
|
||||
sendEvent({
|
||||
action: 'storage_bucket_created',
|
||||
properties: { bucketType: values.type },
|
||||
groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' },
|
||||
})
|
||||
|
||||
if (values.type === 'ANALYTICS' && icebergWrapperExtensionState === 'installed') {
|
||||
await createIcebergWrapper({ bucketName: values.name })
|
||||
|
||||
@@ -1363,6 +1363,27 @@ export interface ForeignDataWrapperCreatedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when a new storage bucket is created in a project.
|
||||
*
|
||||
* @group Events
|
||||
* @source studio
|
||||
* @page /dashboard/project/{ref}/storage/buckets
|
||||
*/
|
||||
export interface StorageBucketCreatedEvent {
|
||||
action: 'storage_bucket_created'
|
||||
properties: {
|
||||
/**
|
||||
* The type of the bucket created. E.g. standard or analytics iceberg.
|
||||
*/
|
||||
bucketType?: string
|
||||
}
|
||||
groups: {
|
||||
project: string
|
||||
organization: string
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@@ -1443,3 +1464,4 @@ export type TelemetryEvent =
|
||||
| AiAssistantInSupportFormClickedEvent
|
||||
| OrganizationMfaEnforcementUpdated
|
||||
| ForeignDataWrapperCreatedEvent
|
||||
| StorageBucketCreatedEvent
|
||||
|
||||
Reference in New Issue
Block a user