Skip to content

Add project telemetry #16050

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

Merged
12 commits merged into from
May 25, 2017
Merged

Add project telemetry #16050

12 commits merged into from
May 25, 2017

Conversation

ghost
Copy link

@ghost ghost commented May 23, 2017

This adds a telemetry event the first time a project is opened in a session.
The event contains a count of files by extension and scrubbed compiler options.

@ghost ghost requested a review from mhegazy May 23, 2017 22:51
* Produces a cleaned version of compiler options with personally identifiying info (aka, paths) removed.
* Also converts enum values back to strings.
*/
export function convertCompilerOptionsForTelemetry(opts: ts.CompilerOptions): ts.CompilerOptions {
Copy link
Contributor

Choose a reason for hiding this comment

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

@internal ?

readonly dts: number;
}

function getFileStats(fileNames: string[]): FileStats {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just use countEachFileTypes

@mhegazy
Copy link
Contributor

mhegazy commented May 23, 2017

We also should add the new event in protocol.ts

@ghost
Copy link
Author

ghost commented May 24, 2017

protocol.ts already has a "telemetry" event, should we use that? Or change the event name to "projectTelemetry"?

@mhegazy
Copy link
Contributor

mhegazy commented May 24, 2017

protocol.ts already has a "telemetry" event, should we use that? Or change the event name to "projectTelemetry"?

i would add a new one. @mjbvz any preferences here?

@mhegazy mhegazy added this to the TypeScript 2.3.4 milestone May 24, 2017
@mhegazy
Copy link
Contributor

mhegazy commented May 24, 2017

@Andy-MS we should also set version on the telemetry event that would be ts.version. this way we can tell what version of the server sent it. we do something similar with typingsInstallerVersion.

@@ -1029,9 +1037,19 @@ namespace ts.server {
const data: ProjectInfoTelemetryEventData = {
Copy link
Contributor

Choose a reason for hiding this comment

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

for completeness lets also include include, exclude and compileOnSave

@mjbvz
Copy link
Contributor

mjbvz commented May 24, 2017

@mhegazy It may be more consistent to stick with a single telemetry event and then use telemetryEventName to differentiate the payload type. We already do this for the typingsInstalled telemetry event

export interface ProjectInfoTypeAcquisitionData {
readonly enable: boolean;
// Actual values of include/exclude entries are scrubbed.
readonly include: Array<"">;
Copy link
Contributor

Choose a reason for hiding this comment

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

should not this be like include and exclude and be boolean | undefined?

Copy link
Author

Choose a reason for hiding this comment

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

In contrast to a tsconfig "include", typeAcquisition include can apparently be provided by an external config. It also appears to be getting automatically set to an empty array if not explicitly provided.
We could make it be a boolean that is equal to whether the array is non-empty though.

Copy link
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

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

Just one comment about typingsOptions.include and typingsOptions.exclude.

@mhegazy
Copy link
Contributor

mhegazy commented May 25, 2017

A few more pieces of info that just came to mind:

  1. languageServiceDisabled
  2. config file name tsconfig.json vs jsconfig.json vs other,
  3. extends being defined in the tsconfig.json
  4. is external project or configured project

readonly files: boolean | undefined;
readonly include: boolean | undefined;
readonly exclude: boolean | undefined;
readonly compileOnSave: boolean;
readonly typeAcquisition: ProjectInfoTypeAcquisitionData;

/** Is 'undefined' if config file name is not tsconfig or jsconfig. */
readonly configFileName: "tsconfig.json" | "jsconfig.json" | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

undefined is not going to survive in the json serialization. consider adding "other" value.

@ghost ghost merged commit d052bb8 into master May 25, 2017
@ghost ghost deleted the projectTelemetry branch May 25, 2017 20:30
@ghost ghost mentioned this pull request May 25, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants