<commit_before>import os
import datetime
import tornado.gen
import statsd

if os.environ.get("STATSD_URL", None):
    ip, port = os.environ.get("STATSD_URL").split(':')
    statsd_client = statsd.Client(ip, int(port))
else:
    statsd_client = None


def instrument(name):
    def instrument_wrapper(fn):
        @tornado.gen.coroutine
        def fn_wrapper(*args, **kwargs):
            def send_duration():
                duration = (datetime.datetime.now() - start).total_seconds()
                statsd_client.timing("{}.duration".format(name),
                                     int(duration * 1000))

            start = datetime.datetime.now()
            ftr_result = fn(*args, **kwargs)

            try:
                result = yield ftr_result<commit_msg>FIx issue with oneway methods<commit_after>import os
import datetime
import tornado.gen
import statsd

if os.environ.get("STATSD_URL", None):
    ip, port = os.environ.get("STATSD_URL").split(':')
    statsd_client = statsd.Client(ip, int(port))
else:
    statsd_client = None


def instrument(name):
    def instrument_wrapper(fn):
        @tornado.gen.coroutine
        def fn_wrapper(*args, **kwargs):
            def send_duration():
                duration = (datetime.datetime.now() - start).total_seconds()
                statsd_client.timing("{}.duration".format(name),
                                     int(duration * 1000))

            start = datetime.datetime.now()
            ftr_result = fn(*args, **kwargs)

            try:
                result = yield tornado.gen.maybe_future(ftr_result)
{'fraction_non_alphanumeric': 0.1210592686002522, 'fraction_numerical': 0.005044136191677175, 'mean_word_length': 2.245398773006135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3998752', 'n_tokens_mistral': 473, 'n_tokens_neox': 453, 'n_words': 93}