Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(turbo-ignore): usage metrics (#7897)
### Description Anonymous usage metrics for turbo-ignore. Will help inform future roadmap for the tool.
- Loading branch information
Showing
12 changed files
with
204 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,81 @@ | ||
import { name } from "ci-info"; | ||
import { TelemetryClient } from "../client"; | ||
import type { Event } from "./types"; | ||
|
||
const TASK_ALLOWLIST: Readonly<Array<string>> = [ | ||
"build", | ||
"test", | ||
"lint", | ||
"typecheck", | ||
"checktypes", | ||
"check-types", | ||
"type-check", | ||
"check", | ||
] as const; | ||
|
||
export class TurboIgnoreTelemetry extends TelemetryClient { | ||
trackExecutionEnv(): Event | undefined { | ||
trackCI(): Event | undefined { | ||
return this.track({ | ||
key: "execution_env", | ||
value: process.env.VERCEL === "1" ? "vercel" : "local", | ||
key: "ci", | ||
value: name ?? "unknown", | ||
}); | ||
} | ||
|
||
/** | ||
* Track the workspace argument if it's provided. | ||
* We only track if it's provided, not what it was | ||
*/ | ||
trackArgumentWorkspace(provided: boolean): Event | undefined { | ||
if (provided) { | ||
return this.trackCliArgument({ | ||
argument: "workspace", | ||
value: "provided", | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Track the task option if it's provided. | ||
* We only track the exact task name if it's in the allowlist | ||
* Otherwise, we track it as "other" | ||
*/ | ||
trackOptionTask(value: string | undefined): Event | undefined { | ||
if (value) { | ||
return this.trackCliOption({ | ||
option: "task", | ||
value: TASK_ALLOWLIST.includes(value) ? value : "other", | ||
}); | ||
} | ||
} | ||
|
||
trackOptionFallback(value: string | undefined): Event | undefined { | ||
if (value) { | ||
return this.trackCliOption({ | ||
option: "fallback", | ||
value, | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Track the directory argument if it's provided. | ||
* We only track if it's provided, not what it was | ||
*/ | ||
trackOptionDirectory(value: string | undefined): Event | undefined { | ||
if (value) { | ||
return this.trackCliOption({ | ||
option: "directory", | ||
value: "custom", | ||
}); | ||
} | ||
} | ||
|
||
trackOptionMaxBuffer(value: number | undefined): Event | undefined { | ||
if (value !== undefined) { | ||
return this.trackCliOption({ | ||
option: "max_buffer", | ||
value: value.toString(), | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.