mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
try-catch for build stats telemetry
This commit is contained in:
+40
-33
@@ -90,42 +90,49 @@ function submitAllStats(productJson, commit) {
|
|||||||
// send data as telementry event when the
|
// send data as telementry event when the
|
||||||
// product is configured to send telemetry
|
// product is configured to send telemetry
|
||||||
if (!productJson || !productJson.aiConfig || typeof productJson.aiConfig.asimovKey !== 'string') {
|
if (!productJson || !productJson.aiConfig || typeof productJson.aiConfig.asimovKey !== 'string') {
|
||||||
return Promise.resolve();
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
var sizes = {};
|
try {
|
||||||
var counts = {};
|
var sizes = {};
|
||||||
for (var _i = 0, sorted_2 = sorted; _i < sorted_2.length; _i++) {
|
var counts = {};
|
||||||
var entry = sorted_2[_i];
|
for (var _i = 0, sorted_2 = sorted; _i < sorted_2.length; _i++) {
|
||||||
sizes[entry.name] = entry.totalSize;
|
var entry = sorted_2[_i];
|
||||||
counts[entry.name] = entry.totalCount;
|
sizes[entry.name] = entry.totalSize;
|
||||||
|
counts[entry.name] = entry.totalCount;
|
||||||
|
}
|
||||||
|
appInsights.setup(productJson.aiConfig.asimovKey)
|
||||||
|
.setAutoCollectConsole(false)
|
||||||
|
.setAutoCollectExceptions(false)
|
||||||
|
.setAutoCollectPerformance(false)
|
||||||
|
.setAutoCollectRequests(false)
|
||||||
|
.setAutoCollectDependencies(false)
|
||||||
|
.setAutoDependencyCorrelation(false)
|
||||||
|
.start();
|
||||||
|
appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
|
||||||
|
/* __GDPR__
|
||||||
|
"monacoworkbench/packagemetrics" : {
|
||||||
|
"commit" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
||||||
|
"size" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
||||||
|
"count" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
appInsights.defaultClient.trackEvent({
|
||||||
|
name: 'monacoworkbench/packagemetrics',
|
||||||
|
properties: { commit: commit, size: JSON.stringify(sizes), count: JSON.stringify(counts) }
|
||||||
|
});
|
||||||
|
appInsights.defaultClient.flush({
|
||||||
|
callback: function () {
|
||||||
|
appInsights.dispose();
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error('ERROR sending build stats as telemetry event!');
|
||||||
|
console.error(err);
|
||||||
|
resolve(false);
|
||||||
}
|
}
|
||||||
appInsights.setup(productJson.aiConfig.asimovKey)
|
|
||||||
.setAutoCollectConsole(false)
|
|
||||||
.setAutoCollectExceptions(false)
|
|
||||||
.setAutoCollectPerformance(false)
|
|
||||||
.setAutoCollectRequests(false)
|
|
||||||
.setAutoCollectDependencies(false)
|
|
||||||
.setAutoDependencyCorrelation(false)
|
|
||||||
.start();
|
|
||||||
appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
|
|
||||||
/* __GDPR__
|
|
||||||
"monacoworkbench/packagemetrics" : {
|
|
||||||
"commit" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
|
||||||
"size" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
|
||||||
"count" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
appInsights.defaultClient.trackEvent({
|
|
||||||
name: 'monacoworkbench/packagemetrics',
|
|
||||||
properties: { commit: commit, size: JSON.stringify(sizes), count: JSON.stringify(counts) }
|
|
||||||
});
|
|
||||||
appInsights.defaultClient.flush({
|
|
||||||
callback: function () {
|
|
||||||
appInsights.dispose();
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.submitAllStats = submitAllStats;
|
exports.submitAllStats = submitAllStats;
|
||||||
|
|||||||
+45
-38
@@ -73,7 +73,7 @@ export function createStatsStream(group: string, log?: boolean): es.ThroughStrea
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function submitAllStats(productJson: any, commit: string): Promise<void> {
|
export function submitAllStats(productJson: any, commit: string): Promise<boolean> {
|
||||||
|
|
||||||
let sorted: Entry[] = [];
|
let sorted: Entry[] = [];
|
||||||
// move entries for single files to the front
|
// move entries for single files to the front
|
||||||
@@ -93,48 +93,55 @@ export function submitAllStats(productJson: any, commit: string): Promise<void>
|
|||||||
// send data as telementry event when the
|
// send data as telementry event when the
|
||||||
// product is configured to send telemetry
|
// product is configured to send telemetry
|
||||||
if (!productJson || !productJson.aiConfig || typeof productJson.aiConfig.asimovKey !== 'string') {
|
if (!productJson || !productJson.aiConfig || typeof productJson.aiConfig.asimovKey !== 'string') {
|
||||||
return Promise.resolve();
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
try {
|
||||||
|
|
||||||
const sizes = {};
|
const sizes = {};
|
||||||
const counts = {};
|
const counts = {};
|
||||||
for (const entry of sorted) {
|
for (const entry of sorted) {
|
||||||
sizes[entry.name] = entry.totalSize;
|
sizes[entry.name] = entry.totalSize;
|
||||||
counts[entry.name] = entry.totalCount;
|
counts[entry.name] = entry.totalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
appInsights.setup(productJson.aiConfig.asimovKey)
|
||||||
|
.setAutoCollectConsole(false)
|
||||||
|
.setAutoCollectExceptions(false)
|
||||||
|
.setAutoCollectPerformance(false)
|
||||||
|
.setAutoCollectRequests(false)
|
||||||
|
.setAutoCollectDependencies(false)
|
||||||
|
.setAutoDependencyCorrelation(false)
|
||||||
|
.start();
|
||||||
|
|
||||||
|
appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
|
||||||
|
|
||||||
|
/* __GDPR__
|
||||||
|
"monacoworkbench/packagemetrics" : {
|
||||||
|
"commit" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
||||||
|
"size" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
||||||
|
"count" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
appInsights.defaultClient.trackEvent({
|
||||||
|
name: 'monacoworkbench/packagemetrics',
|
||||||
|
properties: { commit, size: JSON.stringify(sizes), count: JSON.stringify(counts) }
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
appInsights.defaultClient.flush({
|
||||||
|
callback: () => {
|
||||||
|
appInsights.dispose();
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('ERROR sending build stats as telemetry event!');
|
||||||
|
console.error(err);
|
||||||
|
resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
appInsights.setup(productJson.aiConfig.asimovKey)
|
|
||||||
.setAutoCollectConsole(false)
|
|
||||||
.setAutoCollectExceptions(false)
|
|
||||||
.setAutoCollectPerformance(false)
|
|
||||||
.setAutoCollectRequests(false)
|
|
||||||
.setAutoCollectDependencies(false)
|
|
||||||
.setAutoDependencyCorrelation(false)
|
|
||||||
.start();
|
|
||||||
|
|
||||||
appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
|
|
||||||
|
|
||||||
/* __GDPR__
|
|
||||||
"monacoworkbench/packagemetrics" : {
|
|
||||||
"commit" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
|
||||||
"size" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
|
||||||
"count" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
appInsights.defaultClient.trackEvent({
|
|
||||||
name: 'monacoworkbench/packagemetrics',
|
|
||||||
properties: { commit, size: JSON.stringify(sizes), count: JSON.stringify(counts) }
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
appInsights.defaultClient.flush({
|
|
||||||
callback: () => {
|
|
||||||
appInsights.dispose();
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user