@@ -335,7 +335,14 @@ def bind_client(
335
335
336
336
def capture_event (self , event , hint = None , scope = None , ** scope_args ):
337
337
# type: (Event, Optional[Hint], Optional[Scope], Any) -> Optional[str]
338
- """Captures an event. Alias of :py:meth:`sentry_sdk.Client.capture_event`."""
338
+ """
339
+ Captures an event.
340
+
341
+ Alias of :py:meth:`sentry_sdk.Client.capture_event`.
342
+
343
+ :param scope_args: For supported `**scope_args` see
344
+ :py:meth:`sentry_sdk.Scope.update_from_kwargs`.
345
+ """
339
346
client , top_scope = self ._stack [- 1 ]
340
347
scope = _update_scope (top_scope , scope , scope_args )
341
348
if client is not None :
@@ -348,8 +355,17 @@ def capture_event(self, event, hint=None, scope=None, **scope_args):
348
355
349
356
def capture_message (self , message , level = None , scope = None , ** scope_args ):
350
357
# type: (str, Optional[str], Optional[Scope], Any) -> Optional[str]
351
- """Captures a message. The message is just a string. If no level
352
- is provided the default level is `info`.
358
+ """
359
+ Captures a message.
360
+
361
+ :param message: The string to send as the message.
362
+
363
+ :param level: If no level is provided, the default level is `info`.
364
+
365
+ :param scope: An optional :py:class:`sentry_sdk.Scope` to use.
366
+
367
+ :param scope_args: For supported `**scope_args` see
368
+ :py:meth:`sentry_sdk.Scope.update_from_kwargs`.
353
369
354
370
:returns: An `event_id` if the SDK decided to send the event (see :py:meth:`sentry_sdk.Client.capture_event`).
355
371
"""
@@ -367,6 +383,9 @@ def capture_exception(self, error=None, scope=None, **scope_args):
367
383
368
384
:param error: An exception to catch. If `None`, `sys.exc_info()` will be used.
369
385
386
+ :param scope_args: For supported `**scope_args` see
387
+ :py:meth:`sentry_sdk.Scope.update_from_kwargs`.
388
+
370
389
:returns: An `event_id` if the SDK decided to send the event (see :py:meth:`sentry_sdk.Client.capture_event`).
371
390
"""
372
391
client = self .client
@@ -397,22 +416,48 @@ def _capture_internal_exception(
397
416
"""
398
417
logger .error ("Internal error in sentry_sdk" , exc_info = exc_info )
399
418
400
- def add_breadcrumb (self , crumb = None , hint = None , ** kwargs ):
401
- # type: (Optional[Breadcrumb], Optional[BreadcrumbHint], Any) -> None
419
+ def add_breadcrumb (
420
+ self ,
421
+ crumb = None , # type: Optional[Breadcrumb]
422
+ hint = None , # type: Optional[BreadcrumbHint]
423
+ timestamp = None , # type: Optional[datetime]
424
+ type = None , # type: Optional[str]
425
+ data = None , # type: Optional[Dict[str, Any]]
426
+ ** kwargs # type: Any
427
+ ):
428
+ # type: (...) -> None
402
429
"""
403
430
Adds a breadcrumb.
404
431
405
- :param crumb: Dictionary with the data as the sentry v7/v8 protocol expects.
432
+ :param crumb: Dictionary with the data as the Sentry v7/v8 protocol expects.
406
433
407
434
:param hint: An optional value that can be used by `before_breadcrumb`
408
435
to customize the breadcrumbs that are emitted.
436
+
437
+ :param timestamp: The timestamp associated with this breadcrumb. Defaults
438
+ to now if not provided.
439
+
440
+ :param type: The type of the breadcrumb. Will be set to "default" if
441
+ not provided.
442
+
443
+ :param data: Additional custom data to put on the breadcrumb.
444
+
445
+ :param kwargs: Adding any further keyword arguments will not result in
446
+ an error, but the breadcrumb will be dropped before arriving to
447
+ Sentry.
409
448
"""
410
449
client , scope = self ._stack [- 1 ]
411
450
if client is None :
412
451
logger .info ("Dropped breadcrumb because no client bound" )
413
452
return
414
453
415
454
crumb = dict (crumb or ()) # type: Breadcrumb
455
+ if timestamp is not None :
456
+ crumb ["timestamp" ] = timestamp
457
+ if type is not None :
458
+ crumb ["type" ] = type
459
+ if data is not None :
460
+ crumb ["data" ] = data
416
461
crumb .update (kwargs )
417
462
if not crumb :
418
463
return
@@ -441,15 +486,19 @@ def add_breadcrumb(self, crumb=None, hint=None, **kwargs):
441
486
def start_span (self , span = None , instrumenter = INSTRUMENTER .SENTRY , ** kwargs ):
442
487
# type: (Optional[Span], str, Any) -> Span
443
488
"""
444
- Create and start timing a new span whose parent is the currently active
445
- span or transaction, if any. The return value is a span instance,
489
+ Start a span whose parent is the currently active span or transaction, if any.
490
+
491
+ The return value is a :py:class:`sentry_sdk.tracing.Span` instance,
446
492
typically used as a context manager to start and stop timing in a `with`
447
493
block.
448
494
449
495
Only spans contained in a transaction are sent to Sentry. Most
450
496
integrations start a transaction at the appropriate time, for example
451
- for every incoming HTTP request. Use `start_transaction` to start a new
452
- transaction when one is not already in progress.
497
+ for every incoming HTTP request. Use
498
+ :py:meth:`sentry_sdk.start_transaction` to start a new transaction when
499
+ one is not already in progress.
500
+
501
+ For supported `**kwargs` see :py:class:`sentry_sdk.tracing.Span`.
453
502
"""
454
503
configuration_instrumenter = self .client and self .client .options ["instrumenter" ]
455
504
@@ -515,6 +564,8 @@ def start_transaction(
515
564
516
565
When the transaction is finished, it will be sent to Sentry with all its
517
566
finished child spans.
567
+
568
+ For supported `**kwargs` see :py:class:`sentry_sdk.tracing.Transaction`.
518
569
"""
519
570
configuration_instrumenter = self .client and self .client .options ["instrumenter" ]
520
571
0 commit comments