Fix mc labels (#4560)

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
This commit is contained in:
Zahari Dichev 2020-06-05 19:36:09 +03:00 committed by GitHub
parent b6b95455aa
commit 3365455e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 36 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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": "<div class=\"text-center dashboard-header\">\n <span>TRAFFIC BY REMOTE SERVICE</span>\n</div>",
"content": "<div class=\"text-center dashboard-header\">\n <span>TRAFFIC BY TARGET SERVICE</span>\n</div>",
"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,