コード例 #1
0
ファイル: tracing.py プロジェクト: yishuihanhan/faust
def operation_name_from_fun(fun: Any) -> str:
    obj = getattr(fun, '__self__', None)
    if obj is not None:
        objlabel = shortlabel(obj)
        funlabel = shortlabel(fun)
        if funlabel.startswith(objlabel):
            # remove obj name from function label
            funlabel = funlabel[len(objlabel):]
        return f'{objlabel}-{funlabel}'
    else:
        return f'{shortlabel(fun)}'
コード例 #2
0
def operation_name_from_fun(fun: Any) -> str:
    """Generate opentracing name from function."""
    obj = getattr(fun, "__self__", None)
    if obj is not None:
        objlabel = shortlabel(obj)
        funlabel = shortlabel(fun)
        if funlabel.startswith(objlabel):
            # remove obj name from function label
            funlabel = funlabel[len(objlabel) :]
        return f"{objlabel}-{funlabel}"
    else:
        return f"{shortlabel(fun)}"
コード例 #3
0
 def test_shortlabel(self, *, table):
     assert shortlabel(table)
コード例 #4
0
 def test_shortlabel(self, *, proxy):
     assert shortlabel(proxy) == 'Proxy'
コード例 #5
0
ファイル: test_conductor.py プロジェクト: zhouyuking/faust
 def test_shortlabel(self, *, con):
     assert shortlabel(con)