-
Notifications
You must be signed in to change notification settings - Fork 52
feat(telemetry): add PostHog event tracking to publish and run commands #1607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
commit: |
.vscode/settings.json
Outdated
}, | ||
"[jsonc]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
…o-release workflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new telemetry system for the Codemod CLI that tracks usage analytics via PostHog. The implementation adds event tracking to the publish
and run
commands to gather insights on how these features are being used in practice.
- Added a new
codemod-telemetry
crate with PostHog integration and null sender for opt-out scenarios - Integrated telemetry into
codemod publish
andcodemod run
commands with execution statistics - Added environment variable support for disabling analytics and build-time PostHog API key injection
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
crates/telemetry/* | New telemetry crate with PostHog sender and null sender implementations |
crates/core/src/engine.rs | Added global execution statistics tracking via OnceLock |
crates/cli/src/main.rs | Integrated telemetry sender initialization and dependency injection |
crates/cli/src/commands/run.rs | Added telemetry events for codemod execution with success/failure tracking |
crates/cli/src/commands/publish.rs | Added telemetry event for successful codemod publishing |
Cargo.toml files | Updated dependencies and workspace configuration |
.github/workflows/cargo-release.yml | Added PostHog API key environment variable for builds |
crates/cli/src/commands/run.rs
Outdated
None, | ||
) | ||
.await; | ||
return Err(anyhow::anyhow!("Error executing codemod: {}", e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original error information is being lost by wrapping it in a new anyhow error with just the Display representation. Consider using return Err(e)
or .context()
to preserve the error chain.
Copilot uses AI. Check for mistakes.
📚 Description
This PR introduces a new
telemetry
crate and integrates PostHog event tracking into thepublish
andrun
commands. The goal is to help Codemod better understand how these commands are being used in practice and gather insights for future improvements.telemetry
crate for sending eventscodemod publish
codemod run
This lays the foundation for richer product analytics across the CLI.
🧪 Test Plan
codemod publish
andcodemod run
locally with a valid PostHog token