def main(directory):
    if not os.path.isdir(directory):
        sys.exit("ERROR: {} is not a directory".format(directory))

    # tag the metrics to group them together
    metrics.tag("worker_latency", "worker")
    metrics.tag("worker_throughput", "worker")

    # register a csv reporter that will dump the metrics with the tag "worker" each 2 seconds
    # to csv files in the given directory
    reporter.register(
        reporter.CSVReporter(directory), reporter.fixed_interval_scheduler(2), "worker")

    # emulate some work
    print("Hit CTRL-C to stop the process")
    while True:
        try:
            worker()
        except __HOLE__:
            break
dataset/ETHPy150Open avalente/appmetrics/examples/csv_reporter.py/main