-
Notifications
You must be signed in to change notification settings - Fork 447
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) add telemetry scaffolding #5321
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
No changes to documentation |
Component Testing Report Updated Dec 18, 2023 1:55 PM (UTC)
|
c1aeedb
to
4b68c44
Compare
4b68c44
to
675781c
Compare
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
675781c
to
ea8db9e
Compare
ea8db9e
to
a919840
Compare
a919840
to
36311e8
Compare
36311e8
to
6c225a7
Compare
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.
looks good! will review again once this points to prod instead of staging
@@ -0,0 +1,5 @@ | |||
/* eslint-disable no-process-env */ | |||
export const isCi = | |||
process.env.CI || // Travis CI, CircleCI, Gitlab CI, Appveyor, CodeShip |
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.
would it be better to wrap these each in isTrueish
?
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.
Great callout. Will fix.
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.
Fixed (left process.env.BUILD_NUMBER out since I don't know for sure whether BUILD_NUMBER=0
is a valid status)
@@ -81,11 +81,7 @@ export class CommandRunner { | |||
const output = this.handlers.outputter | |||
const prompt = this.handlers.prompter | |||
|
|||
const {cliConfig, ...commandOptions} = options | |||
const apiClient = getClientWrapper( |
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.
more curious than anything: why did you move the apiClient
initialization into the CommandRunner
? I didn't see this new key used anywhere in the PR.
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.
Good question. It made sense at an earlier point during development. Reverting this. Thanks!
@@ -76,6 +87,11 @@ export async function runCli(cliRoot: string, {cliVersion}: {cliVersion: string} | |||
args.groupOrCommand = 'help' | |||
} | |||
|
|||
if (args.groupOrCommand === 'logout') { | |||
// flush telemetry events before logging out | |||
await flushTelemetry() |
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.
why is this here instead of in the logoutCommand
code?
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.
trying to keep the interface exposed to subcommands minimal, so wanted to avoid passing the flush
method to subcommands at this point. We might change this later if we see that it's something we want subcommands to be able to do, but for now it made sense to special case this here.
dfab462
to
d86ed77
Compare
@@ -76,6 +87,11 @@ export async function runCli(cliRoot: string, {cliVersion}: {cliVersion: string} | |||
args.groupOrCommand = 'help' | |||
} | |||
|
|||
if (args.groupOrCommand === 'logout') { | |||
// flush telemetry events before logging out | |||
await flushTelemetry() |
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.
trying to keep the interface exposed to subcommands minimal, so wanted to avoid passing the flush
method to subcommands at this point. We might change this later if we see that it's something we want subcommands to be able to do, but for now it made sense to special case this here.
@@ -0,0 +1,5 @@ | |||
/* eslint-disable no-process-env */ | |||
export const isCi = | |||
process.env.CI || // Travis CI, CircleCI, Gitlab CI, Appveyor, CodeShip |
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.
Great callout. Will fix.
@@ -81,11 +81,7 @@ export class CommandRunner { | |||
const output = this.handlers.outputter | |||
const prompt = this.handlers.prompter | |||
|
|||
const {cliConfig, ...commandOptions} = options | |||
const apiClient = getClientWrapper( |
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.
Good question. It made sense at an earlier point during development. Reverting this. Thanks!
d86ed77
to
ec652fe
Compare
* fix(deps): add telemetry package as cli dependency * feat(cli): add telemetry scaffolding for CLI * fix(cli): flush telemetry store before logging out * refactor(cli): abstract continuous integration check * feat(cli): treat telemetry consent as denied when running in CI * fix(cli): parse trueish env vars when detecting ci environment * fixup! feat(cli): add telemetry scaffolding for CLI --------- Co-authored-by: Ash <[email protected]>
Description
Adds telemetry scaffolding to the cli package. The actual instrumentation is added in #5320, CLI commands for opting in and out of telemetry is added in #5322.
A tagged release of this and the other relevant PRs for telemetry can be tested using:
…and then running against staging (for now):
Other relevant env vars:
SANITY_TELEMETRY_INSPECT=1
: append all logged events to telemetry-events.ndjson in current workdir (note: the output file will not be cleared between cli runs)DEBUG=sanity:cli:telemetry
: log telemetry related debug information as the CLI runs.E.g. to test the create project flow, with debug info and logging events to file, you can use:
What to review
Notes for release
TBD