Commit e8790c32 by David Committed by Torkel Ödegaard

Loki: Apply start parameter to speed up test query (#18266)

parent 48d436ea
......@@ -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.' };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment