Skip to content

feat(transport): Introduce structs for transport options#1142

Open
szokeasaurusrex wants to merge 2 commits into
szokeasausurex/transport-movefrom
szokeasaurusrex/transport-options
Open

feat(transport): Introduce structs for transport options#1142
szokeasaurusrex wants to merge 2 commits into
szokeasausurex/transport-movefrom
szokeasaurusrex/transport-options

Conversation

@szokeasaurusrex

@szokeasaurusrex szokeasaurusrex commented Jun 9, 2026

Copy link
Copy Markdown
Member

This will allow us to add additional construction options, either to all transports or to individual transports, in the future without breaking the public API. This will be useful in #1004, as we will need to provide transports with a handle to record data losses.

For users who use a custom transport/transport factory, this change may produce a minor behavior breakage, as the &ClientOptions received by the create_transport method (or the closure, in the case of transport factories which are just closures) will no longer contain all of the options set when init-ing the SDK, only those options which are also present in TransportOptions. As the API remains fully compatible, however, we are not considering this to be a public API breakage, and will release these changes in a minor/patch release.

References #1004
References RUST-156
Fixes #1157
Fixes RUST-232

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch from 7872da8 to 131cae7 Compare June 9, 2026 13:40
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/move-batcher-under-client branch from ff22f25 to 33ff8e6 Compare June 9, 2026 14:37
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch from 131cae7 to 91aa345 Compare June 9, 2026 14:37
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/move-batcher-under-client branch from 33ff8e6 to 6d1cc97 Compare June 9, 2026 14:42
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch 3 times, most recently from 15eeea4 to ffbee4e Compare June 9, 2026 15:38
@szokeasaurusrex szokeasaurusrex changed the base branch from szokeasaurusrex/move-batcher-under-client to szokeasausurex/transport-move June 9, 2026 15:38
@szokeasaurusrex szokeasaurusrex changed the title ref(transport): Introduce structs for transport options feat(transport): Introduce structs for transport options Jun 9, 2026
@linear-code

linear-code Bot commented Jun 9, 2026

Copy link
Copy Markdown

RUST-156

RUST-232

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against f9b553c

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch from ffbee4e to ac9351c Compare June 9, 2026 16:02
Comment thread CHANGELOG.md
Comment on lines +43 to +45
/// ### Panics
///
/// Panics if called with `options` that lack a DSN.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This panic is not new. It was previously undocumented.

Comment thread sentry/src/transports/reqwest.rs
Comment thread sentry/src/transports/ureq.rs
@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review June 9, 2026 16:16
@szokeasaurusrex szokeasaurusrex requested a review from lcian as a code owner June 9, 2026 16:16
Comment thread sentry-core/src/transport/mod.rs
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch 2 times, most recently from 9e08f3a to f8521cc Compare June 10, 2026 09:31
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasausurex/transport-move branch 2 times, most recently from 93f2d23 to 1fca0c6 Compare June 10, 2026 13:52
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch 2 times, most recently from 193723f to 87946bc Compare June 12, 2026 10:08
This will allow us to add additional construction options, either to all transports or to individual transports, in the future without breaking the public API. This will be useful in #1004, as we will need to provide transports with a handle to record data losses.

For users who use a custom transport/transport factory, this change may produce a minor behavior breakage, as the `&ClientOptions` received by the `create_transport` method (or the closure, in the case of transport factories which are just closures) will no longer contain all of the options set when init-ing the SDK, only those options which are also present in `TransportOptions`. As the API remains fully compatible, however, we are not considering this to be a public API breakage, and will release these changes in a minor/patch release.

References [#1004](#1004)
References [RUST-156](https://linear.app/getsentry/issue/RUST-156/record-transport-drops-and-attach-client-report-envelopes)
Fixes [#1157](#1157)
Fixes [RUST-232](https://linear.app/getsentry/issue/RUST-232)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch from 87946bc to f0916b0 Compare June 12, 2026 12:37
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/transport-options branch from c4091ca to f9b553c Compare June 12, 2026 15:49
#[derive(Debug)]
#[must_use]
#[non_exhaustive]
pub struct TransportOptions {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there's a way to avoid the behavioral breakage by optionally storing the ClientOptions here if the transport was created via ClientOptions (or maybe not). Either way I think the breakage is really minimal, unlikely to affect any users.

@lcian lcian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants