Skip to content

Commit

Permalink
add testing to see if metadata is collected when collect_server_info …
Browse files Browse the repository at this point in the history
…is false
  • Loading branch information
HadhemiDD committed Jun 13, 2023
1 parent be33e36 commit 8996405
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions envoy/datadog_checks/envoy/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ def _collect_metadata(self):
if not self.base_url:
self.log.debug("Skipping server info collection due to malformed url: %s", self.base_url)
return
raw_version = None

# From http://domain/thing/stats to http://domain/thing/server_info
if self.collect_server_info:
server_info_url = urljoin(self.base_url, 'server_info')
raw_version = _get_server_info(server_info_url, self.log, self.http)
if not self.collect_server_info:
self.log.debug("Skipping server info collection as it is disabled, collect_server_info: %s", self.collect_server_info)
return

server_info_url = urljoin(self.base_url, 'server_info')
raw_version = _get_server_info(server_info_url, self.log, self.http)

if raw_version:
self.set_metadata('version', raw_version)

0 comments on commit 8996405

Please sign in to comment.