Skip to content

Commit

Permalink
removing last comma
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulkaukuntla committed Dec 12, 2024
1 parent e47ff39 commit b098424
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions vsphere/datadog_checks/vsphere/vsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,9 @@ def send_resource_to_redapl(self, clusters_data):
input_data[i] = ''
input_data[i] += str(v) + ','
for i, v in input_data.items():
self.log.debug("Sending resource to redapl: %s, %s", i, v)
self.set_metadata(i, v)
# we want to remove the last comma to avoid adding an empty '' resource
self.log.debug("Sending resource to redapl: %s, %s", i, v.rstrip(','))
self.set_metadata(i, v.rstrip(','))

def make_query_specs(self):
# type: () -> Iterable[List[vim.PerformanceManager.QuerySpec]]
Expand Down
2 changes: 1 addition & 1 deletion vsphere/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3627,7 +3627,7 @@ def test_vsan_cluster_to_redapl(realtime_instance, dd_run_check, datadog_agent,

dd_run_check(check)

datadog_agent.assert_metadata('', {'attr0': '1.0,', 'attr1': 'value1,', 'attr2': '123,'})
datadog_agent.assert_metadata('', {'attr0': '1.0', 'attr1': 'value1', 'attr2': '123'})
# 6 elts of version metadata + 3 elts of cluster metadata
datadog_agent.assert_metadata_count(9)

Expand Down

0 comments on commit b098424

Please sign in to comment.