Skip to content

ENG-1972 Improve telemetry for imports and relation creation#1178

Draft
mdroidian wants to merge 1 commit into
mainfrom
cursor/eng-1972-improve-telemetry-d248
Draft

ENG-1972 Improve telemetry for imports and relation creation#1178
mdroidian wants to merge 1 commit into
mainfrom
cursor/eng-1972-improve-telemetry-d248

Conversation

@mdroidian

Copy link
Copy Markdown
Member

Summary

This PR improves telemetry for imports and relation creation to enable accurate weekly all-hands metrics reporting and clearer event tracking.

Changes

Relation Type Creation

  • Renamed Discourse Relation: CreatedDiscourse Relation Type: Created
    • Location: DiscourseRelationConfigPanel.tsx
    • Clarifies that this event tracks relation schema/type creation, not instance creation

Relation Instance Creation

  • Added Discourse Relation Instance: Created event after createReifiedRelation succeeds
    • Emitted from 3 surfaces:
      • create-relation-dialog - when user creates relation via dialog
      • suggestive-mode - when suggestion is adopted
      • canvas - when relation arrow is finalized
    • Payload includes:
      • relationUid - the relation type ID
      • relationLabel - the relation type label
      • source - the surface/feature where relation was created
    • Modified files:
      • CreateRelationDialog.tsx
      • SuggestionsBody.tsx
      • DiscourseRelationUtil.tsx (added posthog import)

Import Completion

  • Added Import Dialog: Import Completed event after successful import
    • Payload includes:
      • title - the import title
      • nodeCount - number of imported nodes
      • relationCount - number of imported relations
  • Added Import Dialog: Import Failed event with error details
  • Improved error handling in import flow
  • Modified file: ImportDialog.tsx

Testing

  • Added comprehensive telemetry event schema tests
    • Documents expected payload structure for all new events
    • Validates property types and required fields
    • Tests payload extraction logic
    • Location: apps/roam/src/utils/__tests__/telemetryEvents.test.ts

Impact

  • Weekly all-hands metrics can now accurately report:
    • Imported node and relation counts (via completion events, not just started events)
    • Relation instance creation (separate from relation type creation)
  • PostHog taxonomy now has clear separation between:
    • Relation type creation vs. relation instance creation
    • Import start vs. completion vs. failure
  • Event names and properties are stable for future weekly comparison renders

Out of Scope

  • No changes to Obsidian extension (has no telemetry infrastructure)
  • Migration events already tracked separately via Stored Relations: Migration Started/Completed
  • No sensitive graph/user content sent - only counts and low-risk metadata

Testing

  • Created comprehensive schema validation tests for all telemetry events
  • Verified payload structures match requirements
  • Tested error handling for import failures

Fixes ENG-1972

Linear Issue: ENG-1972

Open in Web Open in Cursor 

- Rename 'Discourse Relation: Created' to 'Discourse Relation Type: Created' for clarity
- Add 'Discourse Relation Instance: Created' event after createReifiedRelation succeeds
  - Tracks relation instance creation from create-relation-dialog, suggestive-mode, and canvas
  - Includes relationUid, relationLabel, and source surface metadata
- Add 'Import Dialog: Import Completed' event with node and relation counts
- Add 'Import Dialog: Import Failed' event with error details
- Add comprehensive telemetry event schema tests

Addresses ENG-1972

Co-authored-by: Michael Gartner <mdroidian@users.noreply.github.com>
@linear-code

linear-code Bot commented Jun 30, 2026

Copy link
Copy Markdown

ENG-1972

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
discourse-graph Skipped Skipped Jun 30, 2026 3:53pm

Request Review

@supabase

supabase Bot commented Jun 30, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants