Skip to content

Commit

Permalink
Docstring updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Jan 13, 2015
1 parent ac4f876 commit 5d45460
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/vpoller/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def _entity_perf_metric_info(self, entity):
entity (pyVmomi.vim.*): A managed entity to lookup
Returns:
Information about supported performance counters for the entity
Information about supported performance metrics for the entity
"""
if not isinstance(entity, pyVmomi.vim.ManagedEntity):
Expand Down Expand Up @@ -608,7 +608,7 @@ def _entity_perf_metric_info(self, entity):

def _entity_perf_metric_get(self, entity, counter_id, max_sample=1, instance="", interval_key=None):
"""
Retrieve performance statistics from a managed object
Retrieve performance metrics from a managed object
Args:
entity (pyVmomi.vim.*): A managed object
Expand All @@ -618,7 +618,7 @@ def _entity_perf_metric_get(self, entity, counter_id, max_sample=1, instance="",
interval_key (int): Key of historical performance interval to use
Returns:
The collected performance statistics from the managed object
The collected performance metrics from the managed object
"""
logging.info(
Expand Down Expand Up @@ -649,23 +649,22 @@ def _entity_perf_metric_get(self, entity, counter_id, max_sample=1, instance="",

if not provider_summary.currentSupported:
logging.info('[%s] Entity %s does not support real-time statistics', self.host, entity.name)
logging.info('[%s] Fall back to historical statistics only for entity %s', self.host, entity.name)
logging.info('[%s] Retrieving historical statistics for entity %s', self.host, entity.name)

if not provider_summary.currentSupported and not interval_key:
logging.warning(
'[%s] Entity %s supports only historical statistics, but no historical interval provided',
'[%s] Entity %s supports historical statistics only, but no historical interval provided',
self.host,
entity.name
)
return {'success': 1, 'msg': 'Entity %s supports historical statistics only, but no historical interval provided' % entity.name }
return {'success': 1, 'msg': 'Entity %s supports historical statistics only, but no historical interval provided' % entity.name}

# For real-time statistics use the refresh rate of the provider.
# For historical statistics use one of the existing historical
# intervals on the system.

# If an interval key is provided use the samping period as
# defined by the historical interval, otherwise use the
# providers' refresh rate value
# For managed entities that support both real-time and historical
# statistics in order to retrieve historical stats a valid
# interval key should be provided.
if interval_key:
if interval_key not in [str(i.key) for i in historical_interval]:
logging.warning(
Expand All @@ -691,7 +690,7 @@ def _entity_perf_metric_get(self, entity, counter_id, max_sample=1, instance="",
'msg': 'Requested performance counters are not available for entity %s' % entity.name,
}

to_collect_metric_id = [pyVmomi.vim.PerformanceManager.MetricId(counterId=counter_id, instance=instance) for counter_id in to_collect_counter_id]
to_collect_metric_id = [pyVmomi.vim.PerformanceManager.MetricId(counterId=c_id, instance=instance) for c_id in to_collect_counter_id]

# Get the metric IDs to collect and build our query spec
if not max_sample:
Expand Down

0 comments on commit 5d45460

Please sign in to comment.