It is faster to use join for join multiple strings than the regular
string concatenation since it does not create a new string on each
iteration.
Signed-off-by: Boris Ranto <branto@redhat.com>
))
self.metrics.set(path, value, (daemon,))
-
return self.metrics.all()
def get_file_sd_config(self):
return self
def format_metrics(self, metrics):
- formatted = ''
- for m in metrics.values():
- formatted += m.str_expfmt()
- return formatted + '\n'
+ _metrics = [m.str_expfmt() for m in metrics.values()]
+ return ''.join(_metrics) + '\n'
@cherrypy.expose
def index(self):