From eb29f70a98a9506dc4d6cdcaaca11f63907db020 Mon Sep 17 00:00:00 2001 From: msukruth <57657460+msukruth@users.noreply.github.com> Date: Thu, 19 Dec 2019 23:35:27 +0530 Subject: [PATCH] Add host label to Proxy and Devapp monitored resources (#215) --- retrieval/resource_map.go | 2 ++ retrieval/resource_map_test.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/retrieval/resource_map.go b/retrieval/resource_map.go index 2f59061a..dcdaf821 100644 --- a/retrieval/resource_map.go +++ b/retrieval/resource_map.go @@ -99,6 +99,7 @@ var DevappResourceMap = ResourceMap{ "__meta_kubernetes_pod_label_org": constValue("org"), "__meta_kubernetes_pod_label_env": constValue("env"), "api_product_name": constValue("api_product_name"), + "__meta_kubernetes_pod_name": constValue("host"), }, } @@ -112,6 +113,7 @@ var ProxyResourceMap = ResourceMap{ "__meta_kubernetes_pod_label_env": constValue("env"), "proxy_name": constValue("proxy_name"), "revision": constValue("revision"), + "__meta_kubernetes_pod_name": constValue("host"), }, } diff --git a/retrieval/resource_map_test.go b/retrieval/resource_map_test.go index 9ffca92d..5d2e2d29 100644 --- a/retrieval/resource_map_test.go +++ b/retrieval/resource_map_test.go @@ -138,6 +138,7 @@ func TestTranslateDevapp(t *testing.T) { {KubernetesLocationLabel, "us-central1-a"}, {"__meta_kubernetes_pod_label_org", "my-org"}, {"__meta_kubernetes_pod_label_env", "my-env"}, + {"__meta_kubernetes_pod_name", "my-pod"}, } metricLabels := labels.Labels{ {"api_product_name", "my-name"}, @@ -149,6 +150,7 @@ func TestTranslateDevapp(t *testing.T) { "org": "my-org", "env": "my-env", "api_product_name": "my-name", + "host": "my-pod", } expectedFinalLabels := labels.Labels{ {"extra_label", "my-label"}, @@ -172,6 +174,7 @@ func TestTranslateProxy(t *testing.T) { {KubernetesLocationLabel, "us-central1-a"}, {"__meta_kubernetes_pod_label_org", "my-org"}, {"__meta_kubernetes_pod_label_env", "my-env"}, + {"__meta_kubernetes_pod_name", "my-pod"}, } metricLabels := labels.Labels{ {"proxy_name", "my-name"}, @@ -185,6 +188,7 @@ func TestTranslateProxy(t *testing.T) { "env": "my-env", "proxy_name": "my-name", "revision": "my-revision", + "host": "my-pod", } expectedFinalLabels := labels.Labels{ {"extra_label", "my-label"},