Skip to content

Commit 386879e

Browse files
committed
Improve telemetry formatting based on PR feedback
1 parent 67458ed commit 386879e

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

apps/rush-lib/src/cli/actions/CustomRushAction.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
CommandLineParameter,
1414
CommandLineFlagParameter,
1515
CommandLineStringParameter,
16-
CommandLineStringListParameter
16+
CommandLineStringListParameter,
17+
CommandLineParameterKind
1718
} from '@microsoft/ts-command-line';
1819

1920
import { BaseRushAction, IRushCommandLineActionOptions } from './BaseRushAction';
@@ -238,17 +239,25 @@ export class CustomRushAction extends BaseRushAction {
238239

239240
private _collectTelemetry(stopwatch: Stopwatch, success: boolean): void {
240241

241-
const customParameterValues: string[] = [];
242-
for (const customParameter of this._customParameters) {
243-
customParameter.appendToArgList(customParameterValues);
244-
}
245-
246242
const extraData: { [key: string]: string } = {
247243
command_to: (this._toFlag.values.length > 0).toString(),
248-
command_from: (this._fromFlag.values.length > 0).toString(),
249-
customParameters: customParameterValues.join(' ')
244+
command_from: (this._fromFlag.values.length > 0).toString()
250245
};
251246

247+
for (const customParameter of this._customParameters) {
248+
switch (customParameter.kind) {
249+
case CommandLineParameterKind.Flag:
250+
case CommandLineParameterKind.Choice:
251+
case CommandLineParameterKind.String:
252+
case CommandLineParameterKind.Integer:
253+
// tslint:disable-next-line:no-any
254+
extraData[customParameter.longName] = JSON.stringify((customParameter as any).value);
255+
break;
256+
default:
257+
extraData[customParameter.longName] = '?';
258+
}
259+
}
260+
252261
if (this.parser.telemetry) {
253262
this.parser.telemetry.log({
254263
name: this.actionName,

0 commit comments

Comments
 (0)