-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 #6
Conversation
@brettcannon I can't see the telemetry on app insights, there could be a delay in the data coming through. Will keep monitoring. |
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.
I think there's like one design question about an idea that may (or may not) make things easier to maintain, a spelling mistake in an attribute, and a change to the copyright headers.
@@ -0,0 +1,30 @@ | |||
/*--------------------------------------------------------------------------------------------- | |||
* Copyright (c) Microsoft Corporation. All rights reserved. |
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.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
Less visibly jarring by dropping the ---
lines, plus it doesn't mention the license file name since it's actually LICENSE
in our case, but if we changed it I don't think we would want to update every single comment. 😉
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.
copied this from VS 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.
I can go back and fix it, better now
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.
I'll just fix the mentioning of the license file, easier than removing the lines
src/client/common/telemetry/index.ts
Outdated
// tslint:disable-next-line:prefer-type-cast | ||
(result as Promise<void>) | ||
.then(data => { | ||
sendTelemetryEvent(eventName, stopWatch.elpsedTime); |
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.
elapsedTime
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.
duh
|
||
export function sendTelemetryEvent(eventName: string, durationMs?: number, properties?: TelemetryProperties) { | ||
const reporter = getTelemetryReporter(); | ||
const measures = typeof durationMs === 'number' ? { duration: durationMs } : undefined; |
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.
Is there any reason we need to worry about the unit of measure changing? E.g. should as label the data as duration-ms
?
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.
I don't think we'll every want another unit (we can always do the math at the moment of reporting)
} | ||
|
||
// tslint:disable-next-line:no-any function-name | ||
export function captureTelemetry(eventName: string) { |
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.
I miss context managers from Python.
// tslint:disable-next-line:no-invalid-this no-use-before-declare no-unsafe-any | ||
const result = originalMethod.apply(this, args); | ||
|
||
// If method being wrapped returns a promise then wait for it. |
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.
Is it worth having two separate functions, e.g. captureAsyncTelemetry()
and captureTelemetry()
to simplify this logic at all?
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.
I don't think so, this is a decorator function (a decorator that can be applied to any method (sync or async).
e.g.
class Somethind {
@captureTelemetry()
public doSomethingSynchronously(){ }
@captureTelemetry()
public async doSomethingAsynchronously(){ }
}
@@ -1,36 +1,30 @@ | |||
declare module "vscode-extension-telemetry" { |
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.
Is there really no .d.ts
file on npm for the package? If so, has that fact been reported upstream?
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.
nope, everyone seems to be creating their own dts for this damn thing... can't understand why. plan was to create a dts a create PR (separate piece of work)
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.
nothing to do here.
src/client/common/utils.ts
Outdated
@@ -1,3 +1,7 @@ | |||
/*--------------------------------------------------------------------------------------------- |
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.
This should only be added to new files, not pre-existing ones where external contributors may have made changes.
if (stdout && stdout.length > 0) { | ||
// Take the second part, see below example. | ||
// pip 9.0.1 from /Users/donjayamanne/anaconda3/lib/python3.6/site-packages (python 3.6). | ||
const parts = stdout.split(' '); |
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.
Is it worth using a regex to avoid potential format changes that could break this and lead to accidentally capturing PII?
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.
will do,
@brettcannon what's PII?
@@ -203,6 +210,7 @@ function execSelectionInDjangoShell() { | |||
terminal.sendText(unix_code); | |||
} | |||
terminal.show(); | |||
sendTelemetryEvent(EXECUTION_DJANGO, undefined, { scope: 'selection' }); |
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.
I take it there's no way to execute Django as a file since that option isn't listed here?
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.
nope
const pyVersion = await interpreterVersion.getVersion('INVALID_INTERPRETER', 'DEFAULT_TEST_VALUE'); | ||
assert.equal(pyVersion, 'DEFAULT_TEST_VALUE', 'Incorrect version'); | ||
}); | ||
test('Must return the Pip Version', async () => { |
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.
You definitely do not need to change this, but as an FYI, the official capitalization is "pip" (all lower-case).
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.
lol, i will deifinitely change this, as i'm making other chages.
…into Telemetry * 'Telemetry' of https://github.com/Microsoft/vscode-python: fixed unit tests incorrect telemetry scope for running unittests do not stop discovery when running tests
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.
FYI I went through and removed the copyright header from all preexisting files. And since I was already doing that I just went ahead and tweaked the formatting for the new files.
No description provided.