Skip to content

Releases: getsentry/sentry-ruby

5.10.0

05 Jul 15:10
Compare
Choose a tag to compare

Features

  • Move http.query to span data in net/http integration #2039
  • Validate release is a String during configuration #2040
  • Allow JRuby Java exceptions to be captured #2043
  • Improved error handling around traces_sample_rate/profiles_sample_rate #2036

Bug Fixes

  • Support Rails 7.1's show exception check #2049
  • Fix uninitialzed race condition in Redis integration #2057
  • Ignore low-level Puma exceptions by default #2055
  • Use allowlist to filter ActiveSupport breadcrumbs' data #2048
  • ErrorHandler should cleanup the scope (#2059)

5.9.0

19 Apr 13:16
Compare
Choose a tag to compare

Features

  • Add new boolean option config.enable_tracing to simplify enabling performance tracing #2005

    • config.enable_tracing = true will set traces_sample_rate to 1.0 if not set already
    • config.enable_tracing = false will turn off tracing even if traces_sample_rate/traces_sampler is set
    • config.enable_tracing = nil (default) will keep the current behaviour
  • Allow ignoring excluded_exceptions when manually capturing exceptions #2007

    Users can now ignore the SDK's excluded_exceptions by passing ignore_exclusions hint when using Sentry.capture_exception.

    # assume ignored_exception.class is included in config.excluded_exception
    Sentry.capture_exception(ignored_exception) # won't be sent to Sentry
    Sentry.capture_exception(ignored_exception, hint: { ignore_exclusions: true }) # will be sent to Sentry
  • Support capturing low-level errors propagated to Puma #2026

  • Add spec to Backtrace::APP_DIRS_PATTERN #2029

  • Forward all baggage header items that are prefixed with sentry- #2025

  • Add stackprof based profiler #2024

    The SDK now supports sending profiles taken by the stackprof gem and viewing them in the Profiling section.

    To use it, first add stackprof to your Gemfile and make sure it is loaded before sentry-ruby.

    # Gemfile
    
    gem 'stackprof'
    gem 'sentry-ruby'

    Then, make sure both traces_sample_rate and profiles_sample_rate are set and non-zero in your sentry initializer.

    # config/initializers/sentry.rb
    
    Sentry.init do |config|
      config.dsn = "<dsn>"
      config.traces_sample_rate = 1.0
      config.profiles_sample_rate = 1.0
    end

    Some implementation caveats:

    • Profiles are sampled relative to traces, so if both rates are 0.5, we will capture 0.25 of all requests.
    • Profiles are only captured for code running within a transaction.
    • Profiles for multi-threaded servers like puma might not capture frames correctly when async I/O is happening. This is a stackprof limitation.

    Warning
    Profiling is currently in beta. Beta features are still in-progress and may have bugs. We recognize the irony.
    If you have any questions or feedback, please email us at profiling@sentry.io, reach out via Discord (#profiling), or open an issue.

Bug Fixes

  • Validate that contexts set in set_contexts are also Hash instances #2022

5.8.0

06 Feb 17:39
Compare
Choose a tag to compare

Features

  • Allow tags to be passed via the context hash when reporting errors using ActiveSupport::ErrorReporter and Sentry::Rails::ErrorSubscriber in sentry-rails #1932

  • Pass a cached: true tag for SQL query spans that utilized the ActiveRecord QueryCache when using ActiveRecordSubscriber in sentry-rails #1968

  • Add Sentry.add_global_event_processor API #1976

    Users can now configure global event processors without configuring scope as well.

    Sentry.add_global_event_processor do |event, hint|
      event.tags = { foo: 42 }
      event
    end
  • Add global event processor in OpenTelemetry SpanProcessor to link errors with transactions #1983

  • Fix some inconsistencies in setting name/op/status in OpenTelemetry SpanProcessor #1987

  • Add config.before_send_transaction hook #1989

    Users can now configure a before_send_transaction callback that runs similar to before_send but for transaction events.

    config.before_send_transaction = lambda do |event, hint|
      # skip unimportant transactions or strip sensitive data
      if event.transaction == "/healthcheck/route"
        nil
      else
        event
      end
    end
  • Support Sentry::Transaction#set_measurement #1838

    Usage:

    transaction = Sentry.get_current_scope.get_transaction
    transaction.set_measurement("metrics.foo", 0.5, "millisecond")

Bug Fixes

  • Support redis-rb 5.0+ #1963
  • Skip private _config context in Sidekiq 7+ #1967
  • Return value from perform_action in ActionCable::Channel instances when initialized #1966
  • Span#with_child_span should finish the span even with exception raised #1982
  • Fix sentry-rails' controller span nesting #1973
  • Do not report exceptions when a Rails runner exits with exit 0 #1988
  • Ignore redis key if not UTF8 #1997

Miscellaneous

  • Deprecate capture_exception_frame_locals in favor of include_local_variables #1993

5.7.0

01 Dec 11:52
Compare
Choose a tag to compare

Features

  • Expose span_id in Span constructor #1945
  • Expose end_timestamp in Span#finish and Transaction#finish #1946
  • Add Transaction#set_context api #1947
  • Add OpenTelemetry support with new sentry-opentelemetry gem
    • Add config.instrumenter to switch between :sentry and :otel instrumentation #1944

      The new sentry-opentelemetry gem adds support to automatically integrate OpenTelemetry performance tracing with Sentry. Give it a try and let us know if you have any feedback or problems with using it.

5.6.0

08 Nov 10:05
Compare
Choose a tag to compare

Features

  • Allow users to configure their asset-skipping pattern #1915

    Users can now configure their own pattern to skip asset requests' transactions

    Sentry.init do |config|
      config.rails.assets_regexp = /my_regexp/
    end
  • Use Sentry.with_child_span in redis and net/http instead of span.start_child #1920

    • This might change the nesting of some spans and make it more accurate
    • Followup fix to set the sentry-trace header in the correct place #1922
  • Use Exception#detailed_message when generating exception message if applicable #1924

  • Make sentry-sidekiq compatible with Sidekiq 7 #1930

Bug Fixes

  • Sentry::BackgroundWorker will release ActiveRecord connection pool only when the ActiveRecord connection is established

  • Remove bad encoding arguments in redis span descriptions #1914

  • Add missing initialized? checks to sentry-rails #1919

  • Update Tracing Span's op names #1923

    Currently, Ruby integrations' Span op names aren't aligned with the core specification's convention, so we decided to update them altogether in this PR.
    If you rely on Span op names for fine-grained event filtering, this may affect the data your app sends to Sentry.
    Also make sure to update your traces_sampler if you rely on the op for filtering some requests.

Refactoring

  • Make transaction a required argument of Span #1921

5.5.0

03 Oct 14:52
Compare
Choose a tag to compare

Features

  • Support rack 3 #1884

    • We no longer need the HTTP_VERSION check for ignoring the header
  • Add Dynamic Sampling support
    The SDK now supports Sentry's Dynamic Sampling product.

    Note that this is not supported for users still using the config.async option.

    • Parse incoming W3C Baggage Headers and propagate them to continue traces #1869
    • Create new Baggage entries as Head SDK (originator of trace) #1898
    • Add Transaction source annotations to classify low quality (high cardinality) transaction names #1902

Bug Fixes

  • Memoize session.aggregation_key #1892
  • Execute with_scope's block even when SDK is not initialized #1897
  • Make sure test helper clears the current scope before/after a test #1900

5.4.2

17 Aug 13:02
Compare
Choose a tag to compare

Bug Fixes

  • Fix sentry_logger when SDK is closed from another thread #1860

5.4.1

26 Jul 11:33
Compare
Choose a tag to compare

Bug Fixes

  • Fix missing spec.files in sentry-ruby.gemspec #1857

5.4.0

26 Jul 09:31
Compare
Choose a tag to compare

Features

  • Expose :values in ExceptionInterface, so that it can be accessed in before_send under event.exception.values #1843

  • Add top level Sentry.close API #1844

    • Cleans up SDK state and sets it to uninitialized
    • No-ops all SDK APIs and also disables the transport layer, so nothing will be sent to Sentry after closing the SDK
  • Handle exception with large stacktrace without dropping entire item #1807

  • Capture Rails runner's exceptions before exiting #1820

  • Add Sentry.with_exception_captured helper #1814

    Usage:

    Sentry.with_exception_captured do
     1/1 #=> 1 will be returned
    end
    
    Sentry.with_exception_captured do
     1/0 #=> ZeroDivisionError will be reported and re-raised
    end
  • Prepare for Rails 7.1's error reporter API change #1834

  • Set sentry.error_event_id in request env if the middleware captures errors #1849

    If the SDK's Rack middleware captures an error, the reported event's id will be stored in the request env. For example:

    env["sentry.error_event_id"] #=> "507bd4c1a07e4355bb70bcd7afe8ab17"

    Users can display this information on the error page via a middleware as proposed in #1846

Bug Fixes

  • Respect report_rescued_exceptions config #1847
  • Rescue event's to JSON conversion error #1853
  • Rescue ThreadError in SessionFlusher and stop creating threads if flusher is killed #1851

Refactoring

  • Move envelope item processing/trimming logic to the Item class #1824
  • Replace sentry-ruby-core with sentry-ruby as integration dependency #1825

Test Helpers

The SDK now provides a set of test helpers to help users setup and teardown Sentry related tests.

To get started:

require "sentry/test_helper"

# in minitest
class MyTest < Minitest::Test
  include Sentry::TestHelper
  # ...
end

# in RSpec
RSpec.configure do |config|
  config.include Sentry::TestHelper
  # ...
end

It's still an early attempt so please give us feedback in #1680.

5.3.1

16 May 12:00
Compare
Choose a tag to compare

Bug Fixes

  • Don't require a DB connection, but release one if it is acquired #1812
  • Sentry.with_child_span should check SDK's initialization state #1819

Miscellaneous

  • Warn users about config.async's deprecation #1803