Browse Source

Convert statistics data to unicode for use as kwargs. Thanks Lucy!

Ask Solem 15 years ago
parent
commit
ecf22aa3b6
1 changed files with 4 additions and 1 deletions
  1. 4 1
      celery/monitoring.py

+ 4 - 1
celery/monitoring.py

@@ -171,8 +171,11 @@ class StatsCollector(object):
             stats_entry = message.decode()
             stat_type = stats_entry["type"]
             if stat_type in self.allowed_types:
+                # Decode keys to unicode for use as kwargs.
+                data = dict((key.encode("utf-8"), value)
+                                for key, value in stats_entry["data"].items())
                 handler = getattr(self, stat_type)
-                handler(**stats_entry["data"])
+                handler(**data)
 
     def dump_to_cache(self, cache_key_prefix=DEFAULT_CACHE_KEY_PREFIX):
         """Store collected statistics in the cache."""