From 0a658e4227a8318b3b68de8faf3d5cb7f29576f0 Mon Sep 17 00:00:00 2001 From: Tom Booth Date: Tue, 22 Aug 2017 18:27:02 +0100 Subject: [PATCH] When a location belongs to a Service key metrics We want to be able to track the metrics for a particular service or namespace, so that we can attribute the issues we see in aggregate in server/upstream errors. --- controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index 20e659214..e51aedd36 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -781,6 +781,11 @@ stream { proxy_set_header Accept-Encoding ""; {{ end }} + {{ if (and $all.Cfg.EnableVtsStatus $location.Service) }} + vhost_traffic_status_filter_by_set_key {{ $location.Service.ObjectMeta.Namespace }} kubernetes::namespace; + vhost_traffic_status_filter_by_set_key {{ $location.Service.ObjectMeta.Namespace }}.{{ $location.Service.ObjectMeta.Name }} kubernetes::service; + {{ end }} + {{/* Add any additional configuration defined */}} {{ $location.ConfigurationSnippet }}