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 appender that writes to log #53603

Merged
merged 16 commits into from
Jul 11, 2018
Merged

add telemetry appender that writes to log #53603

merged 16 commits into from
Jul 11, 2018

Conversation

jrieken
Copy link
Member

@jrieken jrieken commented Jul 5, 2018

This PR adds a telemetry appender that uses our log service. Its purpose is to make it easy to know what we log as telemetry (helps with transparency and development)

Edit by Ramya:
This PR implements #54001 (comment)

@jrieken jrieken requested a review from ramya-rao-a July 5, 2018 16:29
@@ -4,6 +4,7 @@
"applicationName": "code-oss",
"dataFolderName": ".vscode-oss",
"win32MutexName": "vscodeoss",
"enableTelemetry": true,
Copy link
Member Author

Choose a reason for hiding this comment

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

maybe debatable but it helps with local development

Copy link
Member

Choose a reason for hiding this comment

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

I would leave this out, and enable it on demand.

}

log(eventName: string, data: any): void {
this._logService.trace(`telemetry/${eventName}`, data);
Copy link
Contributor

Choose a reason for hiding this comment

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

@jrieken My concern on using trace for the telemetry events is that the logs will now get very noisy. This is due to the data part of the event having a lot of "common" properties.
Anybody using the log level of trace is sure to get annoyed by all the noise.

An alternative is to

  • Do what you did here, but log only the event name + data without the "common" parts of the data. This can help in the development/debugging process
  • Have a dedicated output channel for the telemetry events with event name + all data. This can help in our attempt in being transparent.

Thoughts? cc @kieferrm

Below is a comparison between all data and data without the common parts

image

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I am all in for a dedicated output channel or, even better, a dedicated log file which then shows as output channel. If we have dedicated channel we might also consider other places that send telemetry, like the main process and other windows.

Copy link
Member Author

Choose a reason for hiding this comment

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

generally, don't feel obligated to stick to my changes/approch. it was just an experiment

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jul 11, 2018

@jrieken Made some changes as per #54001 (comment). Can you take a look?

cc @joaomoreno, @sandy081


export class LogAppender implements ITelemetryAppender {

private commonProperties = ['sessionID', 'version', 'timestamp'];
Copy link
Member Author

Choose a reason for hiding this comment

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

use Map.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also not sure about this... I understand the noise reduction but we aren't all honest with what we send when we filter stuff that goes into the log

Copy link
Contributor

Choose a reason for hiding this comment

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

@jrieken What goes into the individual log files for processes (and so the output channel) is filtered. But the dedicated file telemetry.log will contain the complete data.

See https://github.com/Microsoft/vscode/blob/7f7e23534e9648c961c7f1f1b3067e37e5f31bdc/src/vs/platform/telemetry/node/appInsightsAppender.ts#L141

Copy link
Member

@joaomoreno joaomoreno left a comment

Choose a reason for hiding this comment

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

Sounds OK to me. I just wouldn't enable telemetry on dev. How about a --enable-telemetry optional argument?

@jrieken
Copy link
Member Author

jrieken commented Jul 11, 2018

I just wouldn't enable telemetry on dev

I think it's important - to see you changes in effect and to see the impact telemetry has, e.g us sending a telemetry event on type while suggestion show...

@ramya-rao-a
Copy link
Contributor

I just wouldn't enable telemetry on dev

I think it's important - to see you changes in effect and to see the impact telemetry has, e.g us sending a telemetry event on type while suggestion show.

With the changes in this PR, even when the enableTelemetry is set to true, no real telemetry is actually sent over the wire as that would need the AI keys. In the absence of the key, we use a NullAppender instead of the AppInsightsAppender. See https://github.com/Microsoft/vscode/blob/7f7e23534e9648c961c7f1f1b3067e37e5f31bdc/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L105-L111

Having it this way, lets us have what @jrieken is saying above.

@joaomoreno
Copy link
Member

Thanks for making that clear, @ramya-rao-a. Looks good! 👍

@ramya-rao-a ramya-rao-a merged commit 19f25e4 into master Jul 11, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
@alexdima alexdima deleted the joh/log-appender branch June 30, 2020 06:39
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.

None yet

3 participants