From eb10ff987116bbf82d93b76b9ec9a23ced4362fd Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Sun, 23 Oct 2016 13:33:54 +0200 Subject: [PATCH] Also handle service update in endpoints.go --- retrieval/discovery/kubernetes/endpoints.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/retrieval/discovery/kubernetes/endpoints.go b/retrieval/discovery/kubernetes/endpoints.go index 696298dfb6..0ca93f8374 100644 --- a/retrieval/discovery/kubernetes/endpoints.go +++ b/retrieval/discovery/kubernetes/endpoints.go @@ -111,9 +111,18 @@ func (e *Endpoints) Run(ctx context.Context, ch chan<- []*config.TargetGroup) { e.serviceInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ // TODO(fabxc): potentially remove add and delete event handlers. Those should // be triggered via the endpoint handlers already. - AddFunc: func(o interface{}) { serviceUpdate(o.(*apiv1.Service)) }, - UpdateFunc: func(_, o interface{}) { serviceUpdate(o.(*apiv1.Service)) }, - DeleteFunc: func(o interface{}) { serviceUpdate(o.(*apiv1.Service)) }, + AddFunc: func(o interface{}) { + eventCount.WithLabelValues("service", "add").Inc() + serviceUpdate(o.(*apiv1.Service)) + }, + UpdateFunc: func(_, o interface{}) { + eventCount.WithLabelValues("service", "update").Inc() + serviceUpdate(o.(*apiv1.Service)) + }, + DeleteFunc: func(o interface{}) { + eventCount.WithLabelValues("service", "delete").Inc() + serviceUpdate(o.(*apiv1.Service)) + }, }) // Block until the target provider is explicitly canceled.