mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -10,9 +10,11 @@ export class PrometheusHelm extends PrometheusLens {
|
||||
|
||||
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
|
||||
const labelSelector = "app=prometheus,component=server,heritage=Helm";
|
||||
|
||||
try {
|
||||
const serviceList = await client.listServiceForAllNamespaces(false, "", null, labelSelector);
|
||||
const service = serviceList.body.items[0];
|
||||
|
||||
if (!service) return;
|
||||
|
||||
return {
|
||||
@@ -23,6 +25,7 @@ export class PrometheusHelm extends PrometheusLens {
|
||||
};
|
||||
} catch(error) {
|
||||
logger.warn(`PrometheusHelm: failed to list services: ${error.toString()}`);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ export class PrometheusLens implements PrometheusProvider {
|
||||
try {
|
||||
const resp = await client.readNamespacedService("prometheus", "lens-metrics");
|
||||
const service = resp.body;
|
||||
|
||||
return {
|
||||
id: this.id,
|
||||
namespace: service.metadata.namespace,
|
||||
@@ -72,6 +73,7 @@ export class PrometheusLens implements PrometheusProvider {
|
||||
case "ingress":
|
||||
const bytesSent = (ingress: string, statuses: string) =>
|
||||
`sum(rate(nginx_ingress_controller_bytes_sent_sum{ingress="${ingress}", status=~"${statuses}"}[${this.rateAccuracy}])) by (ingress)`;
|
||||
|
||||
return {
|
||||
bytesSentSuccess: bytesSent(opts.igress, "^2\\\\d*"),
|
||||
bytesSentFailure: bytesSent(opts.ingres, "^5\\\\d*"),
|
||||
|
||||
@@ -10,9 +10,11 @@ export class PrometheusOperator implements PrometheusProvider {
|
||||
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
|
||||
try {
|
||||
let service: V1Service;
|
||||
|
||||
for (const labelSelector of ["operated-prometheus=true", "self-monitor=true"]) {
|
||||
if (!service) {
|
||||
const serviceList = await client.listServiceForAllNamespaces(null, null, null, labelSelector);
|
||||
|
||||
service = serviceList.body.items[0];
|
||||
}
|
||||
}
|
||||
@@ -26,6 +28,7 @@ export class PrometheusOperator implements PrometheusProvider {
|
||||
};
|
||||
} catch(error) {
|
||||
logger.warn(`PrometheusOperator: failed to list services: ${error.toString()}`);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -80,6 +83,7 @@ export class PrometheusOperator implements PrometheusProvider {
|
||||
case "ingress":
|
||||
const bytesSent = (ingress: string, statuses: string) =>
|
||||
`sum(rate(nginx_ingress_controller_bytes_sent_sum{ingress="${ingress}", status=~"${statuses}"}[${this.rateAccuracy}])) by (ingress)`;
|
||||
|
||||
return {
|
||||
bytesSentSuccess: bytesSent(opts.igress, "^2\\\\d*"),
|
||||
bytesSentFailure: bytesSent(opts.ingres, "^5\\\\d*"),
|
||||
|
||||
@@ -77,6 +77,7 @@ export class PrometheusProviderRegistry {
|
||||
if (!this.prometheusProviders[type]) {
|
||||
throw "Unknown Prometheus provider";
|
||||
}
|
||||
|
||||
return this.prometheusProviders[type];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ export class PrometheusStacklight implements PrometheusProvider {
|
||||
try {
|
||||
const resp = await client.readNamespacedService("prometheus-server", "stacklight");
|
||||
const service = resp.body;
|
||||
|
||||
return {
|
||||
id: this.id,
|
||||
namespace: service.metadata.namespace,
|
||||
@@ -72,6 +73,7 @@ export class PrometheusStacklight implements PrometheusProvider {
|
||||
case "ingress":
|
||||
const bytesSent = (ingress: string, statuses: string) =>
|
||||
`sum(rate(nginx_ingress_controller_bytes_sent_sum{ingress="${ingress}", status=~"${statuses}"}[${this.rateAccuracy}])) by (ingress)`;
|
||||
|
||||
return {
|
||||
bytesSentSuccess: bytesSent(opts.igress, "^2\\\\d*"),
|
||||
bytesSentFailure: bytesSent(opts.ingres, "^5\\\\d*"),
|
||||
|
||||
Reference in new issue
Block a user