diff options
author | 2019-10-04 17:48:43 +0200 | |
---|---|---|
committer | 2019-10-04 16:48:43 +0100 | |
commit | d7cdb992b4f96603d444b7ab058594563c5fe043 (patch) | |
tree | f86cd9bc6acc2c69b30a0980b2a4ed2b481ca45f /plugin/kubernetes/object/endpoint.go | |
parent | 03ea2ae955823612da2e3b2ebf21da7ab8eea1bd (diff) | |
download | coredns-d7cdb992b4f96603d444b7ab058594563c5fe043.tar.gz coredns-d7cdb992b4f96603d444b7ab058594563c5fe043.tar.zst coredns-d7cdb992b4f96603d444b7ab058594563c5fe043.zip |
Measure and expose DNS programming latency from Kubernetes plugin. (#3171)
For now metric is measure only for headless services. Informer has been slighlty
refactored, so the code can measure latency without storing extra fields on
Endpoint struct.
Signed-off-by: Janek Ćukaszewicz <janluk@google.com>
Suggestions from code review
Co-Authored-By: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin/kubernetes/object/endpoint.go')
-rw-r--r-- | plugin/kubernetes/object/endpoint.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/plugin/kubernetes/object/endpoint.go b/plugin/kubernetes/object/endpoint.go index b2c77fc10..c7d6b7323 100644 --- a/plugin/kubernetes/object/endpoint.go +++ b/plugin/kubernetes/object/endpoint.go @@ -44,10 +44,10 @@ type EndpointPort struct { func EndpointsKey(name, namespace string) string { return name + "." + namespace } // ToEndpoints converts an api.Endpoints to a *Endpoints. -func ToEndpoints(obj interface{}) interface{} { +func ToEndpoints(obj interface{}) (*api.Endpoints, *Endpoints) { end, ok := obj.(*api.Endpoints) if !ok { - return nil + return nil, nil } e := &Endpoints{ @@ -93,9 +93,7 @@ func ToEndpoints(obj interface{}) interface{} { } } - *end = api.Endpoints{} - - return e + return end, e } // CopyWithoutSubsets copies e, without the subsets. |