Merge pull request #1168 from kitematic/better-tracking

Better error & retry metrics in Kitematic
This commit is contained in:
Michael Chiang 2015-11-02 18:43:33 -08:00
Родитель 14658306ba 3dd9e720aa
Коммит 191045351b
2 изменённых файлов: 47 добавлений и 9 удалений

Просмотреть файл

@ -21,6 +21,21 @@ var DockerMachine = {
}
return fs.existsSync(this.command());
},
version: function () {
return util.exec([this.command(), '-v']).then(stdout => {
try {
let tokens = stdout.split(' ');
if (tokens.length < 3) {
return Promise.resolve(null);
}
return Promise.resolve(tokens[2]);
} catch (err) {
return Promise.resolve(null);
}
}).catch(() => {
return Promise.resolve(null);
});
},
isoversion: function (machineName = this.name()) {
try {
var data = fs.readFileSync(path.join(util.home(), '.docker', 'machine', 'machines', machineName, 'boot2docker.iso'), 'utf8');

Просмотреть файл

@ -32,6 +32,10 @@ export default {
},
retry (removeVM) {
metrics.track('Retried Setup', {
removeVM
});
router.get().transitionTo('loading');
if (removeVM) {
machine.rm().finally(() => {
@ -48,18 +52,31 @@ export default {
},
async setup () {
metrics.track('Started Setup');
let virtualBoxVersion = await virtualBox.version();
let machineVersion = await machine.version();
metrics.track('Started Setup', {
virtualBoxVersion,
machineVersion
});
while (true) {
try {
setupServerActions.started({started: false});
if (!virtualBox.installed()) {
router.get().transitionTo('setup');
throw new Error('VirtualBox is not installed. Please install it via the Docker Toolbox.');
}
if (!machine.installed()) {
// Make sure virtulBox and docker-machine are installed
let virtualBoxInstalled = virtualBox.installed();
let machineInstalled = machine.installed();
if (!virtualBoxInstalled || !machineInstalled) {
router.get().transitionTo('setup');
throw new Error('Docker Machine is not installed. Please install it via the Docker Toolbox.');
if (!virtualBoxInstalled) {
setupServerActions.error({error: 'VirtualBox is not installed. Please install it via the Docker Toolbox.'});
} else {
setupServerActions.error({error: 'Docker Machine is not installed. Please install it via the Docker Toolbox.'});
}
this.clearTimers();
await this.pause();
continue;
}
setupServerActions.started({started: true});
@ -106,7 +123,10 @@ export default {
break;
} catch (error) {
router.get().transitionTo('setup');
metrics.track('Setup Failed');
metrics.track('Setup Failed', {
virtualBoxVersion,
machineVersion
});
setupServerActions.error({error});
bugsnag.notify('SetupError', error.message, {
error: error,
@ -116,6 +136,9 @@ export default {
await this.pause();
}
}
metrics.track('Setup Finished');
metrics.track('Setup Finished', {
virtualBoxVersion,
machineVersion
});
}
};