Problem
The public custom transport API only allows implementing a generic envelope callback function through sentry_transport_new. Once an application replaces the built-in HTTP transport this way, it also bypasses the HTTP transport’s shared behavior, including:
- HTTP retry and exponential backoff configured with
sentry_options_set_http_retry
- Offline caching configured with
sentry_options_set_cache_keep
- Rate-limit handling
- Client report attachment and restoration
- The standard background worker, flushing, and shutdown behavior
This makes it difficult for downstream SDKs to use platform- or framework-native HTTP clients (.NET, Dart, Qt, ...) without reimplementing a substantial part of sentry-native’s HTTP transport logic.
Proposed solution
Expose a supported public API for creating a custom HTTP transports, in addition to the existing generic function transport API.
The new API should allow users to implement the HTTP "client" interface currently used internally by sentry_http_transport. The custom client would be responsible only for executing HTTP requests and returning HTTP responses (status code & headers).
The shared HTTP transport would remain responsible for:
- Preparing and serializing requests
- Queueing work and preserving envelope order
- HTTP retry and exponential backoff
- Offline caching and cache cleanup
- Rate-limit handling
- Client reports
- Flush and shutdown behavior
Conceptually, this would be a public, stable equivalent of the existing internal sentry__http_transport_new client interface and its lifecycle callbacks.
Notes
The API design should account for potential future multi-threading.
The HTTP transport currently runs on a single transport thread. With recently introduced support for large attachments, it may eventually be useful to be able to process requests using multiple transport threads, to avoid blocking the transport pipeline with a long-lasting large attachment upload.
In a multi-threaded transport model, each transport thread would need its own HTTP client instance. The public interface should therefore avoid assuming that one client instance is permanently shared by the entire transport. For example, it could expose a client factory with per-thread startup, shutdown, and cleanup callbacks.
Thread-safety, request ordering, and client ownership should be documented so that adding multiple transport threads later does not require a breaking API change.
Problem
The public custom transport API only allows implementing a generic envelope callback function through
sentry_transport_new. Once an application replaces the built-in HTTP transport this way, it also bypasses the HTTP transport’s shared behavior, including:sentry_options_set_http_retrysentry_options_set_cache_keepThis makes it difficult for downstream SDKs to use platform- or framework-native HTTP clients (.NET, Dart, Qt, ...) without reimplementing a substantial part of
sentry-native’s HTTP transport logic.Proposed solution
Expose a supported public API for creating a custom HTTP transports, in addition to the existing generic function transport API.
The new API should allow users to implement the HTTP "client" interface currently used internally by
sentry_http_transport. The custom client would be responsible only for executing HTTP requests and returning HTTP responses (status code & headers).The shared HTTP transport would remain responsible for:
Conceptually, this would be a public, stable equivalent of the existing internal
sentry__http_transport_newclient interface and its lifecycle callbacks.Notes
The API design should account for potential future multi-threading.
The HTTP transport currently runs on a single transport thread. With recently introduced support for large attachments, it may eventually be useful to be able to process requests using multiple transport threads, to avoid blocking the transport pipeline with a long-lasting large attachment upload.
In a multi-threaded transport model, each transport thread would need its own HTTP client instance. The public interface should therefore avoid assuming that one client instance is permanently shared by the entire transport. For example, it could expose a client factory with per-thread startup, shutdown, and cleanup callbacks.
Thread-safety, request ordering, and client ownership should be documented so that adding multiple transport threads later does not require a breaking API change.