Skip to content

Commit 35d8f12

Browse files
committed
remove template stuff
1 parent 0b84d48 commit 35d8f12

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

sentry_sdk/tracing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from enum import Enum
66

77
import sentry_sdk
8-
from sentry_sdk.consts import INSTRUMENTER, SPANSTATUS, SPANDATA, SPANTEMPLATE
8+
from sentry_sdk.consts import INSTRUMENTER, SPANSTATUS, SPANDATA
99
from sentry_sdk.profiler.continuous_profiler import get_profiler_id
1010
from sentry_sdk.tracing_utils import create_span_decorator
1111
from sentry_sdk.utils import (
@@ -1407,7 +1407,6 @@ def make_db_query(sql):
14071407
pass
14081408
"""
14091409
decorator = create_span_decorator(
1410-
template=SPANTEMPLATE.SPAN,
14111410
op=op,
14121411
name=name,
14131412
attributes=attributes,

sentry_sdk/tracing_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,12 +830,11 @@ def _sample_rand_range(parent_sampled, sample_rate):
830830
return sample_rate, 1.0
831831

832832

833-
def create_span_decorator(template, op=None, name=None, attributes=None):
834-
# type: (Union[str, "SPANTEMPLATE"], Optional[str], Optional[str], Optional[dict[str, Any]]) -> Any
833+
def create_span_decorator(op=None, name=None, attributes=None):
834+
# type: (Optional[str], Optional[str], Optional[dict[str, Any]]) -> Any
835835
"""
836836
Create a span decorator that can wrap both sync and async functions.
837837
838-
:param template: The type of span to create (used for input/output attributes).
839838
:param op: The operation type for the span.
840839
:param name: The name of the span.
841840
:param attributes: Additional attributes to set on the span.
@@ -918,7 +917,6 @@ def sync_wrapper(*args, **kwargs):
918917

919918

920919
# Circular imports
921-
from sentry_sdk.consts import SPANTEMPLATE
922920
from sentry_sdk.tracing import (
923921
BAGGAGE_HEADER_NAME,
924922
LOW_QUALITY_TRANSACTION_SOURCES,

tests/tracing/test_decorator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_trace_decorator():
2424
fake_start_child.assert_not_called()
2525
assert result == "return_of_sync_function"
2626

27-
start_child_span_decorator = create_span_decorator(template="span")
27+
start_child_span_decorator = create_span_decorator()
2828
result2 = start_child_span_decorator(my_example_function)()
2929
fake_start_child.assert_called_once_with(
3030
op="function", name="test_decorator.my_example_function"
@@ -39,7 +39,7 @@ def test_trace_decorator_no_trx():
3939
fake_debug.assert_not_called()
4040
assert result == "return_of_sync_function"
4141

42-
start_child_span_decorator = create_span_decorator(template="span")
42+
start_child_span_decorator = create_span_decorator()
4343
result2 = start_child_span_decorator(my_example_function)()
4444
fake_debug.assert_called_once_with(
4545
"Cannot create a child span for %s. "
@@ -57,7 +57,7 @@ async def test_trace_decorator_async():
5757
fake_start_child.assert_not_called()
5858
assert result == "return_of_async_function"
5959

60-
start_child_span_decorator = create_span_decorator(template="span")
60+
start_child_span_decorator = create_span_decorator()
6161
result2 = await start_child_span_decorator(my_async_example_function)()
6262
fake_start_child.assert_called_once_with(
6363
op="function",
@@ -74,7 +74,7 @@ async def test_trace_decorator_async_no_trx():
7474
fake_debug.assert_not_called()
7575
assert result == "return_of_async_function"
7676

77-
start_child_span_decorator = create_span_decorator(template="span")
77+
start_child_span_decorator = create_span_decorator()
7878
result2 = await start_child_span_decorator(my_async_example_function)()
7979
fake_debug.assert_called_once_with(
8080
"Cannot create a child span for %s. "

0 commit comments

Comments
 (0)