7070
7171 import sentry_sdk
7272
73- class StartTransactionKwargs (TransactionKwargs , total = False ):
74- client : Optional ["sentry_sdk.Client" ]
75- custom_sampling_context : SamplingContext
76-
7773 P = ParamSpec ("P" )
7874 R = TypeVar ("R" )
7975
@@ -966,9 +962,13 @@ def add_breadcrumb(self, crumb=None, hint=None, **kwargs):
966962 self ._breadcrumbs .popleft ()
967963
968964 def start_transaction (
969- self , transaction = None , instrumenter = INSTRUMENTER .SENTRY , ** kwargs
965+ self ,
966+ transaction = None ,
967+ instrumenter = INSTRUMENTER .SENTRY ,
968+ custom_sampling_context = None ,
969+ ** kwargs
970970 ):
971- # type: (Optional[Transaction], str, Unpack[StartTransactionKwargs ]) -> Union[Transaction, NoOpSpan]
971+ # type: (Optional[Transaction], str, Optional[SamplingContext], Unpack[TransactionKwargs ]) -> Union[Transaction, NoOpSpan]
972972 """
973973 Start and return a transaction.
974974
@@ -991,7 +991,13 @@ def start_transaction(
991991 When the transaction is finished, it will be sent to Sentry with all its
992992 finished child spans.
993993
994- For supported `**kwargs` see :py:class:`sentry_sdk.tracing.Transaction`.
994+ :param transaction: The transaction to start. If omitted, we create and
995+ start a new transaction.
996+ :param instrumenter: This parameter is meant for internal use only.
997+ :param custom_sampling_context: The transaction's custom sampling context.
998+ :param kwargs: Optional keyword arguments to be passed to the Transaction
999+ constructor. See :py:class:`sentry_sdk.tracing.Transaction` for
1000+ available arguments.
9951001 """
9961002 kwargs .setdefault ("scope" , self )
9971003
@@ -1002,7 +1008,7 @@ def start_transaction(
10021008 if instrumenter != configuration_instrumenter :
10031009 return NoOpSpan ()
10041010
1005- custom_sampling_context = kwargs . pop ( " custom_sampling_context" , {})
1011+ custom_sampling_context = custom_sampling_context or {}
10061012
10071013 # kwargs at this point has type TransactionKwargs, since we have removed
10081014 # the client and custom_sampling_context from it.
0 commit comments