Tempo: fix test data source (#28836) (#28856)

(cherry picked from commit 62138e8ad4)

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2020-11-05 12:02:09 +01:00
committed by GitHub
co-authored by Zoltán Bedi
parent 70bf01f4f9
commit e5be54b0f0
@@ -79,13 +79,12 @@ export class TempoDatasource extends DataSourceApi<TempoQuery> {
try {
await this._request(`/api/traces/random`).toPromise();
} catch (e) {
// As we are not searching for a valid trace here this will definitely fail but we should return 502 if it's
// unreachable. 500 should otherwise be from tempo it self but probably makes sense to report them here.
if (e?.status >= 500 && e?.status < 600) {
// If all went well this request will get back with 400 - Bad request
if (e?.status !== 400) {
throw e;
}
}
return true;
return { status: 'success', message: 'Data source is working' };
}
getTimeRange(): { start: number; end: number } {