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

Update telemetry for dirType on command events #1224

Merged
merged 1 commit into from
Apr 3, 2019

Conversation

lcampos
Copy link
Contributor

@lcampos lcampos commented Apr 2, 2019

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@

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);
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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
Copy link
Contributor Author

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 () => {
Copy link
Contributor Author

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> {
Copy link
Contributor Author

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
Copy link

codecov bot commented Apr 2, 2019

Codecov Report

Merging #1224 into develop will not change coverage.
The diff coverage is 10%.

Impacted file tree graph

@@           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
Impacted Files Coverage Δ
...core/src/commands/forceLightningInterfaceCreate.ts 42.85% <0%> (ø) ⬆️
...x-vscode-core/src/commands/forceApexClassCreate.ts 40% <0%> (ø) ⬆️
...scode-core/src/commands/forceLightningAppCreate.ts 42.85% <0%> (ø) ⬆️
...re/src/commands/forceVisualforceComponentCreate.ts 42.85% <0%> (ø) ⬆️
...ode-core/src/commands/forceLightningEventCreate.ts 42.85% <0%> (ø) ⬆️
...vscode-lwc/src/commands/forceLightningLwcCreate.ts 0% <0%> (ø) ⬆️
...de-core/src/commands/forceVisualforcePageCreate.ts 40% <0%> (ø) ⬆️
...core/src/commands/forceLightningComponentCreate.ts 42.85% <0%> (ø) ⬆️
...vscode-core/src/commands/forceApexTriggerCreate.ts 47.22% <0%> (ø) ⬆️
.../salesforcedx-vscode-core/src/commands/commands.ts 76.55% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6801027...f80ac6a. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants