Browse Source

Add Provider to APICallRecord

Change-Id: I12012bbcfdd28452d7772a5b652716d0c69f5282
changes/48/748548/1
Shawn Wang 2 years ago
parent
commit
bcb3210760
No known key found for this signature in database
GPG Key ID: C98A86CC967E89A7
  1. 3
      vmware_nsxlib/v3/cluster.py
  2. 4
      vmware_nsxlib/v3/config.py
  3. 3
      vmware_nsxlib/v3/utils.py

3
vmware_nsxlib/v3/cluster.py

@ -774,7 +774,8 @@ class ClusteredAPI(object):
# add api call log
api_record = utils.APICallRecord(
verb=proxy_for, uri=uri, status=response.status_code)
verb=proxy_for, uri=uri, status=response.status_code,
provider=endpoint.provider.id)
endpoint.add_api_record(api_record)
# Adjust API Rate Limit before raising HTTP exception

4
vmware_nsxlib/v3/config.py

@ -153,9 +153,9 @@ class NsxLibConfig(object):
The rate has hard max limit of min(100/s, param
api_rate_limit_per_endpoint).
:param api_log_mode: Option to collect API call logs within nsxlib.
When set to API_LOG_PER_CLUSTER, API call sent to all
When set to API_LOG_PER_CLUSTER, API calls sent to all
endpoints will be collected at one place.
When set to API_LOG_PER_ENDPOINT, API call sent to
When set to API_LOG_PER_ENDPOINT, API calls sent to
each endpoint will be collected individually.
By default, this option is disabled as set to None.

3
vmware_nsxlib/v3/utils.py

@ -776,11 +776,12 @@ class APIRateLimiterAIMD(APIRateLimiter):
class APICallRecord(object):
def __init__(self, verb, uri, status, timestamp=None):
def __init__(self, verb, uri, status, provider=None, timestamp=None):
self.timestamp = timestamp or time.time()
self.verb = verb
self.uri = uri
self.status = status
self.provider = provider
class APICallCollector(object):

Loading…
Cancel
Save