1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix logger reference

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-11-24 09:23:42 +02:00
parent 1d5dbb0788
commit d13917c197

View File

@ -3,6 +3,7 @@ import { LensApiRequest } from "../router";
import { LensApi } from "../lens-api"; import { LensApi } from "../lens-api";
import { Cluster, ClusterMetadataKey } from "../cluster"; import { Cluster, ClusterMetadataKey } from "../cluster";
import { ClusterPrometheusMetadata } from "../../common/cluster-store"; import { ClusterPrometheusMetadata } from "../../common/cluster-store";
import logger from "../logger";
export type IMetricsQuery = string | string[] | { export type IMetricsQuery = string | string[] | {
[metricName: string]: string; [metricName: string]: string;
@ -24,7 +25,7 @@ async function loadMetrics(promQueries: string[], cluster: Cluster, prometheusPa
return await cluster.getMetrics(prometheusPath, { query, ...queryParams }); return await cluster.getMetrics(prometheusPath, { query, ...queryParams });
} catch (error) { } catch (error) {
if (lastAttempt || (error?.statusCode >= 400 && error?.statusCode < 500)) { if (lastAttempt || (error?.statusCode >= 400 && error?.statusCode < 500)) {
logger.error("[Metrics]: metrics not available", { err }); logger.error("[Metrics]: metrics not available", { error });
throw new Error("Metrics not available"); throw new Error("Metrics not available");
} }