mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Apply start parameter to speed up test query (#18266)
This commit is contained in:
parent
48d436ea6d
commit
e8790c32ca
@ -357,7 +357,10 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
|
||||
};
|
||||
|
||||
testDatasource() {
|
||||
return this._request('/api/prom/label')
|
||||
// Consider only last 10 minutes otherwise request takes too long
|
||||
const startMs = Date.now() - 10 * 60 * 1000;
|
||||
const start = `${startMs}000000`; // API expects nanoseconds
|
||||
return this._request('/api/prom/label', { start })
|
||||
.then((res: DataQueryResponse) => {
|
||||
if (res && res.data && res.data.values && res.data.values.length > 0) {
|
||||
return { status: 'success', message: 'Data source connected and labels found.' };
|
||||
|
Loading…
Reference in New Issue
Block a user