From 6f5c217c866d3453ab4027dd790aedd6f839a1ab Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Fri, 12 Jun 2020 12:27:53 +0200 Subject: [PATCH 1/2] meta: Draft a changelog and update docs/features * Updates the main documentation. * Renames the transport-related feature flags. * Drafts a changelog highlighting the breaking changes. --- CHANGELOG.md | 35 +++++++++ sentry-contexts/src/integration.rs | 4 +- sentry-contexts/src/lib.rs | 4 +- sentry-core/src/lib.rs | 1 - sentry-core/src/macros.rs | 23 +++--- sentry-types/CHANGELOG.md | 8 --- sentry-types/src/protocol/mod.rs | 5 +- sentry/Cargo.toml | 38 +++++----- sentry/src/lib.rs | 110 ++++++++++++----------------- sentry/src/transport.rs | 14 ++-- 10 files changed, 122 insertions(+), 120 deletions(-) delete mode 100644 sentry-types/CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d2122b00..27acd545c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,43 @@ # Changelog +## Unreleased + +**Highlights**: + +The `sentry` crate has been split up into a `sentry-core`, and many smaller per-integration crates. Application users should continue using the `sentry` crate, but library users and integration/transport authors are encouraged to use the `sentry-core` crate instead. + +Additionally, sentry can now be extended via `Integration`s. + +**Breaking Changes**: + +- The `utils` module has been removed, and most utils have been moved into integrations. +- The `integrations` module was completely rewritten. +- When constructing a `Client` using a `ClientOptions` struct manually, it does not have any default integrations, and it does not resolve default options from environment variables any more. Please use the explicit `apply_defaults` function instead. The `init` function will automatically call `apply_defaults`. +- The `init` function can’t be called with a `Client` anymore. + +**Features**: + +- Sentry can now capture `std::error::Error` types, using the `capture_error` and `Hub::capture_error` functions, and an additional `event_from_error` utility function. +- Sentry now has built-in support to bind a `Hub` to a `Future`. +- Sentry can now be extended with `Integration`s. +- The `ClientInitGuard`, `Future` and `ScopeGuard` structs and `apply_defaults`, `capture_error`, `event_from_error`, `with_integration` and `parse_type_from_debug` functions have been added to the root exports. +- The `FutureExt`, `Integration`, `IntoBreadcrumbs`, `IntoDsn`, `Transport` and `TransportFactory` traits are now exported. +- The `types` module now re-exports `sentry-types`. + +**Deprecations**: + +- The `internals` module is deprecated. Please `use` items from the crate root or the `types` module instead. +- All the feature flags have been renamed, the old names are still available but + +## 0.18.1 + +- Fix potential segfault with `with_debug_meta` (#211). +- Fix panic when running inside of tokio (#186). + ## 0.18.0 - Upgrade most dependencies to their current versions (#183): + - `env_logger 0.7` - `reqwest 0.10` - `error-chain 0.12` diff --git a/sentry-contexts/src/integration.rs b/sentry-contexts/src/integration.rs index dd113c403..cbf812f06 100644 --- a/sentry-contexts/src/integration.rs +++ b/sentry-contexts/src/integration.rs @@ -8,7 +8,9 @@ use crate::utils::{device_context, os_context, rust_context, server_name}; /// Adds Contexts to Sentry Events. /// -/// See https://develop.sentry.dev/sdk/event-payloads/contexts/ +/// See the [Contexts Interface] documentation for more info. +/// +/// [Contexts Interface]: https://develop.sentry.dev/sdk/event-payloads/contexts/ pub struct ContextIntegration { /// Add `os` context, enabled by default. pub add_os: bool, diff --git a/sentry-contexts/src/lib.rs b/sentry-contexts/src/lib.rs index 439e51eb1..ddbe29c24 100644 --- a/sentry-contexts/src/lib.rs +++ b/sentry-contexts/src/lib.rs @@ -4,7 +4,7 @@ //! and `rust` contexts to Events, as well as sets a `server_name` if not //! already defined. //! -//! See https://develop.sentry.dev/sdk/event-payloads/contexts/ +//! See the [Contexts Interface] documentation for more info. //! //! # Examples //! @@ -15,6 +15,8 @@ //! }; //! let _sentry = sentry::init(sentry::ClientOptions::default().add_integration(integration)); //! ``` +//! +//! [Contexts Interface]: https://develop.sentry.dev/sdk/event-payloads/contexts/ #![deny(missing_docs)] diff --git a/sentry-core/src/lib.rs b/sentry-core/src/lib.rs index 206fc926a..8f3843924 100644 --- a/sentry-core/src/lib.rs +++ b/sentry-core/src/lib.rs @@ -20,7 +20,6 @@ //! the concepts of [`Client`], [`Hub`] and [`Scope`], as well as the extension //! points via the [`Integration`], [`Transport`] and [`TransportFactory`] traits. //! -//! //! # Minimal API //! //! By default, this crate comes with a so-called "minimal" mode. This mode will diff --git a/sentry-core/src/macros.rs b/sentry-core/src/macros.rs index 00d449391..3b98dfb5c 100644 --- a/sentry-core/src/macros.rs +++ b/sentry-core/src/macros.rs @@ -55,21 +55,16 @@ macro_rules! with_client_impl { #[doc(hidden)] macro_rules! sentry_debug { ($($arg:tt)*) => { - #[cfg(feature = "client")] { - #[cfg(feature = "debug-logs")] { - ::log_::debug!(target: "sentry", $($arg)*); - } - #[cfg(not(feature = "debug-logs"))] { - $crate::Hub::with(|hub| { - if hub.client().map_or(false, |c| c.options().debug) { - eprint!("[sentry] "); - eprintln!($($arg)*); - } - }); - } + #[cfg(feature = "debug-logs")] { + ::log_::debug!(target: "sentry", $($arg)*); } - #[cfg(not(feature = "client"))] { - let _ = ($($arg)*); + #[cfg(not(feature = "debug-logs"))] { + $crate::Hub::with(|hub| { + if hub.client().map_or(false, |c| c.options().debug) { + eprint!("[sentry] "); + eprintln!($($arg)*); + } + }); } } } diff --git a/sentry-types/CHANGELOG.md b/sentry-types/CHANGELOG.md deleted file mode 100644 index d0c2d209c..000000000 --- a/sentry-types/CHANGELOG.md +++ /dev/null @@ -1,8 +0,0 @@ -# Changelog - -## 0.15.0 - -- **breaking**: Remove usage of `failure`. - `ParseAuthError`, `ParseDsnError`, `ParseProjectIdError`, and - `ParseLevelError` now implement `std::error::Error`. -- **breaking**: Remove deprecated `with_serde` feature. diff --git a/sentry-types/src/protocol/mod.rs b/sentry-types/src/protocol/mod.rs index 3c182ddbd..6f7bf9707 100644 --- a/sentry-types/src/protocol/mod.rs +++ b/sentry-types/src/protocol/mod.rs @@ -6,8 +6,5 @@ pub mod v7; /// The latest version of the protocol. pub const LATEST: u16 = 7; -/// The always latest sentry protocol version. #[cfg(feature = "protocol")] -pub mod latest { - pub use super::v7::*; -} +pub use v7 as latest; diff --git a/sentry/Cargo.toml b/sentry/Cargo.toml index f421a5253..3f8ba15fd 100644 --- a/sentry/Cargo.toml +++ b/sentry/Cargo.toml @@ -16,11 +16,7 @@ autoexamples = true all-features = true [features] -default = ["client", "backtrace", "contexts", "failure", "panic", "transport"] - -# we still need a "client" feature, here, because `sentry_debug!` tests for that -client = [] -debug-logs = ["log_", "sentry-core/debug-logs"] +default = ["backtrace", "contexts", "failure", "panic", "transport"] # default integrations backtrace = ["sentry-backtrace"] @@ -33,14 +29,20 @@ debug-images = ["sentry-debug-images"] error-chain = ["sentry-error-chain"] log = ["sentry-log"] slog = ["sentry-slog"] - # other features test = ["sentry-core/test"] -transport = ["with_default_transport"] +debug-logs = ["log_", "sentry-core/debug-logs"] +# transports +transport = ["reqwest", "native-tls"] +reqwest = ["reqwest_", "httpdate"] +curl = ["curl_", "httpdate", "serde_json"] +surf = ["surf_", "httpdate", "http-client", "futures"] +native-tls = ["reqwest_/default-tls"] +rustls = ["reqwest_/rustls-tls"] # deprecated feature flags, here for backwards compatibility, will be removed # at some point -with_client_implementation = ["client"] +with_client_implementation = [] with_backtrace = ["backtrace"] with_failure = ["failure"] with_panic = ["panic"] @@ -50,14 +52,12 @@ with_test_support = ["test"] with_debug_meta = ["debug-images"] with_device_info = ["contexts"] with_rust_info = ["contexts"] - -# transport related features, should be cleaned up further in the future -with_default_transport = ["with_reqwest_transport", "with_native_tls"] -with_reqwest_transport = ["reqwest", "httpdate", "with_client_implementation"] -with_curl_transport = ["curl", "httpdate", "serde_json", "with_client_implementation"] -with_surf_transport = ["surf", "httpdate", "http-client", "futures", "with_client_implementation"] -with_rustls = ["reqwest/rustls-tls"] -with_native_tls = ["reqwest/default-tls"] +with_default_transport = ["transport"] +with_reqwest_transport = ["reqwest"] +with_curl_transport = ["curl"] +with_surf_transport = ["surf"] +with_native_tls = ["native-tls"] +with_rustls = ["rustls"] [dependencies] sentry-core = { version = "0.18.0", path = "../sentry-core", features = ["client"] } @@ -71,9 +71,9 @@ sentry-log = { version = "0.18.0", path = "../sentry-log", optional = true } sentry-panic = { version = "0.18.0", path = "../sentry-panic", optional = true } sentry-slog = { version = "0.18.0", path = "../sentry-slog", optional = true } log_ = { package = "log", version = "0.4.8", optional = true, features = ["std"] } -reqwest = { version = "0.10.1", optional = true, features = ["blocking", "json"], default-features = false } -curl = { version = "0.4.25", optional = true } -surf = { version = "=2.0.0-alpha.3", optional = true } +reqwest_ = { package = "reqwest", version = "0.10.1", optional = true, features = ["blocking", "json"], default-features = false } +curl_ = { package = "curl", version = "0.4.25", optional = true } +surf_ = { package = "surf", version = "=2.0.0-alpha.4", optional = true } http-client = { version = "3.0", optional = true } futures = { version = "0.3", optional = true } httpdate = { version = "0.3.2", optional = true } diff --git a/sentry/src/lib.rs b/sentry/src/lib.rs index c3b9ef7f1..8001c378e 100644 --- a/sentry/src/lib.rs +++ b/sentry/src/lib.rs @@ -10,13 +10,11 @@ //! //! # Quickstart //! -//! To use the crate you need to create a client first. When a client is created it's typically -//! bound to the current thread by calling `bind_client`. By default this happens by using the -//! `sentry::init` convenience function. When the client is bound to the main thread it also -//! becomes the default client for future threads created but it is always possible to override the -//! client for a thread later by explicitly binding it. +//! The most convenient way to use this library is the [`sentry::init`] function, +//! which starts a sentry client with a default set of integrations, and binds +//! it to the current [`Hub`]. //! -//! The `sentry::init` function returns a guard that when dropped will flush Events that were not +//! The [`sentry::init`] function returns a guard that when dropped will flush Events that were not //! yet sent to the sentry service. It has a two second deadline for this so shutdown of //! applications might slightly delay as a result of this. Keep the guard around or sending events //! will not work. @@ -28,48 +26,25 @@ //! // seconds to send remaining events to the service. //! ``` //! +//! [`sentry::init`]: fn.init.html +//! [`Hub`]: struct.Hub.html +//! //! # Integrations //! //! What makes this crate useful are the various integrations that exist. Some of them are enabled //! by default, some uncommon ones or for deprecated parts of the ecosystem a feature flag needs to //! be enabled. For the available integrations and how to use them see -//! [integrations](integrations/index.html). -//! -//! # Scopes, Threads and Hubs -//! -//! Data is typically bound to a [`Scope`](struct.Scope.html). Scopes are stored in a hidden stack -//! on a [`Hub`](struct.Hub.html). Once the library has been initialized a hub is automatically -//! available. In the default config a new hub is created for each thread and they act -//! independently. -//! -//! The thread that calls `sentry::init` initializes the first hub which then automatically becomes -//! the base of new hubs (You can get that hub by calling `Hub::main()`). If a new thread is -//! spawned it gets a new hub based on that one (the thread calls `Hub::new_from_top(Hub::main())`). -//! The current thread's hub is returned from `Hub::current()`. Any hub that is wrapped in an `Arc` -//! can be temporarily bound to a thread with `Hub::run`. For more information see -//! [`Hub`](struct.Hub.html). -//! -//! Users are expected to reconfigure the scope with [`configure_scope`](fn.configure_scope.html). -//! For more elaborate scope management the hub needs to be interfaced with directly. -//! -//! In some situations (particularly in async code) it's often not possible to use the thread local -//! hub. In that case a hub can be explicitly created and passed around. However due to the nature -//! of some integrations some functionality like automatic breadcrumb recording depends on the -//! thread local hub being correctly configured. +//! [integrations](integrations/index.html) and [apply_defaults](fn.apply_defaults.html). //! //! # Minimal API //! -//! This crate can also be used in "minimal" mode. This is enabled by disabling all default -//! features of the crate. In that mode a minimal API set is retained that can be used to -//! instrument code for Sentry without actually using Sentry. The minimal API is a small set of -//! APIs that dispatch to the underlying implementations on the configured Sentry client. If the -//! client is not there the minimal API will blackhole a lot of operations. -//! -//! Only if a user then also uses and configures Sentry this code becomes used. +//! This crate comes fully featured. If the goal is to instrument libraries for usage +//! with sentry, or to extend sentry with a custom [`Integration`] or a [`Transport`], +//! one should use the [`sentry-core`] crate instead. //! -//! In minimal mode some types are restricted in functionality. For instance the `Client` is not -//! available and the `Hub` does not retain all API functionality. To see what the APIs in mnimal -//! mode look like you can build the docs for this crate without any features enabled. +//! [`Integration`]: trait.Integration.html +//! [`Transport`]: trait.Transport.html +//! [`sentry-core`]: https://crates.io/crates/sentry-core //! //! # Features //! @@ -78,27 +53,27 @@ //! //! Default features: //! -//! * `with_default_transport`: Compiles in the default HTTP transport (see below). -//! * `with_backtrace`: Enables backtrace support (automatically turned on in a few cases). -//! * `with_panic`: Enables the panic integration. -//! * `with_failure`: Enables the `failure` integration. -//! -//! Additional integrations: -//! -//! * `with_debug_to_log`: When enabled sentry will debug log to a debug log at all times. -//! -//! Additional transports: -//! * `with_reqwest_transport`: Enables the reqwest transport explicitly. This is currently the -//! default transport. -//! * `with_curl_transport`: Enables the curl transport. -//! * `with_surf_transport`: Enables the surf transport. -//! * `with_rustls`: Enables the `rustls` TLS implementation. This is currently the default when -//! using the `with_reqwest_transport` feature. -//! * `with_native_tls`: Enables the `default-tls` feature of the `reqwest` library. -//! -//! Testing: -//! -//! * `with_test_support`: Enables the test support module. +//! * `backtrace`: Enables backtrace support. +//! * `contexts`: Enables capturing device, os, and rust contexts. +//! * `failure`: Enables support for the `failure` crate. +//! * `panic`: Enables support for capturing panics. +//! * `transport`: Enables the default transport, which is currently `reqwest` with `native-tls`. +//! +//! Additional features: +//! +//! * `anyhow`: Enables support for the `anyhow` crate. +//! * `debug-images`: Attaches a list of loaded libraries to events (currently only supported on unix). +//! * `error-chain`: Enables support for the `error-chain` crate. +//! * `log`: Enables support for the `log` crate. +//! * `slog`: Enables support for the `slog` crate. +//! * `test`: Enables testing support. +//! * `debug-logs`: Uses the `log` crate for internal logging. +//! * `reqwest`: Enables the `reqwest` transport, which is currently the default. +//! * `curl`: Enables the curl transport. +//! * `surf`: Enables the surf transport. +//! * `native-tls`: Uses the `native-tls` crate, which is currently the default. +//! This only has an effect on the `reqwest` transport. +//! * `rustls`: Enables the `rustls` support of the `reqwest` transport. #![warn(missing_docs)] @@ -116,10 +91,10 @@ pub use crate::init::{init, ClientInitGuard}; /// Available Sentry Integrations. /// -/// See the [`defaults`] function for more information on which integrations are +/// See the [`apply_defaults`] function for more information on which integrations are /// used by default. /// -/// [`defaults`]: fn.defaults.html +/// [`apply_defaults`]: ../fn.apply_defaults.html pub mod integrations { #[cfg(feature = "anyhow")] #[doc(inline)] @@ -157,16 +132,19 @@ pub mod integrations { /// from methods on other types. #[deprecated = "These exports have been moved to the root or the `types` mod."] pub mod internals { - pub use crate::defaults::apply_defaults; - pub use crate::init::ClientInitGuard; + pub use crate::{ + apply_defaults, ClientInitGuard, IntoBreadcrumbs, IntoDsn, Transport, TransportFactory, + }; pub use sentry_core::types::*; } +#[doc(inline)] +pub use sentry_core::types::protocol::latest as protocol; + /// The provided transports. /// /// This module exposes all transports that are compiled into the sentry -/// library. The `with_reqwest_transport`, `with_curl_transport` and `with_surf_transport` flags -/// turn on these transports. +/// library. The `reqwest`, `curl` and `surf` features turn on these transports. pub mod transports { pub use crate::transport::DefaultTransportFactory; diff --git a/sentry/src/transport.rs b/sentry/src/transport.rs index d90073b9c..e81b7283d 100644 --- a/sentry/src/transport.rs +++ b/sentry/src/transport.rs @@ -13,20 +13,22 @@ use std::time::{Duration, SystemTime}; ))] use httpdate::parse_http_date; +#[cfg(feature = "with_reqwest_transport")] +use reqwest_::{blocking::Client as ReqwestClient, header::RETRY_AFTER, Proxy}; + #[cfg(feature = "with_curl_transport")] -use std::io::Cursor; +use crate::types::Scheme; #[cfg(feature = "with_curl_transport")] -use {crate::types::Scheme, curl, std::io::Read}; - -#[cfg(feature = "with_reqwest_transport")] -use reqwest::{blocking::Client as ReqwestClient, header::RETRY_AFTER, Proxy}; +use curl_ as curl; +#[cfg(feature = "with_curl_transport")] +use std::io::{Cursor, Read}; #[cfg(feature = "with_surf_transport")] use futures::executor; #[cfg(feature = "with_surf_transport")] use http_client::native::NativeClient; #[cfg(feature = "with_surf_transport")] -use surf::Client as SurfClient; +use surf_::Client as SurfClient; use sentry_core::sentry_debug; From b69ca57b4f602be5229879c44e642ae30b068729 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Fri, 12 Jun 2020 14:05:42 +0200 Subject: [PATCH 2/2] fix conditional compiles related to transport features --- Makefile | 12 +++---- sentry-actix/Cargo.toml | 5 ++- sentry/src/lib.rs | 12 +++---- sentry/src/transport.rs | 72 +++++++++++++---------------------------- 4 files changed, 34 insertions(+), 67 deletions(-) diff --git a/Makefile b/Makefile index 4fa09bb8c..55720d3be 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ test: checkall testall testfast: @echo 'TESTSUITE' - cd sentry && cargo test --features=with_test_support + cd sentry && cargo test --features=test .PHONY: testfast testall: @@ -73,24 +73,24 @@ check-no-default-features: check-failure: @echo 'NO CLIENT + FAILURE' - @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'with_failure' + @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'failure' .PHONY: check-failure check-panic: @echo 'NO CLIENT + PANIC' - @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'with_panic' + @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'panic' .PHONY: check-panic check-all-impls: @echo 'NO CLIENT + ALL IMPLS' - @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'with_failure,with_panic' + @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'failure,panic' .PHONY: check-all-impls check-curl-transport: @echo 'CURL TRANSPORT' - @cd sentry && RUSTFLAGS=-Dwarnings cargo check --features with_curl_transport + @cd sentry && RUSTFLAGS=-Dwarnings cargo check --features curl @echo 'CURL TRANSPORT ONLY' - @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'with_curl_transport,with_panic' + @cd sentry && RUSTFLAGS=-Dwarnings cargo check --no-default-features --features 'curl,panic' .PHONY: check-curl-transport check-actix: diff --git a/sentry-actix/Cargo.toml b/sentry-actix/Cargo.toml index 569f74bdb..1463160c5 100644 --- a/sentry-actix/Cargo.toml +++ b/sentry-actix/Cargo.toml @@ -17,9 +17,8 @@ all-features = true [features] default = ["with_sentry_default"] with_sentry_default = [ - "sentry/with_default_transport", - "sentry/with_panic", - "sentry/with_native_tls" + "sentry/transport", + "sentry/panic", ] [dependencies] diff --git a/sentry/src/lib.rs b/sentry/src/lib.rs index 8001c378e..9d6163a14 100644 --- a/sentry/src/lib.rs +++ b/sentry/src/lib.rs @@ -148,19 +148,15 @@ pub use sentry_core::types::protocol::latest as protocol; pub mod transports { pub use crate::transport::DefaultTransportFactory; - #[cfg(feature = "with_reqwest_transport")] + #[cfg(feature = "reqwest")] pub use crate::transport::ReqwestHttpTransport; - #[cfg(feature = "with_curl_transport")] + #[cfg(feature = "curl")] pub use crate::transport::CurlHttpTransport; - #[cfg(feature = "with_surf_transport")] + #[cfg(feature = "surf")] pub use crate::transport::SurfHttpTransport; - #[cfg(any( - feature = "with_reqwest_transport", - feature = "with_curl_transport", - feature = "with_surf_transport" - ))] + #[cfg(any(feature = "reqwest", feature = "curl", feature = "surf"))] pub use crate::transport::HttpTransport; } diff --git a/sentry/src/transport.rs b/sentry/src/transport.rs index e81b7283d..17fa57cce 100644 --- a/sentry/src/transport.rs +++ b/sentry/src/transport.rs @@ -6,28 +6,24 @@ use std::sync::{Arc, Condvar, Mutex}; use std::thread::{self, JoinHandle}; use std::time::{Duration, SystemTime}; -#[cfg(any( - feature = "with_reqwest_transport", - feature = "with_curl_transport", - feature = "with_surf_transport" -))] +#[cfg(any(feature = "reqwest", feature = "curl", feature = "surf"))] use httpdate::parse_http_date; -#[cfg(feature = "with_reqwest_transport")] +#[cfg(feature = "reqwest")] use reqwest_::{blocking::Client as ReqwestClient, header::RETRY_AFTER, Proxy}; -#[cfg(feature = "with_curl_transport")] +#[cfg(feature = "curl")] use crate::types::Scheme; -#[cfg(feature = "with_curl_transport")] +#[cfg(feature = "curl")] use curl_ as curl; -#[cfg(feature = "with_curl_transport")] +#[cfg(feature = "curl")] use std::io::{Cursor, Read}; -#[cfg(feature = "with_surf_transport")] +#[cfg(feature = "surf")] use futures::executor; -#[cfg(feature = "with_surf_transport")] +#[cfg(feature = "surf")] use http_client::native::NativeClient; -#[cfg(feature = "with_surf_transport")] +#[cfg(feature = "surf")] use surf_::Client as SurfClient; use sentry_core::sentry_debug; @@ -45,19 +41,11 @@ pub struct DefaultTransportFactory; impl TransportFactory for DefaultTransportFactory { fn create_transport(&self, options: &ClientOptions) -> Arc { - #[cfg(any( - feature = "with_reqwest_transport", - feature = "with_curl_transport", - feature = "with_surf_transport" - ))] + #[cfg(any(feature = "reqwest", feature = "curl", feature = "surf"))] { Arc::new(HttpTransport::new(options)) } - #[cfg(not(any( - feature = "with_reqwest_transport", - feature = "with_curl_transport", - feature = "with_surf_transport" - )))] + #[cfg(not(any(feature = "reqwest", feature = "curl", feature = "surf")))] { let _ = options; panic!("sentry crate was compiled without transport") @@ -65,11 +53,7 @@ impl TransportFactory for DefaultTransportFactory { } } -#[cfg(any( - feature = "with_reqwest_transport", - feature = "with_curl_transport", - feature = "with_surf_transport" -))] +#[cfg(any(feature = "reqwest", feature = "curl", feature = "surf"))] fn parse_retry_after(s: &str) -> Option { if let Ok(value) = s.parse::() { Some(SystemTime::now() + Duration::from_secs(value.ceil() as u64)) @@ -175,13 +159,13 @@ macro_rules! implement_http_transport { } } -#[cfg(feature = "with_reqwest_transport")] +#[cfg(feature = "reqwest")] implement_http_transport! { /// A transport can send events via HTTP to sentry via `reqwest`. /// - /// When the `with_default_transport` feature is enabled this will currently + /// When the `transport` feature is enabled this will currently /// be the default transport. This is separately enabled by the - /// `with_reqwest_transport` flag. + /// `reqwest` flag. pub struct ReqwestHttpTransport; fn spawn( @@ -278,11 +262,11 @@ implement_http_transport! { } } -#[cfg(feature = "with_curl_transport")] +#[cfg(feature = "curl")] implement_http_transport! { /// A transport can send events via HTTP to sentry via `curl`. /// - /// This is enabled by the `with_curl_transport` flag. + /// This is enabled by the `curl` flag. pub struct CurlHttpTransport; fn spawn( @@ -408,11 +392,11 @@ implement_http_transport! { } } -#[cfg(feature = "with_surf_transport")] +#[cfg(feature = "surf")] implement_http_transport! { /// A transport can send events via HTTP to sentry via `surf`. /// - /// This is enabled by the `with_surf_transport` flag. + /// This is enabled by the `surf` flag. pub struct SurfHttpTransport; fn spawn( @@ -511,27 +495,15 @@ implement_http_transport! { } } -#[cfg(feature = "with_reqwest_transport")] +#[cfg(feature = "reqwest")] type DefaultTransport = ReqwestHttpTransport; -#[cfg(all( - feature = "with_curl_transport", - not(feature = "with_reqwest_transport"), - not(feature = "with_surf_transport") -))] +#[cfg(all(feature = "curl", not(feature = "reqwest"), not(feature = "surf")))] type DefaultTransport = CurlHttpTransport; -#[cfg(all( - feature = "with_surf_transport", - not(feature = "with_reqwest_transport"), - not(feature = "with_curl_transport") -))] +#[cfg(all(feature = "surf", not(feature = "reqwest"), not(feature = "curl")))] type DefaultTransport = SurfHttpTransport; /// The default http transport. -#[cfg(any( - feature = "with_reqwest_transport", - feature = "with_curl_transport", - feature = "with_surf_transport" -))] +#[cfg(any(feature = "reqwest", feature = "curl", feature = "surf"))] pub type HttpTransport = DefaultTransport;