feat(telemetry): add workflow_opened with open_source and missing node metrics (#6476)

- Adds app:workflow_opened and plumbs open_source across drag/drop,
file-open button, workspace, and templates
- Tracks missing_node_count and missing_node_types for both
workflow_opened and workflow_imported
- Reuses WorkflowOpenSource type for consistency; no breaking changes to
loadGraphData callers (5th param remains options object; openSource
optional)

Validation
- pnpm lint:fix
- pnpm typecheck

Notes
- Telemetry only runs in cloud builds; OSS remains clean.
- loadGraphData telemetry is centralized where missing_node_types is
computed.

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

---------

Co-authored-by: bymyself <cbyrne@comfy.org>
This commit is contained in:
Benjamin Lu
2025-10-31 14:51:16 -07:00
committed by GitHub
parent a537124a9f
commit 6abff41f08
5 changed files with 80 additions and 26 deletions

View File

@@ -244,6 +244,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

@@ -113,8 +113,22 @@ export interface CreditTopupMetadata {
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
*/
@@ -205,6 +219,7 @@ export interface TelemetryProvider {
// Workflow management events
trackWorkflowImported(metadata: WorkflowImportMetadata): void
trackWorkflowOpened(metadata: WorkflowImportMetadata): void
// Page visibility events
trackPageVisibilityChanged(metadata: PageVisibilityMetadata): void
@@ -262,6 +277,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',