8000 Fixing `start_transaction` by szokeasaurusrex · Pull Request #3379 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

Fixing start_transaction #3379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions sentry_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def overload(x):
"set_tags",
"set_user",
"start_span",
"start_inactive_span",
"start_transaction",
"trace",
"monitor",
Expand Down Expand Up @@ -338,14 +337,11 @@ def start_span(
**kwargs, # type: Any
):
# type: (...) -> POTelSpan
return tracing.start_span(**kwargs)


def start_inactive_span(
**kwargs, # type: Any
):
# type: (...) -> POTelSpan
return tracing.start_inactive_span(**kwargs)
"""
Alias for tracing.POTelSpan constructor. The method signature is the same.
"""
# TODO: Consider adding type hints to the method signature.
return tracing.POTelSpan(**kwargs)


def start_transaction(
Expand Down Expand Up @@ -387,7 +383,7 @@ def start_transaction(
constructor. See :py:class:`sentry_sdk.tracing.Transaction` for
available arguments.
"""
return tracing.start_transaction(transaction, custom_sampling_context, **kwargs)
return start_span(**kwargs)


def set_measurement(name, value, unit=""):
Expand Down
29 changes: 7 additions & 22 deletions sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,21 +1249,19 @@ class POTelSpan:

def __init__(
self,
*,
active=True, # type: bool
trace_id=None, # type: Optional[str]
span_id=None, # type: Optional[str]
parent_span_id=None, # type: Optional[str]
same_process_as_parent=True, # type: bool
sampled=None, # type: Optional[bool]
op=None, # type: Optional[str]
description=None, # type: Optional[str]
status=None, # type: Optional[str]
containing_transaction=None, # type: Optional[Transaction]
start_timestamp=None, # type: Optional[Union[datetime, float]]
scope=None, # type: Optional[sentry_sdk.Scope]
origin="manual", # type: str
**_, # type: dict[str, object]
):
# type: (...) -> None
"""
For backwards compatibility with old the old Span interface, this class
accepts arbitrary keyword arguments, in addition to the ones explicitly
listed in the signature. These additional arguments are ignored.
"""
from sentry_sdk.integrations.opentelemetry.consts import SentrySpanAttribute

self._otel_span = tracer.start_span(description or op or "") # XXX
Expand Down Expand Up @@ -1443,19 +1441,6 @@ async def my_async_function():
return start_child_span_decorator


def start_span(*args, **kwargs):
return POTelSpan(*args, active=True, **kwargs)


def start_inactive_span(*args, **kwargs):
return POTelSpan(*args, active=False, **kwargs)


def start_transaction(*args, **kwargs):
# XXX force_transaction?
return POTelSpan(*args, active=True, **kwargs)


# Circular imports

from sentry_sdk.tracing_utils import (
Expand Down
Loading
0