Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Implement telemetry in cli #1226

Merged
merged 50 commits into from
Oct 18, 2019
Merged

Implement telemetry in cli #1226

merged 50 commits into from
Oct 18, 2019

Conversation

jbcarpanelli
Copy link
Contributor

@jbcarpanelli jbcarpanelli commented Sep 10, 2019

This PR implements telemetry to the cli package.

TODO:

  • Add tests.
  • Disable interactive prompt for telemetry (this is the reason why tests are failing).
  • Disable telemetry in CI environments.
  • Write document explaining data collected and how it's anonymized. @frangio should we update this PR description with the document you wrote?
  • Do not hash the network name.

Out of scope:

  • Batch telemetry reports while offline.
  • Postpone first telemetry prompt until after running a couple of commands.

const { telemetry } = await inquirer.prompt({
name: 'telemetry',
type: 'confirm',
message: 'telemetry?',
Copy link
Contributor

@frangio frangio Sep 18, 2019

Choose a reason for hiding this comment

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

I want advice from legal on what should be the wording here.

ylv-io
ylv-io previously requested changes Sep 18, 2019
Copy link
Contributor

@ylv-io ylv-io left a comment

Choose a reason for hiding this comment

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

Hey @frangio and @jcarpanelli! Amazing job in a such short time! 🚢 🍾
Tests are especially well written!
I've left a few comments mostly TypeScript related - Make SKD Typed Again!

@@ -24,6 +24,8 @@ const TruffleConfig = {
if (!networkList[network])
throw Error(`Given network '${network}' is not defined in your ${this.getTruffleConfigFileName(path)} file`);
config.network = network;
config.networkId = config.network_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like textbook bad code. Why do we need networkId and network_id fields on the same object?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I feel TruffleConfig is important enough to receive a type instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need networkId and network_id fields on the same object?

We considered deleting network_id, but decided to keep it in case it would break something else. I would be okay with deleting it. Would that be better for you?

packages/cli/src/telemetry.ts Outdated Show resolved Hide resolved

function hashField(field: Field, salt: string): string {
const hash = crypto.createHash('sha256');
hash.update(salt);
Copy link
Contributor

@ylv-io ylv-io Sep 18, 2019

Choose a reason for hiding this comment

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

Let's check here if (salt) because if files will be corrupted we salt with empty string.

Copy link
Contributor

Choose a reason for hiding this comment

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

What kind of scenario would we be trying to cover for here?

I'm not sure it's worth checking for the empty string. It would be just as bad if we were using any other non-random salt, and there's no way to check for all of them.

packages/cli/src/telemetry.ts Outdated Show resolved Hide resolved
packages/cli/src/telemetry.ts Outdated Show resolved Hide resolved
packages/cli/src/telemetry.ts Outdated Show resolved Hide resolved
packages/cli/src/telemetry.ts Outdated Show resolved Hide resolved
@frangio
Copy link
Contributor

frangio commented Sep 19, 2019

I was thinking we might want to also log the version of the CLI that is running.

@frangio frangio force-pushed the feature/telemetry branch 2 times, most recently from ca43e44 to c19b5ee Compare October 10, 2019 18:35
@frangio
Copy link
Contributor

frangio commented Oct 11, 2019

The only thing failing is an unrelated test about solc. I have no idea why. It's not failing on master.

packages/cli/src/commands/init.ts Show resolved Hide resolved
packages/cli/src/telemetry/index.ts Outdated Show resolved Hide resolved
packages/cli/src/telemetry/index.ts Outdated Show resolved Hide resolved
packages/cli/src/telemetry/index.ts Outdated Show resolved Hide resolved
packages/cli/src/telemetry/index.ts Show resolved Hide resolved
packages/cli/src/telemetry/index.ts Show resolved Hide resolved
packages/cli/src/telemetry/index.ts Show resolved Hide resolved
@spalladino spalladino added the status:changes-requested PR needs changes before approving label Oct 18, 2019
jbcarpanelli and others added 17 commits October 18, 2019 17:59
Co-authored-by: Francisco Giordano <[email protected]>
Co-authored-by: Francisco Giordano <[email protected]>
Co-authored-by: Francisco Giordano <[email protected]>
Co-authored-by: Francisco Giordano <[email protected]>
Co-authored-by: Francisco Giordano <[email protected]>
Co-authored-by: Francisco Giordano <[email protected]>
Co-authored-by: Francisco Giordano <[email protected]>
@frangio frangio dismissed ylv-io’s stale review October 18, 2019 22:06

Changes have been implemented

@frangio frangio added status:ready-to-merge Order mergify to merge and removed status:changes-requested PR needs changes before approving labels Oct 18, 2019
@frangio frangio merged commit 7502b9d into master Oct 18, 2019
@frangio frangio deleted the feature/telemetry branch October 18, 2019 22:42
@frangio
Copy link
Contributor

frangio commented Oct 18, 2019

Thanks everyone! 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready-to-merge Order mergify to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants