Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9f24136
ref(transport): Add abstract base class for worker implementation
srothh Jul 14, 2025
001f36c
ref(transport): Add _create_worker factory method to Transport
srothh Jul 14, 2025
401b1bc
ref(worker): Add flush_async method to Worker ABC
srothh Jul 17, 2025
3f43d8f
ref(worker): Move worker flush_async from Worker ABC
srothh Jul 17, 2025
15fa295
ref(worker): Amend function signature for coroutines
srothh Jul 17, 2025
ef780f3
ref(worker): Add missing docstrings to worker ABC
srothh Jul 24, 2025
f63e46f
feat(transport): Add an async task-based worker for transport
srothh Jul 17, 2025
1804271
ref(worker): Make worker work with new ABC interface
srothh Jul 17, 2025
11da869
fix(worker): Check if callbacks from worker queue are coroutines or f…
srothh Jul 17, 2025
779a0d6
ref(worker): Amend return type of submit and flush to accomodate for …
srothh Jul 17, 2025
0895d23
ref(worker): Add type parameters for AsyncWorker variables
srothh Jul 17, 2025
bbf426b
ref(worker): Remove loop upon killing worker
srothh Jul 17, 2025
744dc8a
feat(worker): Enable concurrent callbacks on async task worker
srothh Jul 18, 2025
fcc8040
fix(worker): Modify kill behaviour to mirror threaded worker
srothh Jul 18, 2025
9a43d9b
ref(worker): add proper type annotation to worker task list
srothh Jul 21, 2025
b5eda0e
ref(worker): Refactor implementation to incorporate feedback
srothh Jul 30, 2025
9e380b8
ref(worker): fix queue initialization
srothh Jul 30, 2025
ee44621
ref(worker): Add queue as optional to allow for initialisation in start
srothh Jul 30, 2025
d9f7383
ref(worker): Change to sync flush method that launches task
srothh Jul 30, 2025
d2e647b
ref(worker): Readd coroutine check for worker callbacks
srothh Jul 30, 2025
859a0e2
ref(worker): Remove sync callbacks from worker processing for now
srothh Jul 31, 2025
a0cdb4d
Merge remote-tracking branch 'origin/srothh/transport-class-hierarchy…
sl0thentr0py Aug 12, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ref(transport): Add _create_worker factory method to Transport
Add a new factory method instead of direct instatiation of the threaded background worker. This allows for easy extension to other types of workers, such as the upcoming task-based async worker. GH-4578
  • Loading branch information
srothh committed Jul 28, 2025
commit 001f36cbf4cf4f8c40ee49e318f88911eaba7fbd
8 changes: 6 additions & 2 deletions sentry_sdk/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from sentry_sdk.consts import EndpointType
from sentry_sdk.utils import Dsn, logger, capture_internal_exceptions
from sentry_sdk.worker import BackgroundWorker
from sentry_sdk.worker import BackgroundWorker, Worker
from sentry_sdk.envelope import Envelope, Item, PayloadRef

from typing import TYPE_CHECKING
Expand Down Expand Up @@ -173,7 +173,7 @@ def __init__(self: Self, options: Dict[str, Any]) -> None:
Transport.__init__(self, options)
assert self.parsed_dsn is not None
self.options: Dict[str, Any] = options
self._worker = BackgroundWorker(queue_size=options["transport_queue_size"])
self._worker = self._create_worker(options)
self._auth = self.parsed_dsn.to_auth("sentry.python/%s" % VERSION)
self._disabled_until: Dict[Optional[str], datetime] = {}
# We only use this Retry() class for the `get_retry_after` method it exposes
Expand Down Expand Up @@ -224,6 +224,10 @@ def __init__(self: Self, options: Dict[str, Any]) -> None:
elif self._compression_algo == "br":
self._compression_level = 4

def _create_worker(self: Self, options: Dict[str, Any]) -> Worker:
# For now, we only support the threaded sync background worker.
return BackgroundWorker(queue_size=options["transport_queue_size"])

def record_lost_event(
self: Self,
reason: str,
Expand Down