Browse Source

Add Provider to APICallRecord

Change-Id: I12012bbcfdd28452d7772a5b652716d0c69f5282
(cherry picked from commit bcb3210760)
tags/16.1.0
Shawn Wang 1 month ago
parent
commit
81d8a87155
3 changed files with 6 additions and 4 deletions
  1. +2
    -1
      vmware_nsxlib/v3/cluster.py
  2. +2
    -2
      vmware_nsxlib/v3/config.py
  3. +2
    -1
      vmware_nsxlib/v3/utils.py

+ 2
- 1
vmware_nsxlib/v3/cluster.py View File

@@ -771,7 +771,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


+ 2
- 2
vmware_nsxlib/v3/config.py View File

@@ -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.



+ 2
- 1
vmware_nsxlib/v3/utils.py View File

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