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

Add telemetry enable/disable command #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add telemetry enable/disable command #2

wants to merge 4 commits into from

Conversation

lizard-boy
Copy link

No description provided.

@lizard-boy
Copy link
Author

@greptileai

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces a new 'telemetry' command to the Vercel CLI, allowing users to manage telemetry collection settings.

  • Added packages/cli/src/commands/telemetry/ directory with new files for enabling, disabling, and checking telemetry status
  • Modified packages/cli/src/index.ts to include the new telemetry command and adjust initialization order
  • Updated internals/types/index.d.ts to replace collectMetrics with a more granular telemetry property in GlobalConfig
  • Implemented unit tests in packages/cli/test/unit/commands/telemetry/index.test.ts to ensure proper functionality of the new command

11 file(s) reviewed, 11 comment(s)
Edit PR Review Bot Settings

@@ -40,5 +40,6 @@ export default new Map([
['targets', 'target'],
['team', 'teams'],
['teams', 'teams'],
['telemetry', 'telemetry'],
Copy link

Choose a reason for hiding this comment

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

style: Consider adding a comment explaining the purpose of the telemetry command for better code documentation

description: 'Shows whether telemetry collection is enabled or disabled',
arguments: [],
options: [],
examples: [],
Copy link

Choose a reason for hiding this comment

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

style: Add an example for the 'status' subcommand to improve user guidance

description: 'Enables telemetry collection',
arguments: [],
options: [],
examples: [],
Copy link

Choose a reason for hiding this comment

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

style: Add an example for the 'enable' subcommand to improve user guidance

description: 'Disables telemetry collection',
arguments: [],
options: [],
examples: [],
Copy link

Choose a reason for hiding this comment

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

style: Add an example for the 'disable' subcommand to improve user guidance

Comment on lines +31 to +35
if (parsedArguments.flags['--help']) {
client.output.print(
help(telemetryCommand, { columns: client.stderr.columns })
);
}
Copy link

Choose a reason for hiding this comment

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

logic: The function returns undefined after printing help. Consider returning 0 to indicate successful execution.

Comment on lines +37 to +40
const { subcommand } = getSubcommand(
parsedArguments.args.slice(1),
COMMAND_CONFIG
);
Copy link

Choose a reason for hiding this comment

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

style: Consider using parsedArguments.args[1] instead of slicing, as you're only interested in the second argument.

Comment on lines +5 to +6
const status: 'disabled' | 'enabled' =
client.config.telemetry?.enabled === false ? 'disabled' : 'enabled';
Copy link

Choose a reason for hiding this comment

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

style: Consider using a boolean type for status instead of string literals

@@ -134,12 +141,19 @@ export class TelemetryEventStore {
this.events = [];
}

enabled() {
return this.config?.enabled === false ? false : true;
Copy link

Choose a reason for hiding this comment

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

style: Consider simplifying this to return this.config?.enabled !== false; for better readability

Comment on lines +155 to +157
if (this.enabled()) {
// send events to the server
}
Copy link

Choose a reason for hiding this comment

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

logic: Implement the logic to send events to the server

Comment on lines +119 to +123
constructor(opts: {
output: Output;
isDebug?: boolean;
config: GlobalConfig['telemetry'];
}) {
Copy link

Choose a reason for hiding this comment

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

style: Consider making config a required parameter to ensure it's always provided

@grepdemos grepdemos deleted a comment from greptile-apps bot Oct 2, 2024
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