Esempio n. 1
0
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)}'
Esempio n. 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)}"
Esempio n. 3
0
 def test_shortlabel(self, *, table):
     assert shortlabel(table)
Esempio n. 4
0
 def test_shortlabel(self, *, proxy):
     assert shortlabel(proxy) == 'Proxy'
Esempio n. 5
0
 def test_shortlabel(self, *, con):
     assert shortlabel(con)