Skip to content

Add plugin install/uninstall/upgrade analytics#1727

Open
vcheung-stripe wants to merge 6 commits into
masterfrom
vcheung-plugin-install-telemetry
Open

Add plugin install/uninstall/upgrade analytics#1727
vcheung-stripe wants to merge 6 commits into
masterfrom
vcheung-plugin-install-telemetry

Conversation

@vcheung-stripe

Copy link
Copy Markdown
Collaborator

Track plugin lifecycle events (Plugin Installed, Plugin Upgraded, Plugin Uninstalled) with name, version, CLI version, OS, CPU arch, a persistent machine UUID stored in config.toml, and merchant ID when authenticated.

Here's where the machine UUID is in the config file, we'll eventually use this in more than just analytics:

color = ''
installed_plugins = []
machine_uuid = '44d7bb37-055e-4aa3-9306-a39d7d2e083b'
project-name = 'default'
...

I verified the events in our backend logs.

@vcheung-stripe vcheung-stripe requested a review from a team as a code owner July 1, 2026 19:53
@vcheung-stripe vcheung-stripe force-pushed the vcheung-plugin-install-telemetry branch from 4500e14 to 363ceb3 Compare July 1, 2026 20:59
Comment thread pkg/cmd/plugin/upgrade.go Outdated
return err
}

sendPluginLifecycleEvent(cmd.Context(), "Plugin Installed", version)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want plugin upgraded here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that would be useful!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to "Plugin Upgraded" when using stripe plugin upgrade, or stripe plugin install while already having it installed. We could also capture the previous version, but I'm not sure how useful that is.

@yahanxing-stripe yahanxing-stripe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

vcheung-stripe and others added 6 commits July 13, 2026 10:54
Track plugin lifecycle events (Plugin Installed, Plugin Upgraded,
Plugin Uninstalled) with name, version, CLI version, OS, CPU arch,
a persistent machine UUID stored in config.toml, and merchant ID
when authenticated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
viper.Reset() (called from GetMachineUUID → WriteConfigField) clears pflag
bindings, causing ReBindKeys to clobber flags the user explicitly passed on
the command line with env var values (e.g. STRIPE_PROJECT_NAME in CI).

Guard each key with pflag.Changed so we skip the override when the flag was
provided explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
Verifies that ReBindKeys skips flags explicitly set on the command line
after viper.Reset() clears the pflag binding (the condition that caused
the CI failure of TestReadProjectFromFlag).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
@vcheung-stripe vcheung-stripe force-pushed the vcheung-plugin-install-telemetry branch from ae2ab69 to 8642bd6 Compare July 13, 2026 17:55
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.

3 participants