From dc8290a195563a6f4cb1c846fd1a55c9f326a231 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Tue, 17 Oct 2017 21:39:12 +0300 Subject: [PATCH] NSX|V add more details to vcns debug logs Adding the method and uri called to the reply log to help us filter the results Change-Id: I8aeb7c1f8e07320c20c34787890f0f3c6a7008b0 --- vmware_nsx/plugins/nsx_v/vshield/vcns.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/vshield/vcns.py b/vmware_nsx/plugins/nsx_v/vshield/vcns.py index 8f9f875e8a..5de02551ed 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/vcns.py +++ b/vmware_nsx/plugins/nsx_v/vshield/vcns.py @@ -87,6 +87,7 @@ NETWORK_TYPES = ['Network', 'VirtualWire', 'DistributedVirtualPortgroup'] # Dynamic routing constants ROUTING_CONFIG = "routing/config" BGP_ROUTING_CONFIG = "routing/config/bgp" +ELAPSED_TIME_THRESHOLD = 30 def retry_upon_exception_exclude_error_codes( @@ -143,10 +144,18 @@ class Vcns(object): header, content = self._client_request(_client, method, uri, params, headers, encodeParams) te = time.time() + elapsed_time = te - ts + + LOG.debug('VcnsApiHelper for %(method)s %(uri)s took %(seconds)2.4f. ' + 'reply: header=%(header)s content=%(content)s', + {'method': method, 'uri': uri, + 'header': header, 'content': content, + 'seconds': elapsed_time}) + if elapsed_time > ELAPSED_TIME_THRESHOLD: + LOG.warning('Vcns call for %(method)s %(uri)s took %(seconds)2.4f', + {'method': method, 'uri': uri, + 'seconds': elapsed_time}) - LOG.debug('VcnsApiHelper reply: header=%(header)s content=%(content)s' - ' took %(seconds)2.4f', - {'header': header, 'content': content, 'seconds': te - ts}) if content == '': return header, {} if kwargs.get('decode', True):