docs: def mean(name, add, match):
      '''
      Accept a numeric value from the matched events and store a running average
      of the values in the given register. If the specified value is not numeric
      it will be skipped
  
      USAGE:
  
      .. code-block:: yaml
  
          foo:
            reg.mean:
              - add: data_field
              - match: my/custom/event
      '''
      ret = {'name': name,
             'changes': {},
             'comment': '',
             'result': True}
      if name not in __reg__:
          __reg__[name] = {}
          __reg__[name]['val'] = 0
          __reg__[name]['total'] = 0
          __reg__[name]['count'] = 0
      for event in __events__:
          try:
              event_data = event['data']['data']
          except KeyError:
              event_data = event['data']
          if salt.utils.stringutils.expr_match(event['tag'], match):
              if add in event_data:
                  try:
                      comp = int(event_data)
                  except ValueError:
                      continue
              __reg__[name]['total'] += comp
              __reg__[name]['count'] += 1
              __reg__[name]['val'] = __reg__[name]['total'] / __reg__[name]['count']
      return ret