mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-24 10:18:53 +00:00
fix: log kind cluster creation failure with usage
Minimal change to send one event when we create a kind cluster instead of 1 event + different event on failure. Added the duration while I was at it, but nothing else. There is likely more work to do here to classify failures or add more information to tell what is different about failure cases, but this will solve one core problem that it isn't easy to correlate failure with the usage. Fixes part of #4214. Signed-off-by: Tim deBoer <git@tdeboer.ca>
This commit is contained in:
parent
2eb4ac72b8
commit
e311e2d8aa
1 changed files with 16 additions and 9 deletions
|
|
@ -157,14 +157,22 @@ export async function createCluster(
|
|||
// update PATH to include kind
|
||||
env.PATH = getKindPath();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const telemetryOptions: Record<string, any> = {
|
||||
provider,
|
||||
httpHostPort,
|
||||
httpsHostPort,
|
||||
ingressController,
|
||||
};
|
||||
|
||||
// now execute the command to create the cluster
|
||||
const startTime = performance.now();
|
||||
try {
|
||||
await extensionApi.process.exec(kindCli, ['create', 'cluster', '--config', tmpFilePath], { env, logger, token });
|
||||
if (ingressController) {
|
||||
logger.log('Creating ingress controller resources');
|
||||
await setupIngressController(clusterName);
|
||||
}
|
||||
telemetryLogger.logUsage('createCluster', { provider, httpHostPort, httpsHostPort, ingressController });
|
||||
} catch (error) {
|
||||
let errorMessage: string;
|
||||
|
||||
|
|
@ -174,16 +182,15 @@ export async function createCluster(
|
|||
errorMessage = error;
|
||||
}
|
||||
|
||||
telemetryLogger.logError('createCluster', {
|
||||
provider,
|
||||
httpHostPort,
|
||||
httpsHostPort,
|
||||
ingressController,
|
||||
error: errorMessage,
|
||||
stdErr: errorMessage,
|
||||
});
|
||||
telemetryOptions.error = errorMessage;
|
||||
telemetryOptions.stdErr = errorMessage;
|
||||
|
||||
throw new Error(`Failed to create kind cluster. ${errorMessage}`);
|
||||
} finally {
|
||||
const endTime = performance.now();
|
||||
telemetryOptions.duration = endTime - startTime;
|
||||
telemetryLogger.logUsage('createCluster', telemetryOptions);
|
||||
|
||||
// delete temporary directory/file
|
||||
await fs.promises.rm(tmpDirectory, { recursive: true });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue