From 3365455e452905af0a66eb085aa9ee27a391af91 Mon Sep 17 00:00:00 2001 From: Zahari Dichev Date: Fri, 5 Jun 2020 19:36:09 +0300 Subject: [PATCH] Fix mc labels (#4560) Signed-off-by: Zahari Dichev --- .../destination/watcher/endpoints_watcher.go | 20 ++++---- controller/api/public/prometheus.go | 2 +- grafana/dashboards/multicluster.json | 50 +++++++++---------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/controller/api/destination/watcher/endpoints_watcher.go b/controller/api/destination/watcher/endpoints_watcher.go index 269a679ff..7e8a4257d 100644 --- a/controller/api/destination/watcher/endpoints_watcher.go +++ b/controller/api/destination/watcher/endpoints_watcher.go @@ -23,11 +23,11 @@ const ( // metrics labels service = "service" namespace = "namespace" - remoteGatewayNamespace = "remote_gateway_namespace" - remoteGateway = "remote_gateway" - remoteCluster = "remote_cluster" - remoteService = "remote_service" - remoteServiceNamespace = "remote_service_namespace" + targetGatewayNamespace = "target_gateway_namespace" + targetGateway = "target_gateway" + targetCluster = "target_cluster" + targetService = "target_service" + targetServiceNamespace = "target_service_namespace" ) // TODO: prom metrics for all the queues/caches @@ -470,14 +470,14 @@ func metricLabels(endpoints *corev1.Endpoints) map[string]string { if hasRemoteGateway && hasRemoteGatwayNs && hasRemoteClusterName && hasServiceFqn { // this means we are looking at Endpoints created for the purpose of mirroring // an out of cluster service. - labels[remoteGatewayNamespace] = gatewayNs - labels[remoteGateway] = gateway - labels[remoteCluster] = remoteClusterName + labels[targetGatewayNamespace] = gatewayNs + labels[targetGateway] = gateway + labels[targetCluster] = remoteClusterName fqParts := strings.Split(serviceFqn, ".") if len(fqParts) >= 2 { - labels[remoteService] = fqParts[0] - labels[remoteServiceNamespace] = fqParts[1] + labels[targetService] = fqParts[0] + labels[targetServiceNamespace] = fqParts[1] } } return labels diff --git a/controller/api/public/prometheus.go b/controller/api/public/prometheus.go index c16d80fee..a03aba69f 100644 --- a/controller/api/public/prometheus.go +++ b/controller/api/public/prometheus.go @@ -38,7 +38,7 @@ const ( dstNamespaceLabel = model.LabelName("dst_namespace") gatewayNameLabel = model.LabelName("gateway_name") gatewayNamespaceLabel = model.LabelName("gateway_namespace") - remoteClusterNameLabel = model.LabelName("remote_cluster_name") + remoteClusterNameLabel = model.LabelName("target_cluster_name") ) func extractSampleValue(sample *model.Sample) uint64 { diff --git a/grafana/dashboards/multicluster.json b/grafana/dashboards/multicluster.json index ee3baa5c3..4f488d50c 100644 --- a/grafana/dashboards/multicluster.json +++ b/grafana/dashboards/multicluster.json @@ -98,7 +98,7 @@ "tableColumn": "", "targets": [ { - "expr": "sum(irate(response_total{classification=\"success\", dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) / sum(irate(response_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s]))", + "expr": "sum(irate(response_total{classification=\"success\", dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) / sum(irate(response_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s]))", "format": "time_series", "instant": false, "intervalFactor": 1, @@ -183,7 +183,7 @@ "tableColumn": "", "targets": [ { - "expr": "sum(irate(request_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s]))", + "expr": "sum(irate(request_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s]))", "format": "time_series", "instant": false, "intervalFactor": 1, @@ -268,7 +268,7 @@ "tableColumn": "", "targets": [ { - "expr": "histogram_quantile(0.95, sum(irate(response_latency_ms_bucket{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le))", + "expr": "histogram_quantile(0.95, sum(irate(response_latency_ms_bucket{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le))", "format": "time_series", "instant": false, "intervalFactor": 1, @@ -344,10 +344,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(irate(response_total{classification=\"success\", dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_remote_gateway) / sum(irate(response_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_remote_gateway)", + "expr": "sum(irate(response_total{classification=\"success\", dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_target_gateway) / sum(irate(response_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_target_gateway)", "format": "time_series", "intervalFactor": 1, - "legendFormat": "gateway/{{dst_remote_gateway}}", + "legendFormat": "gateway/{{dst_target_gateway}}", "refId": "A" } ], @@ -431,17 +431,17 @@ "steppedLine": false, "targets": [ { - "expr": "sum(irate(request_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\", tls=\"true\"}[30s])) by (dst_remote_gateway)", + "expr": "sum(irate(request_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\", tls=\"true\"}[30s])) by (dst_target_gateway)", "format": "time_series", "intervalFactor": 1, - "legendFormat": "🔒gateway/{{dst_remote_gateway}}", + "legendFormat": "🔒gateway/{{dst_target_gateway}}", "refId": "A" }, { - "expr": "sum(irate(request_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", tls!=\"true\"}[30s])) by (dst_remote_gateway)", + "expr": "sum(irate(request_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", tls!=\"true\"}[30s])) by (dst_target_gateway)", "format": "time_series", "intervalFactor": 1, - "legendFormat": "gatewy/{{dst_remote_gateway}}", + "legendFormat": "gatewy/{{dst_target_gateway}}", "refId": "B" } ], @@ -525,25 +525,25 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.5, sum(irate(response_latency_ms_bucket{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_remote_gateway))", + "expr": "histogram_quantile(0.5, sum(irate(response_latency_ms_bucket{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_target_gateway))", "format": "time_series", "intervalFactor": 1, - "legendFormat": "p50 gateway/{{dst_remote_gateway}}", + "legendFormat": "p50 gateway/{{dst_target_gateway}}", "refId": "A" }, { - "expr": "histogram_quantile(0.95, sum(irate(response_latency_ms_bucket{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_remote_gateway))", + "expr": "histogram_quantile(0.95, sum(irate(response_latency_ms_bucket{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_target_gateway))", "format": "time_series", "hide": false, "intervalFactor": 1, - "legendFormat": "p95 gateway/{{dst_remote_gateway}}", + "legendFormat": "p95 gateway/{{dst_target_gateway}}", "refId": "B" }, { - "expr": "histogram_quantile(0.99, sum(irate(response_latency_ms_bucket{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_remote_gateway))", + "expr": "histogram_quantile(0.99, sum(irate(response_latency_ms_bucket{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_target_gateway))", "format": "time_series", "intervalFactor": 1, - "legendFormat": "p99 gateway/{{dst_remote_gateway}}", + "legendFormat": "p99 gateway/{{dst_target_gateway}}", "refId": "C" } ], @@ -590,7 +590,7 @@ } }, { - "content": "
\n TRAFFIC BY REMOTE SERVICE\n
", + "content": "
\n TRAFFIC BY TARGET SERVICE\n
", "gridPos": { "h": 2, "w": 24, @@ -643,10 +643,10 @@ "steppedLine": false, "targets": [ { - "expr": "sum(irate(response_total{classification=\"success\", dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_remote_service) / sum(irate(response_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_remote_service)", + "expr": "sum(irate(response_total{classification=\"success\", dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_target_service) / sum(irate(response_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (dst_target_service)", "format": "time_series", "intervalFactor": 1, - "legendFormat": "remote-svc/{{dst_remote_service}}", + "legendFormat": "target-svc/{{dst_target_service}}", "refId": "A" } ], @@ -730,17 +730,17 @@ "steppedLine": false, "targets": [ { - "expr": "sum(irate(request_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", tls=\"true\"}[30s])) by (dst_remote_service)", + "expr": "sum(irate(request_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", tls=\"true\"}[30s])) by (dst_target_service)", "format": "time_series", "intervalFactor": 1, - "legendFormat": "🔒remote-svc/{{dst_remote_service}}", + "legendFormat": "🔒target-svc/{{dst_target_service}}", "refId": "A" }, { - "expr": "sum(irate(request_total{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", tls!=\"true\"}[30s])) by (dst_remote_service)", + "expr": "sum(irate(request_total{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", tls!=\"true\"}[30s])) by (dst_target_service)", "format": "time_series", "intervalFactor": 1, - "legendFormat": "remote-svc/{{dst_remote_service}}", + "legendFormat": "target-svc/{{dst_target_service}}", "refId": "B" } ], @@ -823,10 +823,10 @@ "steppedLine": false, "targets": [ { - "expr": "histogram_quantile(0.95, sum(rate(response_latency_ms_bucket{dst_remote_gateway=\"$gateway\", dst_remote_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_remote_service))", + "expr": "histogram_quantile(0.95, sum(rate(response_latency_ms_bucket{dst_target_gateway=\"$gateway\", dst_target_gateway!=\"\", dst_target_cluster=\"$cluster\", dst_target_cluster!=\"\", direction=\"outbound\"}[30s])) by (le, dst_target_service))", "format": "time_series", "intervalFactor": 1, - "legendFormat": "P95 remote-svc/{{dst_remote_service}}", + "legendFormat": "P95 target-svc/{{dst_target_service}}", "refId": "A" } ], @@ -919,7 +919,7 @@ "multi": false, "name": "gateway", "options": [], - "query": "label_values(request_total{dst_target_cluster=\"$cluster\"}, dst_remote_gateway)", + "query": "label_values(request_total{dst_target_cluster=\"$cluster\"}, dst_target_gateway)", "refresh": 2, "regex": "", "skipUrlSync": false,