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