Skip to content

Commit f8756f2

Browse files
committed
fix: improve command analytics
1 parent 8b52eb0 commit f8756f2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

packages/commandkit/src/app/commands/AppCommandRunner.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,18 @@ export class AppCommandRunner {
113113
`[${marker} - ${time}] Error executing command: ${error.stack || error}`,
114114
);
115115

116+
const commandName =
117+
prepared.command?.data?.command?.name ??
118+
prepared.command.command.name;
119+
116120
await analytics.track({
117121
name: AnalyticsEvents.COMMAND_EXECUTION,
118-
id:
119-
prepared.command?.data?.command?.name ??
120-
prepared.command.command.name,
122+
id: commandName,
121123
data: {
122124
error: true,
123125
executionTime: env.getExecutionTime().toFixed(2),
124126
type: executionMode,
127+
command: commandName,
125128
},
126129
});
127130

@@ -132,15 +135,18 @@ export class AppCommandRunner {
132135
`[${marker} - ${time}] Command executed successfully`,
133136
);
134137

138+
const commandName =
139+
prepared.command?.data?.command?.name ??
140+
prepared.command.command.name;
141+
135142
await analytics.track({
136143
name: AnalyticsEvents.COMMAND_EXECUTION,
137-
id:
138-
prepared.command?.data?.command?.name ??
139-
prepared.command.command.name,
144+
id: commandName,
140145
data: {
141146
error: false,
142147
executionTime: env.getExecutionTime().toFixed(2),
143148
type: executionMode,
149+
command: commandName,
144150
},
145151
});
146152
});

0 commit comments

Comments
 (0)