-
Notifications
You must be signed in to change notification settings - Fork 407
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
Update telemetry for dirType on command events #1224
Conversation
private getEndHRTime(hrstart: [number, number]): string { | ||
const hrend = process.hrtime(hrstart); | ||
return util.format('%ds %dms', hrend[0], hrend[1] / 1000000); | ||
return util.format('%d%d', hrend[0], hrend[1] / 1000000); |
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.
Update time format from 0s 6789ms
to 06789
@@ -15,6 +15,12 @@ import TelemetryReporter from './telemetryReporter'; | |||
const TELEMETRY_GLOBAL_VALUE = 'sfdxTelemetryMessage'; | |||
const EXTENSION_NAME = 'salesforcedx-vscode-core'; | |||
|
|||
interface CommandMetric { |
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.
Basic metric data interface for command execution.
@@ -127,20 +133,25 @@ export class TelemetryService { | |||
|
|||
public sendCommandEvent( | |||
commandName?: string, | |||
hrstart?: [number, number] | |||
hrstart?: [number, number], | |||
additionalData?: any |
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.
Doing it this way allows us to expand metrics on command execution without touching the interface that often.
@@ -202,5 +202,33 @@ describe('Telemetry', () => { | |||
}; | |||
assert.calledWith(reporter, 'commandExecution', match(expectedData)); | |||
}); | |||
|
|||
it('Should send correct data format on sendCommandEvent with additionalData', 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.
New test for optional additionalData
param
@@ -83,18 +83,8 @@ export class TelemetryService { | |||
} | |||
} | |||
|
|||
public async sendCommandEvent(commandName?: string): Promise<void> { |
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.
Removing since it's not used anymore.
Codecov Report
@@ Coverage Diff @@
## develop #1224 +/- ##
========================================
Coverage 71.01% 71.01%
========================================
Files 196 196
Lines 7397 7397
Branches 781 781
========================================
Hits 5253 5253
Misses 1989 1989
Partials 155 155
Continue to review full report at Codecov.
|
What does this PR do?
Updates metrics for command execution so that command name is not mixed with directory type. Also updates execution time format for all metrics.
What issues does this PR fix or reference?
@W-6007844@