Skip to content

Commit

Permalink
Merge pull request #2351 from DataDog/joseph/tzname-ugly-fix
Browse files Browse the repository at this point in the history
[collector.py] ugly fix for the tzname encoding issue
  • Loading branch information
olivielpeau committed Mar 25, 2016
2 parents 0f5e805 + 3a9d3aa commit cda8715
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion checks/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ def _get_hostname_metadata(self):
pass

metadata["hostname"] = self.hostname
metadata["timezones"] = time.tzname
metadata["timezones"] = sanitize_tzname(time.tzname)

# Add cloud provider aliases
host_aliases = GCE.get_host_aliases(self.agentConfig)
Expand All @@ -773,3 +773,12 @@ def _should_send_additional_data(self, data_name):
return True

return False

def sanitize_tzname(tzname):
""" Returns the tzname given, and deals with Japanese encoding issue
"""
if tzname[0] == '\x93\x8c\x8b\x9e (\x95W\x8f\x80\x8e\x9e)':
log.debug('tzname from TOKYO detected and converted')
return ('JST', 'JST')
else:
return tzname

0 comments on commit cda8715

Please sign in to comment.