def new_tank_metric(self, _type, name, hostname=None, group=None, source=None, *kw):
if not _type:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if _type in available_metrics:<EOL><INDENT>metric_obj = available_metrics[_type](None, self.routing_queue)  <EOL>metric_info = {'<STR_LIT:type>': _type,<EOL>'<STR_LIT:source>': source,<EOL>'<STR_LIT:name>': name,<EOL>'<STR_LIT>': hostname,<EOL>'<STR_LIT>': group}<EOL>if kw is not None:<EOL><INDENT>metric_info.update(kw)<EOL><DEDENT>metric_meta = pd.DataFrame({metric_obj.local_id: metric_info}).T  <EOL>self.metrics_meta = self.metrics_meta.append(metric_meta)  <EOL>self.metrics[metric_obj.local_id] = metric_obj  <EOL>this_metric_subscribers = self.__reversed_filter(self.subscribers, metric_info)<EOL>if this_metric_subscribers.empty:<EOL><INDENT>logger.debug('<STR_LIT>', metric_obj.local_id)<EOL><DEDENT>else:<EOL><INDENT>logger.debug('<STR_LIT>', this_metric_subscribers)<EOL>this_metric_subscribers['<STR_LIT:id>'] = metric_obj.local_id<EOL>found_callbacks = this_metric_subscribers[['<STR_LIT:id>', '<STR_LIT>']].set_index('<STR_LIT:id>')<EOL>self.callbacks = self.callbacks.append(found_callbacks)<EOL><DEDENT>return metric_obj<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError('<STR_LIT>' % _type)<EOL><DEDENT>
Create and register metric,
find subscribers for this metric (using meta as filter) and subscribe

Return:
    metric (available_metrics[0]): one of Metric