(load_type, source, domain_name, extra_tags=None)
return track_load
Make a function to track load by counting touched items

    :param load_type: Load type (`"case"`, `"form"`, `"sms"`). Use one
    of the convenience functions below (e.g., `case_load_counter`)
    rather than passing a string literal.
    :param source: Load source string. Example: `"form_submission"`.
    :param domain_name: Domain name string.
    :param extra_tags: Optional dict of extra metric tags.
    :returns: Function that adds load when called: `add_load(value=1)`.
Make a function to track load by counting touched items
Make a function to track load by counting touched items
def load_counter(load_type, source, domain_name, extra_tags=None):
    """Make a function to track load by counting touched items

    :param load_type: Load type (`"case"`, `"form"`, `"sms"`). Use one
    of the convenience functions below (e.g., `case_load_counter`)
    rather than passing a string literal.
    :param source: Load source string. Example: `"form_submission"`.
    :param domain_name: Domain name string.
    :param extra_tags: Optional dict of extra metric tags.
    :returns: Function that adds load when called: `add_load(value=1)`.
    """
    from corehq.util.metrics import metrics_counter
    tags = extra_tags or {}
    tags['src'] = source
    tags['domain'] = domain_name
    metric = "commcare.load.%s" % load_type

    def track_load(value=1):
        metrics_counter(metric, value, tags=tags)

    return track_load
def load_counter ( load_type , source , domain_name , extra_tags = None ) : from corehq . util . metrics import metrics_counter tags = extra_tags or { } tags [ 'src' ] = source tags [ 'domain' ] = domain_name metric = "commcare.load.%s" % load_type def track_load ( value = 1 ) : metrics_counter ( metric , value , tags = tags ) return track_load