Commit 2d5dc5d6 by David Committed by GitHub

Loki: fix labels fetching when no initial range given (#21000)

parent 3f48033b
......@@ -324,8 +324,8 @@ export default class LokiLanguageProvider extends LanguageProvider {
const url = '/api/prom/label';
try {
this.logLabelFetchTs = Date.now();
const res = await this.request(url, rangeToParams(absoluteRange));
const rangeParams = absoluteRange ? rangeToParams(absoluteRange) : {};
const res = await this.request(url, rangeParams);
const labelKeys = res.data.data.slice().sort();
this.labelKeys = {
......@@ -351,7 +351,8 @@ export default class LokiLanguageProvider extends LanguageProvider {
async fetchLabelValues(key: string, absoluteRange: AbsoluteTimeRange) {
const url = `/api/prom/label/${key}/values`;
try {
const res = await this.request(url, rangeToParams(absoluteRange));
const rangeParams = absoluteRange ? rangeToParams(absoluteRange) : {};
const res = await this.request(url, rangeParams);
const values = res.data.data.slice().sort();
// Add to label options
......
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