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
This commit is contained in:
Adit Sarfaty 2017-10-17 21:39:12 +03:00
parent df834c9980
commit dc8290a195

View File

@ -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):