'Extracts the metrics from a line of metric and update the given
dictionnaries (we take advantage of the reference of the dictionary here)'

def _extract_metrics_from_string(self, line, messages, obj_map, obj_help):

    if line.startswith('#    TYPE'):
        metric = line.split('    ')
        if (len(metric) == 4):
            obj_map[metric[2]] = metric[3]
    elif line.startswith('#    HELP'):
        _h = line.split('    ', 3)
        if (len(_h) == 4):
            obj_help[_h[2]] = _h[3]
    elif (not line.startswith('#')):
        _match = self.metrics_pattern.match(line)
        if (_match is not None):
            _g = _match.groups()
            _msg = []
            _lbls = self._extract_labels_from_string(_g[1])
            if (_g[0] in messages):
                _msg = messages[_g[0]]
            _msg.append({'labels': _lbls, 'value': _g[2]})
            messages[_g[0]] = _msg
