diff --git a/src/datasources/redis/datasource.ts b/src/datasources/redis/datasource.ts index aea11fc..5980ffa 100644 --- a/src/datasources/redis/datasource.ts +++ b/src/datasources/redis/datasource.ts @@ -138,7 +138,7 @@ export class PCPRedisDatasource { } static defaultLegendFormatter(metric: string, instance: MetricInstance | undefined, labels: Record) { - let label = instance && instance.id !== null ? instance.name : metric; + let label = instance && instance.id !== "" ? instance.name : metric; if (!_.isEmpty(labels)) { const pairs: string[] = []; for (const label of ["hostname", "source"]) { @@ -182,7 +182,7 @@ export class PCPRedisDatasource { const descriptions = await this.pmSeriesSrv.getDescriptions(seriesList); const metricNames = await this.pmSeriesSrv.getMetricNames(seriesList); const instanceValuesGroupedBySeries = _.groupBy(instances, "series"); - const labels = this.pmSeriesSrv.getMetricAndInstanceLabels(seriesList); + const labels = await this.pmSeriesSrv.getMetricAndInstanceLabels(seriesList); const targetResults = await Promise.all(targets.map(target => this.handleTarget( _.pick(instanceValuesGroupedBySeries, seriesByExpr[target.expr]), metricNames, descriptions, labels, target )));