Backport: telemetry workflow_opened with open_source and missing node metrics (#6476) (#6497)

Backport of #6476 onto rh-test.

- Adds telemetry events for `workflow_opened` and `workflow_imported`
including `open_source` and missing node metrics.
- Resolves merge conflict in `src/scripts/app.ts` by keeping the
telemetry block after `afterConfigureGraph`.
- Includes template load and file input changes to pass `openSource`.

Files changed:
- src/platform/telemetry/providers/cloud/MixpanelTelemetryProvider.ts
- src/platform/telemetry/types.ts
- src/platform/workflow/templates/composables/useTemplateWorkflows.ts
- src/scripts/app.ts
- src/scripts/ui.ts

Validated with `pnpm lint:fix` and `pnpm typecheck`.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6497-Backport-telemetry-workflow_opened-with-open_source-and-missing-node-metrics-6476-29e6d73d365081238b8cef1d1a44287f)
by [Unito](https://www.unito.io)

Co-authored-by: bymyself <cbyrne@comfy.org>
This commit is contained in:
Benjamin Lu
2025-11-01 01:38:42 -07:00
committed by GitHub
parent c5acb39c30
commit 4412ae4bff
5 changed files with 83 additions and 22 deletions

View File

@@ -371,6 +371,10 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
this.trackEvent(TelemetryEvents.WORKFLOW_IMPORTED, metadata)
}
trackWorkflowOpened(metadata: WorkflowImportMetadata): void {
this.trackEvent(TelemetryEvents.WORKFLOW_OPENED, metadata)
}
trackPageVisibilityChanged(metadata: PageVisibilityMetadata): void {
this.trackEvent(TelemetryEvents.PAGE_VISIBILITY_CHANGED, metadata)
}

View File

@@ -95,8 +95,22 @@ export interface TemplateMetadata {
export interface WorkflowImportMetadata {
missing_node_count: number
missing_node_types: string[]
/**
* The source of the workflow open/import action
*/
open_source?: 'file_button' | 'file_drop' | 'template' | 'unknown'
}
/**
* Workflow open metadata
*/
/**
* Enumerated sources for workflow open/import actions.
*/
export type WorkflowOpenSource = NonNullable<
WorkflowImportMetadata['open_source']
>
/**
* Template library metadata
*/
@@ -181,6 +195,7 @@ export interface TelemetryProvider {
// Workflow management events
trackWorkflowImported(metadata: WorkflowImportMetadata): void
trackWorkflowOpened(metadata: WorkflowImportMetadata): void
// Page visibility events
trackPageVisibilityChanged(metadata: PageVisibilityMetadata): void
@@ -233,6 +248,7 @@ export const TelemetryEvents = {
// Workflow Management
WORKFLOW_IMPORTED: 'app:workflow_imported',
WORKFLOW_OPENED: 'app:workflow_opened',
// Page Visibility
PAGE_VISIBILITY_CHANGED: 'app:page_visibility_changed',

View File

@@ -138,7 +138,9 @@ export function useTemplateWorkflows() {
}
dialogStore.closeDialog()
await app.loadGraphData(json, true, true, workflowName)
await app.loadGraphData(json, true, true, workflowName, {
openSource: 'template'
})
return true
}
@@ -159,7 +161,9 @@ export function useTemplateWorkflows() {
}
dialogStore.closeDialog()
await app.loadGraphData(json, true, true, workflowName)
await app.loadGraphData(json, true, true, workflowName, {
openSource: 'template'
})
return true
} catch (error) {