Skip to content

Commit 99e7748

Browse files
Roshan NikamRoshan Nikam
authored andcommitted
added extra columns in cli stats
1 parent 61c783a commit 99e7748

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

bin/commands/runs.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ module.exports = function run(args) {
9494
//get the number of spec files
9595
let specFiles = utils.getNumberOfSpecFiles(bsConfig, args, cypressJson);
9696

97+
// return the number of parallels user specified
98+
let userSpecifiedParallels = utils.getParallels(bsConfig, args);
99+
97100
// accept the number of parallels
98101
utils.setParallels(bsConfig, args, specFiles.length);
99102

@@ -132,6 +135,12 @@ module.exports = function run(args) {
132135
utils.setProcessHooks(data.build_id, bsConfig, bs_local, args);
133136
let message = `${data.message}! ${Constants.userMessages.BUILD_CREATED} with build id: ${data.build_id}`;
134137
let dashboardLink = `${Constants.userMessages.VISIT_DASHBOARD} ${data.dashboard_url}`;
138+
let buildReportData = {
139+
'user_id': data.user_details.id,
140+
'group_id': data.user_details.group_id,
141+
'parallels_specified': userSpecifiedParallels,
142+
'parallels_allotted': bsConfig.run_settings.parallels
143+
};
135144
utils.exportResults(data.build_id, `${config.dashboardUrl}${data.build_id}`);
136145
if ((utils.isUndefined(bsConfig.run_settings.parallels) && utils.isUndefined(args.parallels)) || (!utils.isUndefined(bsConfig.run_settings.parallels) && bsConfig.run_settings.parallels == Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE)) {
137146
logger.warn(Constants.userMessages.NO_PARALLELS);
@@ -169,7 +178,7 @@ module.exports = function run(args) {
169178

170179
// Generate custom report!
171180
reportGenerator(bsConfig, data.build_id, args, function(){
172-
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null);
181+
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null, buildReportData);
173182
utils.handleSyncExit(exitCode, data.dashboard_url);
174183
});
175184
});
@@ -195,7 +204,8 @@ module.exports = function run(args) {
195204
dataToSend.used_auto_local = bsConfig.connection_settings.usedAutoLocal;
196205
}
197206
}
198-
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null, dataToSend);
207+
buildReportData = { ...buildReportData, ...dataToSend };
208+
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null, buildReportData);
199209
return;
200210
}).catch(async function (err) {
201211
// Build creation failed

bin/helpers/usageReporting.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,21 @@ function send(args) {
181181
data.cypress_version = bsConfig.run_settings.cypress_version
182182
}
183183

184+
bsConfig['auth']['username'] = "[REDACTED]"
185+
bsConfig['auth']['access_key'] = "[REDACTED]"
186+
184187
delete args.bstack_config;
185188

186189
const payload = {
187190
event_type: "cypress_cli_stats",
188191
data: {
192+
build_id: data.build_id,
193+
user_id: data.user_id,
194+
group_id: data.group_id,
195+
parallels_specified: data.parallels_specified,
196+
parallels_allotted: data.parallels_allotted,
197+
bstack_json: bsConfig,
198+
run_settings: bsConfig.run_settings,
189199
os: _os(),
190200
os_version: os_version(),
191201
bstack_json_found_in_pwd: bstack_json_found_in_pwd(),

bin/helpers/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ exports.setUsageReportingFlag = (bsConfig, disableUsageReporting) => {
138138
}
139139
};
140140

141+
exports.getParallels = (bsConfig, args) => {
142+
return args.parallels || bsConfig['run_settings']['parallels'];
143+
}
144+
141145
exports.setParallels = (bsConfig, args, numOfSpecs) => {
142146
if (!this.isUndefined(args.parallels)) {
143147
bsConfig["run_settings"]["parallels"] = args.parallels;

0 commit comments

Comments
 (0)