diff --git a/vmware_nsxlib/v3/cluster.py b/vmware_nsxlib/v3/cluster.py index 99f6ec94..e9d8ac00 100644 --- a/vmware_nsxlib/v3/cluster.py +++ b/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 diff --git a/vmware_nsxlib/v3/config.py b/vmware_nsxlib/v3/config.py index c1036c48..806f9800 100644 --- a/vmware_nsxlib/v3/config.py +++ b/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. diff --git a/vmware_nsxlib/v3/utils.py b/vmware_nsxlib/v3/utils.py index 8f9fae41..50999aa4 100644 --- a/vmware_nsxlib/v3/utils.py +++ b/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):