Skip to content

Commit

Permalink
fix teraslice_version and version labels
Browse files Browse the repository at this point in the history
  • Loading branch information
busma13 committed Nov 12, 2024
1 parent 473a8ec commit 1d2b3a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
17 changes: 10 additions & 7 deletions packages/teraslice/src/lib/cluster/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,14 @@ export class ApiService {
* @return {Promise<void>}
*/
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;
Expand Down Expand Up @@ -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
);
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
2 changes: 1 addition & 1 deletion packages/teraslice/src/lib/workers/worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down

0 comments on commit 1d2b3a2

Please sign in to comment.