def generate_latest(registry=core.REGISTRY):
    output = []
    for metric in registry.collect():
        output.append('# HELP {0} {1}'.format(
            metric.name, metric.documentation.replace('\\', r'\\').replace('\n', r'\n')))
        output.append('\n# TYPE {0} {1}\n'.format(metric.name, metric.type))
        for name, labels, value in metric.samples:
            if labels:
                labelstr = '{{{0}}}'.format(','.join(
                    ['{0}="{1}"'.format(
                     k, v.replace('\\', r'\\').replace('\n', r'\n').replace('"', r'\"'))
                     for k, v in sorted(labels.items())]))
            else:
                labelstr = ''
            output.append('{0}{1} {2}\n'.format(name, labelstr, core._floatToGoString(value)))
    return ''.join(output).encode('utf-8')
Set the hash fields to their respective values.
dataset/ETHPy150Open prometheus/client_python/prometheus_client/exposition.py/generate_latest--crossover with--dataset/ETHPy150Open jookies/jasmin/jasmin/vendor/txredisapi.py/RedisProtocol.hmset