Include the release channel in data posted to Atom.io with crashes

This commit is contained in:
Nathan Sobo 2019-06-24 16:44:01 -06:00
parent 6042f7c819
commit 9793c74835
5 changed files with 29 additions and 20 deletions

View File

@ -45,6 +45,7 @@ const TextBuffer = require('text-buffer');
const TextEditorRegistry = require('./text-editor-registry');
const AutoUpdateManager = require('./auto-update-manager');
const StartupTime = require('./startup-time');
const getReleaseChannel = require('./get-release-channel');
const stat = util.promisify(fs.stat);
@ -565,18 +566,7 @@ class AtomEnvironment {
// name like 'beta' or 'nightly' if one is found in the Atom version or 'stable'
// otherwise.
getReleaseChannel() {
// This matches stable, dev (with or without commit hash) and any other
// release channel following the pattern '1.00.0-channel0'
const match = this.getVersion().match(
/\d+\.\d+\.\d+(-([a-z]+)(\d+|-\w{4,})?)?$/
);
if (!match) {
return 'unrecognized';
} else if (match[2]) {
return match[2];
}
return 'stable';
return getReleaseChannel(this.getVersion());
}
// Public: Returns a {Boolean} that is `true` if the current version is an official release.

View File

@ -3,13 +3,13 @@ module.exports = function(params) {
const os = require('os');
const platformRelease = os.release();
const arch = os.arch();
const { uploadToServer } = params;
const { uploadToServer, releaseChannel } = params;
crashReporter.start({
productName: 'Atom',
companyName: 'GitHub',
submitURL: 'https://atom.io/crash_reports',
uploadToServer,
extra: { platformRelease, arch }
extra: { platformRelease, arch, releaseChannel }
});
};

View File

@ -0,0 +1,14 @@
module.exports = function(version) {
// This matches stable, dev (with or without commit hash) and any other
// release channel following the pattern '1.00.0-channel0'
const match = version.match(
/\d+\.\d+\.\d+(-([a-z]+)(\d+|-\w{4,})?)?$/
);
if (!match) {
return 'unrecognized';
} else if (match[2]) {
return match[2];
}
return 'stable';
}

View File

@ -4,6 +4,7 @@ const path = require('path');
const temp = require('temp').track();
const parseCommandLine = require('./parse-command-line');
const startCrashReporter = require('../crash-reporter-start');
const getReleaseChannel = require('../get-release-channel');
const atomPaths = require('../atom-paths');
const fs = require('fs');
const CSON = require('season');
@ -87,9 +88,12 @@ module.exports = function start(resourcePath, devResourcePath, startTime) {
app.on('open-file', addPathToOpen);
app.on('open-url', addUrlToOpen);
app.on('will-finish-launching', () => startCrashReporter({
uploadToServer: config.get('core.telemetryConsent') === 'limited'
}));
app.on('will-finish-launching', () =>
startCrashReporter({
uploadToServer: config.get('core.telemetryConsent') === 'limited',
releaseChannel: getReleaseChannel(app.getVersion())
})
);
if (args.userDataDir != null) {
app.setPath('userData', args.userDataDir);

View File

@ -7,6 +7,7 @@
const path = require('path');
const Module = require('module');
const getWindowLoadSettings = require('../src/get-window-load-settings');
const getReleaseChannel = require('../src/get-release-channel');
const StartupTime = require('../src/startup-time');
const entryPointDirPath = __dirname;
let blobStore = null;
@ -144,16 +145,16 @@
? snapshotResult.customRequire('../src/crash-reporter-start.js')
: require('../src/crash-reporter-start');
console.log(getWindowLoadSettings())
const { userSettings } = getWindowLoadSettings();
const { userSettings, appVersion } = getWindowLoadSettings();
const uploadToServer =
userSettings &&
userSettings.core &&
userSettings.core.telemetryConsent === 'limited';
const releaseChannel = getReleaseChannel(appVersion);
startCrashReporter({
uploadToServer,
process: 'renderer'
releaseChannel
});
const CSON = useSnapshot