Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vsphere/changelog.d/21730.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add infra_mode tag to vsphere metrics
2 changes: 2 additions & 0 deletions vsphere/datadog_checks/vsphere/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,5 @@
VSAN_EVENT_PREFIX = 'vsan'

HOSTNAME_CASE_OPTIONS = ['default', 'lower', 'upper']

INFRA_MODE_METRIC = 'cpu.usage.avg'
6 changes: 6 additions & 0 deletions vsphere/datadog_checks/vsphere/vsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
DEFAULT_MAX_QUERY_METRICS,
HISTORICAL,
HOST_RESOURCES,
INFRA_MODE_METRIC,
MAX_QUERY_METRICS_OPTION,
PROPERTY_COUNT_METRICS,
PROPERTY_METRICS_BY_RESOURCE_TYPE,
Expand Down Expand Up @@ -453,6 +454,11 @@ def submit_metrics_callback(self, query_results):

tags.extend(self._config.base_tags)

if metric_name == INFRA_MODE_METRIC:
infra_mode = datadog_agent.get_config('infrastructure_mode')
if infra_mode is not None and infra_mode != '' and infra_mode != 'full':
tags.append('infra_mode:{}'.format(infra_mode))

value = valid_values[-1]
if metric_name in PERCENT_METRICS:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure when the vsphere. prefix is added to the collected metric_name (the logic here matches the metric_name against PERCENT_METRICS, which does not have this prefix, see code )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vsphere. prefix is added by the __NAMESPACE__ attribute, see:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this but will doublecheck with the live test that it's working properly

# Convert the percentage to a float.
Expand Down
Loading