Skip to content

Releases: getsentry/sentry-rust

0.48.0

28 Apr 15:45

Choose a tag to compare

Breaking Changes

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

10 Mar 14:40

Choose a tag to compare

Breaking Changes

  • Update reqwest from 0.12.25 to 0.13.1 (#998). This change is breaking for users who use the RequestHttpTransport::with_client method.
  • sentry_core::HubSwitchGuard is now !Send, preventing it from being moved across threads (#957).

New Features

  • Added a Envelope::into_items method, which returns an iterator over owned EnvelopeItems in the Envelope (#983).
  • Expose transport utilities (#949)

Fixes

  • Fixed thread corruption bug where HubSwitchGuard could be dropped on wrong thread (#957).
  • We now fork the Hub every time a span is entered. This prevents data from leaking across spans (#957).

0.46.2

04 Feb 12:19

Choose a tag to compare

New Features

  • Log HTTP 413 responses as oversized envelope discards in HTTP transports (#966)

0.46.1

07 Jan 08:38

Choose a tag to compare

Improvements

  • Make it possible to == Transaction/Span/TransactionOrSpan (#942)

Dependencies

  • Update reqwest from 0.12.15 to 0.12.25 (#951)

0.46.0

24 Nov 13:36

Choose a tag to compare

Breaking changes

  • Removed the ClientOptions struct's trim_backtraces and extra_border_frames fields (#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

  • fix: adjust sentry.origin for log integration (#919) by @lcian

0.45.0

08 Oct 09:19

Choose a tag to compare

Breaking changes

  • Add custom variant to AttachmentType that holds an arbitrary String. (#916)

0.44.0

07 Oct 10:00

Choose a tag to compare

Breaking changes

  • feat(log): support combined LogFilters and RecordMappings (#914) by @lcian
    • Breaking change: sentry::integrations::log::LogFilter has been changed to a bitflags struct.
    • It's now possible to map a log record 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 mapper instead, it's possible to return a Vec<sentry::integrations::log::RecordMapping> to map a log record to multiple items in Sentry.

Behavioral changes

  • ref(log): send logs by default when logs feature flag is enabled (#915) by @lcian
    • If the logs feature flag is enabled, the default Sentry log logger now sends logs for all events at or above INFO.
  • ref(logs): enable logs by default if logs feature flag is used (#910) by @lcian
    • This changes the default value of sentry::ClientOptions::enable_logs to true.
    • This simplifies the setup of Sentry structured logs by requiring users to just add the log feature flag to the sentry dependency to opt-in to sending logs.
    • When the log feature flag is enabled, the tracing and log integrations will send structured logs to Sentry for all logs/events at or above INFO level by default.

0.43.0

24 Sep 09:26

Choose a tag to compare

Breaking changes

  • ref(tracing): rework tracing to Sentry span name/op conversion (#887) by @lcian
    • The tracing integration 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 tracing span target (<module>::<function> when using the tracing::instrument macro).
    • The tracing integration now uses <span target>::<span name> as the default Sentry span op (i.e. <module>::<function> when using tracing::instrument).
    • Before this change, the span op would be set based on the tracing span 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.
  • ref(tracing): use standard code attributes (#899) by @lcian
    • Logs now carry the attributes code.module.name, code.file.path and code.line.number standardized in OTEL to surface the respective information, in contrast with the previously sent tracing.module_path, tracing.file and tracing.line.
  • fix(actix): capture only server errors (#877) by @lcian
    • The Actix integration now properly honors the capture_server_errors option (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.
  • fix: send trace origin correctly (#906) by @lcian
    • TraceContext now has an additional field origin, used to report which integration created a transaction.

Behavioral changes

  • feat(tracing): send both breadcrumbs and logs by default (#878) by @lcian
    • If the logs feature flag is enabled, and enable_logs: true is set on your client options, the default Sentry tracing layer now sends logs for all events at or above INFO.

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 valid sentry-trace header (sent automatically by client SDKs), continues the distributed trace instead of starting a new one. If the value is not a valid sentry-trace header or a trace is already started, this value is ignored.
    • sentry.op and sentry.name can also be applied retroactively by declaring fields with value tracing::field::Empty and then recorded using tracing::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 the tracing span's metadata.target()
      • code.module.name, code.file.path, code.line.number
  • feat(core): add Response context (#874) by @lcian

    • The Response context 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());

Fixes

  • build(panic): Fix build without other dependencies (#883) by @liskin
    • The sentry-panic crate now builds successfully when used as a standalone dependency.
  • fix(transport): add rate limits for logs (#894) by @giortzisg

0.42.0

29 Jul 08:34

Choose a tag to compare

Features

  • feat(log): support kv feature of log (#851) by @lcian
    • Attributes added to a log record using the kv feature are now recorded as attributes on the log sent to Sentry.
  • 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 Request is 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

0.41.0

23 Jun 10:55

Choose a tag to compare

Breaking changes

  • feat(tracing): support combined EventFilters and EventMappings (#847) by @lcian
    • EventFilter has been changed to a bitflags struct.
    • It's now possible to map a tracing event to multiple items in Sentry by combining multiple event filters in the event_filter, e.g. tracing::Level::ERROR => EventFilter::Event | EventFilter::Log.
    • It's also possible to use EventMapping::Combined to map a tracing event to multiple items in Sentry.
    • ctx in the signatures of event_from_event, breadcrumb_from_event and log_from_event has been changed to take impl Into<Option<&'context Context<'context, S>>> to avoid cloning the Context when mapping to multiple items.

Features

  • feat(core): emit debug log when calling capture_log but logs are disabled (#849) by @lcian

Fixes

  • fix(logs): stringify u64 attributes greater than i64::MAX (#846) by @lcian

Dependencies

  • chore(deps): bump anyhow and disable its backtrace feature (#632) by @LunaBorowska