diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index 41f78ec7421..2c7c62d881b 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -437,7 +437,7 @@ export class PrometheusDatasource { } getQueryHints(query: DataQuery, result: any[]) { - return getQueryHints(query.expr, result, this); + return getQueryHints(query.expr || '', result, this); } loadRules() { diff --git a/public/app/plugins/datasource/prometheus/query_hints.ts b/public/app/plugins/datasource/prometheus/query_hints.ts index ea505832468..ce019e3ddcb 100644 --- a/public/app/plugins/datasource/prometheus/query_hints.ts +++ b/public/app/plugins/datasource/prometheus/query_hints.ts @@ -96,7 +96,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: any): } } - if (series.length >= SUM_HINT_THRESHOLD_COUNT) { + if (series && series.length >= SUM_HINT_THRESHOLD_COUNT) { const simpleMetric = query.trim().match(/^\w+$/); if (simpleMetric) { hints.push({