def _build_metrics(func_name, namespace):
metrics = {'<STR_LIT>': func_name, '<STR_LIT>': datetime.utcnow(),<EOL>'<STR_LIT>': '<STR_LIT:{}>'.format(list(sys.argv)), '<STR_LIT:user>': getpass.getuser()}<EOL>assert isinstance(namespace, Namespace)<EOL>tmp_dic = vars(namespace)<EOL>metrics['<STR_LIT>'] = tmp_dic.get('<STR_LIT>')<EOL>metrics['<STR_LIT>'] = tmp_dic.get('<STR_LIT>')<EOL>metrics['<STR_LIT>'] = tmp_dic.get('<STR_LIT>')<EOL>metrics['<STR_LIT>'] = socket.gethostname()<EOL>extra = json.dumps(dict((k, metrics[k]) for k in ('<STR_LIT>', '<STR_LIT>')))<EOL>log = Log(<EOL>event='<STR_LIT>'.format(func_name),<EOL>task_instance=None,<EOL>owner=metrics['<STR_LIT:user>'],<EOL>extra=extra,<EOL>task_id=metrics.get('<STR_LIT>'),<EOL>dag_id=metrics.get('<STR_LIT>'),<EOL>execution_date=metrics.get('<STR_LIT>'))<EOL>metrics['<STR_LIT>'] = log<EOL>return metrics<EOL>
Builds metrics dict from function args
It assumes that function arguments is from airflow.bin.cli module's function
and has Namespace instance where it optionally contains "dag_id", "task_id",
and "execution_date".

:param func_name: name of function
:param namespace: Namespace instance from argparse
:return: dict with metrics