Improve check on Tempo version (#74547)

This commit is contained in:
Fabrizio 2023-09-11 14:34:05 +02:00 committed by GitHub
parent 5e0b20266e
commit a939dfadf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,17 +228,9 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
try {
return semver.gte(actualVersion, featuresToTempoVersion[featureName]);
} catch {
// An error could happen if Tempo is running locally. In that case, the version is not a semantic version
// and instead it is in the form `<branch>-<revision>`, possibly with a `-WIP` suffix (e.g., `main-12bdeff-WIP`).
// Thus, if the version is in the form `<branch>-<revision>`, assume that we are on the most updated
// Tempo version and thus any feature should be considered enabled
if (/^.*-[a-zA-Z0-9_]+(-WIP)?$/.test(actualVersion)) {
// We assume we are on a development and recent branch, thus we enable all features
return true;
}
console.error(`Cannot compare ${actualVersion} and ${featuresToTempoVersion[featureName]}`);
return false;
}
}
query(options: DataQueryRequest<TempoQuery>): Observable<DataQueryResponse> {