1515
1616
1717def _span_wrapper (
18- span_name : str | None ,
18+ name : str | None ,
1919 attributes : Attributes | None ,
2020 tracer : Tracer | None ,
2121) -> Callable [[Func ], Func ]:
2222 def span_decorator (func : Func ) -> Func :
23- name : str = span_name or func .__name__
23+ name_ = name or func .__name__
2424 tracer_ = tracer or trace .get_tracer (__name__ )
2525
2626 @wraps (func )
2727 def sync_span_wrapper (* args : F_Spec .args , ** kwargs : F_Spec .kwargs ) -> F_Return : # type: ignore[type-var]
28- with tracer_ .start_as_current_span (name = name , attributes = attributes ):
28+ with tracer_ .start_as_current_span (name = name_ , attributes = attributes ):
2929 result = func (* args , ** kwargs )
3030 return cast (F_Return , result )
3131
3232 @wraps (func )
3333 async def async_span_wrapper (* args : F_Spec .args , ** kwargs : F_Spec .kwargs ) -> F_Return :
34- with tracer_ .start_as_current_span (name = name , attributes = attributes ):
34+ with tracer_ .start_as_current_span (name = name_ , attributes = attributes ):
3535 result = await func (* args , ** kwargs )
3636 return cast (F_Return , result )
3737
@@ -46,7 +46,7 @@ async def async_span_wrapper(*args: F_Spec.args, **kwargs: F_Spec.kwargs) -> F_R
4646def span (
4747 call : Func ,
4848 * ,
49- span_name : None = None ,
49+ name : None = None ,
5050 attributes : None = None ,
5151 tracer : None = None ,
5252) -> Func : ...
@@ -56,7 +56,7 @@ def span(
5656def span (
5757 call : None = None ,
5858 * ,
59- span_name : str | None = None ,
59+ name : str | None = None ,
6060 attributes : Attributes | None = None ,
6161 tracer : Tracer | None = None ,
6262) -> Callable [[Func ], Func ]: ...
@@ -65,11 +65,11 @@ def span(
6565def span (
6666 call : Func | None = None ,
6767 * ,
68- span_name : str | None = None ,
68+ name : str | None = None ,
6969 attributes : Attributes | None = None ,
7070 tracer : Tracer | None = None ,
7171) -> Callable [[Func ], Func ] | Func :
72- wrap_decorator = _span_wrapper (span_name , attributes , tracer )
72+ wrap_decorator = _span_wrapper (name , attributes , tracer )
7373 if call is None :
7474 return wrap_decorator
7575 else :
0 commit comments