Alerting: Make Loki & Prometheus instant vector by default (#66797)

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
This commit is contained in:
Gilles De Mey
2023-04-27 16:38:22 +02:00
committed by GitHub
parent e9971dd153
commit b94fceddad
18 changed files with 435 additions and 360 deletions

View File

@@ -1263,6 +1263,33 @@ export class PrometheusDatasource
getCacheDurationInMinutes(): number {
return getClientCacheDurationInMinutes(this.cacheLevel);
}
getDefaultQuery(app: CoreApp): PromQuery {
const defaults = {
refId: 'A',
expr: '',
range: true,
instant: false,
};
if (app === CoreApp.UnifiedAlerting) {
return {
...defaults,
instant: true,
range: false,
};
}
if (app === CoreApp.Explore) {
return {
...defaults,
instant: true,
range: true,
};
}
return defaults;
}
}
/**