diff --git a/packages/teraslice/src/lib/cluster/services/api.ts b/packages/teraslice/src/lib/cluster/services/api.ts index 3639967c3e0..09c2a521aa3 100644 --- a/packages/teraslice/src/lib/cluster/services/api.ts +++ b/packages/teraslice/src/lib/cluster/services/api.ts @@ -658,11 +658,14 @@ export class ApiService { * @return {Promise} */ private async _updatePromMetrics() { - function extractVersionFromImageTag(imageTag: string): string { - // Define the version number regex pattern - const versionRegex = /(\d+\.\d+\.\d+)/; - const match = imageTag.match(versionRegex); - return match ? match[0] : 'Version number not available'; + function extractVersionFromImage(image: string): string { + let version = ''; + + if (image.includes(':')) { + version = image.split(':')[1].split('_')[0]; + } + + return version; } const { terafoundation, teraslice } = this.context.sysconfig; @@ -695,7 +698,7 @@ export class ApiService { name, node_version: process.version, platform: this.context.platform, - teraslice_version: getPackageJSON().version + teraslice_version: `v${getPackageJSON().version}` }, 1 ); @@ -880,7 +883,7 @@ export class ApiService { ex_id: worker.ex_id, job_id: worker.job_id, image: worker.image, - version: extractVersionFromImageTag(worker.image) + version: extractVersionFromImage(worker.image) }; this.context.apis.foundation.promMetrics.set( diff --git a/packages/teraslice/src/lib/workers/execution-controller/index.ts b/packages/teraslice/src/lib/workers/execution-controller/index.ts index ed0447ecd1e..751882afb3d 100644 --- a/packages/teraslice/src/lib/workers/execution-controller/index.ts +++ b/packages/teraslice/src/lib/workers/execution-controller/index.ts @@ -1214,7 +1214,8 @@ export class ExecutionController { name: this.context.sysconfig.teraslice.name, node_version: process.version, platform: this.context.platform, - teraslice_version: getPackageJSON().version + teraslice_version: `v${getPackageJSON().version}` + }, 1 ); diff --git a/packages/teraslice/src/lib/workers/worker/index.ts b/packages/teraslice/src/lib/workers/worker/index.ts index ee345fdea66..18d4ddb4bd2 100644 --- a/packages/teraslice/src/lib/workers/worker/index.ts +++ b/packages/teraslice/src/lib/workers/worker/index.ts @@ -451,7 +451,7 @@ export class Worker { name: this.context.sysconfig.teraslice.name, node_version: process.version, platform: this.context.platform, - teraslice_version: getPackageJSON().version + teraslice_version: `v${getPackageJSON().version}` }, 1 );