Skip to content
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

feat(cli): collect cli analytics #3185

Closed
wants to merge 35 commits into from
Closed

Conversation

hasanaburayyan
Copy link
Contributor

@hasanaburayyan hasanaburayyan commented Jun 30, 2023

This is just the initial thought dump I have done so far on setting up CLI analytics for anyone who may be interested in seeing the code before its ready for review 😁

Currently this PR introduces some recorded analytics that can be opted out of using WING_DISABLE_ANALYTICS env var.

This is an example of what the metrics currently look like in segment
image

Implementation Details

In order to ensure we are not slowing down the user experience when running any CLI command, the process for collecting metrics works in 3 main components. Similar to how other CLI tools I have come across collect metrics.

  • Collector: Which is responsible for gathering up all the analytics we care about during runtime of the CLI.
  • Storage: The analytics gathered by the collector are stored on disk. The storage will house the events until the exporter is able to report the events back to segment
  • Exporter: To avoid any long delays in the CLI commands, the exporter is run as a detached process when the CLI command is complete.

Right now the best way I am seeing to collect cli command specific data is by using Commander hooks around all the commands we want to collect analytics from (which right now I have as all of them)

Misc

To make testing easier right now im just storing analytics in cwd but I plan to move this storage file to the user's home directory under .wing

TODO:

  • Add notification on first run about analytic collection
  • Docs
    • Document all data being collected
    • Document opt-out policy
  • Determine if CLI called within CI
  • Collect git metrics (if exists)
  • Legal review
  • Github disclaimer
  • Setup privacy email
  • Use tmp dir for analytics storage
  • Consider best way to manage WriteKey for segment

Closes: #2928
Closes: #2974

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Monada Contribution License.

@hasanaburayyan hasanaburayyan force-pushed the hasan/cli-analytics branch 3 times, most recently from e721d2f to f445075 Compare July 6, 2023 20:16
@hasanaburayyan hasanaburayyan changed the title [WIP] feat(cli): collect cli analytics feat(cli): collect cli analytics Jul 6, 2023
@hasanaburayyan
Copy link
Contributor Author

Re-opened in another PR: #3310

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.

Print pre-release +analytics disclaimer on first run of Wing CLI wing cli analytics
2 participants