Releases: getsentry/sentry-rust
Releases · getsentry/sentry-rust
0.48.0
Breaking Changes
- Added the following metrics-related fields to the
ClientOptionsstruct insentry-core. Both fields are no-ops, unless themetricsfeature flag is enabled:enable_metrics, used to enable sending metrics to Sentry (#1073).before_send_metric, used to define a callback for filtering/pre-processing metrics before sending to Sentry (#1064).
- There are several breakages related to the SemVer feature additivity bug fixes:
sentry_core::ClientOptionsfieldsbefore_send_log,enable_logs,auto_session_tracking, andsession_modeare no longer gated behind thelogsandrelease-healthfeature flags (#1091). Code that constructsClientOptionswith a full struct literal (without..Default::default()), or which exhaustively matches against it, must now include all four fields regardless of enabled features.sentry_core::Scopecan no longer be publicly constructed or exhaustively matched against, even when theclientfeature is disabled (#1094). Previously, both of these were possible whenclientwas disabled.sentry_core::Scope::add_event_processornow requires passed closures to beRefUnwindSafe(#1093). Thanks to this change,sentry_core::Scopeis nowUnwindSaferegardless of feature flag configuration; previously,Scopewas onlyUnwindSafewhen theclientfeature was disabled.sentry_tracing::EventMappingis now#[non_exhaustive](#1097).sentry_log::RecordMappingis now#[non_exhaustive](#1098).
New Features
📊📈💯 The Sentry-Rust SDK now supports emitting Sentry Metrics (#1073)!
To get started, you will need to add the metrics feature flag when compiling the sentry crate. You will also need to enable metrics when initializing the SDK, like so:
use sentry::ClientOptions;
let _guard = sentry::init((
"(your DSN here)",
ClientOptions {
enable_metrics: true,
// ... other options ...
..Default::default()
},
));You can then capture metrics as follows:
use sentry::metrics;
use sentry::types::protocol::latest::Unit;
// We support counter, gauge, and distribution metrics.
metrics::counter("example.counter", 1).capture();
metrics::gauge("connections", 20).capture();
metrics::distribution("response.time", 123.4)
.unit(Unit::Millisecond) // units can also be set on gauges
.attribute("http.status", 200) // attributes can be set on all metric types
.capture();Fixes
- Fixed several feature additivity SemVer violations, where enabling a feature flag could have introduced breaking changes. All known violations are fixed now, so simply enabling an additional feature flag in any Sentry SDK crate should no longer cause any public API breakages. Fixing these issues required us to break the public API in some places; those breakages are detailed above.
0.47.0
Breaking Changes
- Update reqwest from 0.12.25 to 0.13.1 (#998). This change is breaking for users who use the
RequestHttpTransport::with_clientmethod. sentry_core::HubSwitchGuardis now!Send, preventing it from being moved across threads (#957).
New Features
- Added a
Envelope::into_itemsmethod, which returns an iterator over ownedEnvelopeItems in theEnvelope(#983). - Expose transport utilities (#949)
Fixes
0.46.2
0.46.1
0.46.0
Breaking changes
- Removed the
ClientOptionsstruct'strim_backtracesandextra_border_framesfields (#925).- These fields configured backtrace trimming, which is being removed in this release.
Improvements
- Removed backtrace trimming to align the Rust SDK with the general principle that Sentry SDKs should only truncate telemetry data when needed to comply with documented size limits (#925). This change ensures that as much data as possible remains available for debugging.
- If you notice any new issues being created for existing errors after this change, please open an issue on GitHub.
Fixes
0.45.0
0.44.0
Breaking changes
- feat(log): support combined LogFilters and RecordMappings (#914) by @lcian
- Breaking change:
sentry::integrations::log::LogFilterhas been changed to abitflagsstruct. - It's now possible to map a
logrecord to multiple items in Sentry by combining multiple log filters in the filter, e.g.log::Level::ERROR => LogFilter::Event | LogFilter::Log. - If using a custom
mapperinstead, it's possible to return aVec<sentry::integrations::log::RecordMapping>to map alogrecord to multiple items in Sentry.
- Breaking change:
Behavioral changes
- ref(log): send logs by default when logs feature flag is enabled (#915) by @lcian
- If the
logsfeature flag is enabled, the default Sentryloglogger now sends logs for all events at or above INFO.
- If the
- ref(logs): enable logs by default if logs feature flag is used (#910) by @lcian
- This changes the default value of
sentry::ClientOptions::enable_logstotrue. - This simplifies the setup of Sentry structured logs by requiring users to just add the
logfeature flag to thesentrydependency to opt-in to sending logs. - When the
logfeature flag is enabled, thetracingandlogintegrations will send structured logs to Sentry for all logs/events at or above INFO level by default.
- This changes the default value of
0.43.0
Breaking changes
- ref(tracing): rework tracing to Sentry span name/op conversion (#887) by @lcian
- The
tracingintegration now uses the tracing span name as the Sentry span name by default. - Before this change, the span name would be set based on the
tracingspan target (<module>::<function>when using thetracing::instrumentmacro). - The
tracingintegration now uses<span target>::<span name>as the default Sentry span op (i.e.<module>::<function>when usingtracing::instrument). - Before this change, the span op would be set based on the
tracingspan name. - Read below to learn how to customize the span name and op.
- When upgrading, please ensure to adapt any queries, metrics or dashboards to use the new span names/ops.
- The
- ref(tracing): use standard code attributes (#899) by @lcian
- Logs now carry the attributes
code.module.name,code.file.pathandcode.line.numberstandardized in OTEL to surface the respective information, in contrast with the previously senttracing.module_path,tracing.fileandtracing.line.
- Logs now carry the attributes
- fix(actix): capture only server errors (#877) by @lcian
- The Actix integration now properly honors the
capture_server_errorsoption (enabled by default), capturing errors returned by middleware only if they are server errors (HTTP status code 5xx). - Previously, if a middleware were to process the request after the Sentry middleware and return an error, our middleware would always capture it and send it to Sentry, regardless if it was a client, server or some other kind of error.
- With this change, we capture errors returned by middleware only if those errors can be classified as server errors.
- There is no change in behavior when it comes to errors returned by services, in which case the Sentry middleware only captures server errors exclusively.
- The Actix integration now properly honors the
- fix: send trace origin correctly (#906) by @lcian
TraceContextnow has an additional fieldorigin, used to report which integration created a transaction.
Behavioral changes
- feat(tracing): send both breadcrumbs and logs by default (#878) by @lcian
- If the
logsfeature flag is enabled, andenable_logs: trueis set on your client options, the default Sentrytracinglayer now sends logs for all events at or above INFO.
- If the
Features
-
ref(tracing): rework tracing to Sentry span name/op conversion (#887) by @lcian
- Additional special fields have been added that allow overriding certain data on the Sentry span:
sentry.op: override the Sentry span op.sentry.name: override the Sentry span name.sentry.trace: given a string matching a validsentry-traceheader (sent automatically by client SDKs), continues the distributed trace instead of starting a new one. If the value is not a validsentry-traceheader or a trace is already started, this value is ignored.
sentry.opandsentry.namecan also be applied retroactively by declaring fields with valuetracing::field::Emptyand then recorded usingtracing::Span::record.- Example usage:
#[tracing::instrument(skip_all, fields( sentry.op = "http.server", sentry.name = "GET /payments", sentry.trace = headers.get("sentry-trace").unwrap_or(&"".to_owned()), ))] async fn handle_request(headers: std::collections::HashMap<String, String>) { // ... }
- Additional attributes are sent along with each span by default:
sentry.tracing.target: corresponds to thetracingspan'smetadata.target()code.module.name,code.file.path,code.line.number
- Additional special fields have been added that allow overriding certain data on the Sentry span:
-
feat(core): add Response context (#874) by @lcian
- The
Responsecontext can now be attached to events, to include information about HTTP responses such as headers, cookies and status code. - Example:
let mut event = Event::new(); let response = ResponseContext { cookies: Some(r#""csrftoken": "1234567""#.to_owned()), headers: Some(headers_map), status_code: Some(500), body_size: Some(15), data: Some("Invalid request"), }; event .contexts .insert("response".to_owned(), response.into());
- The
Fixes
- build(panic): Fix build without other dependencies (#883) by @liskin
- The
sentry-paniccrate now builds successfully when used as a standalone dependency.
- The
- fix(transport): add rate limits for logs (#894) by @giortzisg
0.42.0
Features
- feat(log): support kv feature of log (#851) by @lcian
- Attributes added to a
logrecord using thekvfeature are now recorded as attributes on the log sent to Sentry.
- Attributes added to a
- feat(types): add all the missing supported envelope headers (#867) by @lcian
- feat(types): add setters for envelope headers (#868) by @lcian
- It's now possible to set all of the envelope headers supported by the protocol when constructing envelopes.
- feat(core): add some DSC fields to transaction envelope headers (#869) by @lcian
- The SDK now sends additional envelope headers with transactions. This should solve some extrapolation issues for span metrics.
Behavioral changes
- feat: filter username and password in URLs (#864) by @lcian
- Usernames and passwords that could be contained in URLs captured when using the Actix Web or axum integration are now always filtered out.
- If the
Requestis created manually by the user, then these fields are not filtered out. - This information was already filtered by Relay, but should also be filtered by the SDK itself as a first line of defense.
Fixes
- docs: match description of
debugoption with behavior since PR #820 (#860) by @AlexTMjugador
0.41.0
Breaking changes
- feat(tracing): support combined EventFilters and EventMappings (#847) by @lcian
EventFilterhas been changed to abitflagsstruct.- It's now possible to map a
tracingevent to multiple items in Sentry by combining multiple event filters in theevent_filter, e.g.tracing::Level::ERROR => EventFilter::Event | EventFilter::Log. - It's also possible to use
EventMapping::Combinedto map atracingevent to multiple items in Sentry. ctxin the signatures ofevent_from_event,breadcrumb_from_eventandlog_from_eventhas been changed to takeimpl Into<Option<&'context Context<'context, S>>>to avoid cloning theContextwhen mapping to multiple items.
Features
Fixes
Dependencies
- chore(deps): bump
anyhowand disable itsbacktracefeature (#632) by @LunaBorowska