Update dependency sentry-rails to '~>5.17.0'
This MR contains the following updates:
Package | Update | Change |
---|---|---|
sentry-rails (changelog) | minor |
'~>5.1.0' -> '~>5.17.0'
|
MR created with the help of gitlab-org/frontend/renovate-gitlab-bot
Release Notes
getsentry/sentry-ruby (sentry-rails)
v5.17.3
Features
- Update key, unit and tags sanitization logic for metrics #2292
- Consolidate client report and rate limit handling with data categories #2294
- Record
:network_error
client reports forsend_envelope
#2295
Bug Fixes
v5.17.2
Features
- Add
Mechanism
interface and default to unhandled for integration exceptions #2280
Bug Fixes
- Don't instantiate connection in
ActiveRecordSubscriber
(#2278)
v5.17.1
Bug Fixes
- Fix NoMethodError / Make session_tracking check consistent (#2269)
v5.17.0
Features
- Add support for distributed tracing in
sentry-delayed_job
#2233 - Fix warning about default gems on Ruby 3.3.0 (#2225)
- Add
hint:
support toSentry::Rails::ErrorSubscriber
#2235 - Add Metrics support
-
Add main APIs and
Aggregator
thread #2247 -
Add
Sentry::Metrics.timing
API for measuring block duration #2254 -
Add metric summaries on spans #2255
-
Add
config.metrics.before_emit
callback #2258 -
Add code locations for metrics #2263
The SDK now supports recording and aggregating metrics. A new thread will be started for aggregation and will flush the pending data to Sentry every 5 seconds.
To enable this behavior, use:
Sentry.init do |config|
-
...
config.metrics.enabled = true
end
```
And then in your application code, collect metrics as follows:
```ruby
increment a simple counter
Sentry::Metrics.increment('button_click')
set a value, unit and tags
Sentry::Metrics.increment('time', 5, unit: 'second', tags: { browser:' firefox' })
distribution - get statistical aggregates from an array of observations
Sentry::Metrics.distribution('page_load', 15.0, unit: 'millisecond')
gauge - record statistical aggregates directly on the SDK, more space efficient
Sentry::Metrics.gauge('page_load', 15.0, unit: 'millisecond')
set - get unique counts of elements
Sentry::Metrics.set('user_view', 'jane')
timing - measure duration of code block, defaults to seconds
metric.timing
span
will also automatically create a Sentry::Metrics.timing('how_long') { sleep(1) }
timing - measure duration of code block in other duraton units
Sentry::Metrics.timing('how_long_ms', unit: 'millisecond') { sleep(0.5) }
```
You can filter some keys or update tags on the fly with the `before_emit` callback, which will be triggered before a metric is aggregated.
```ruby
Sentry.init do |config|
...
the 'foo' metric will be filtered and the tags will be updated to add :bar and remove :baz
config.metrics.before_emit = lambda do |key, tags|
return nil if key == 'foo'
tags[:bar] = 42
tags.delete(:baz)
true
end
end
```
By default, the SDK will send code locations for unique metrics (defined by type, key and unit) once a day and with every startup/shutdown of your application.
You can turn this off with the following:
```ruby
Sentry.init do |config|
...
config.metrics.enable_code_locations = false
end
```
Bug Fixes
- Fix undefined method 'constantize' issue in
sentry-resque
(#2248) - Only instantiate SessionFlusher when the SDK is enabled under the current env #2245
- Fixes #2234
- Update backtrace parsing regexp to support Ruby 3.4 (#2252)
- Make sure
sending_allowed?
is respected irrespective of spotlight configuration (#2231)- Fixes #2226
v5.16.1
Bug Fixes
- Pin
sqlite3
gem for building because of failed release #2222
v5.15.2
Bug Fixes
v5.15.1
Features
- Expose
configuration.background_worker_max_queue
to control thread pool queue size #2195
Bug Fixes
v5.15.0
Features
- You can now use Spotlight with your apps that use sentry-ruby! #2175
- Improve default slug generation for
sidekiq-scheduler
#2184
Bug Fixes
- Network errors raised in
Sentry::HTTPTransport
will no longer be reported to Sentry #2178
v5.14.0
Features
- Improve default slug generation for Crons #2168
- Change release name generator to use full SHA commit hash and align with
sentry-cli
and other Sentry SDKs #2174 - Automatic Crons support for scheduling gems
-
Add support for
sidekiq-cron
#2170You can opt in to the
sidekiq-cron
patch and we will automatically monitor check-ins for all jobs listed in yourconfig/schedule.yml
file.config.enabled_patches += [:sidekiq_cron]
-
Add support for
sidekiq-scheduler
#2172You can opt in to the
sidekiq-scheduler
patch and we will automatically monitor check-ins for all repeating jobs (i.e.cron
,every
, andinterval
) specified in the config.config.enabled_patches += [:sidekiq_scheduler]
-
Bug Fixes
- Fixed a deprecation in
sidekiq-ruby
error handler #2160 - Avoid invoking ActiveSupport::BroadcastLogger if not defined #2169
- Respect custom
Delayed::Job.max_attempts
if it's defined #2176 - Fixed a bug where
Net::HTTP
instrumentation won't work for some IPv6 addresses #2180 - Allow non-string error message to be reported to sentry (#2137)
v5.13.0
Features
-
Make additional job context available to traces_sampler for determining sample rate (sentry-delayed_job) #2148
-
Add new
config.rails.active_support_logger_subscription_items
to allow customization breadcrumb data of active support logger #2139config.rails.active_support_logger_subscription_items["sql.active_record"] << :type_casted_binds config.rails.active_support_logger_subscription_items.delete("sql.active_record") config.rails.active_support_logger_subscription_items["foo"] = :bar
-
Enable opting out of patches #2151
Bug Fixes
- Fix puma integration for versions before v5 #2141
- Fix breadcrumbs with
warn
level not being ingested #2150- Fixes #2145
- Don't send negative line numbers in profiles #2158
- Allow transport proxy configuration to be set with
HTTP_PROXY
environment variable #2161
v5.12.0
Features
- Record client reports for profiles #2107
- Adopt Rails 7.1's new BroadcastLogger #2120
- Support sending events after all retries were performed (sentry-resque) #2087
- Add Cron Monitoring support
-
Add
Sentry.capture_check_in
API for Cron Monitoring #2117You can now track progress of long running scheduled jobs.
check_in_id = Sentry.capture_check_in('job_name', :in_progress)
-
do job stuff
Sentry.capture_check_in('job_name', :ok, check_in_id: check_in_id)
```
-
Add
Sentry::Cron::MonitorCheckIns
module for automatic monitoring of jobs #2130Standard job frameworks such as
ActiveJob
andSidekiq
can now use this module to automatically capture check ins.class ExampleJob < ApplicationJob include Sentry::Cron::MonitorCheckIns sentry_monitor_check_ins def perform(*args)
do stuff
end
end
```
```rb
class SidekiqJob
include Sidekiq::Job
include Sentry::Cron::MonitorCheckIns
sentry_monitor_check_ins
def perform(*args)
do stuff
end
end
```
You can pass in optional attributes to `sentry_monitor_check_ins` as follows.
```rb
slug defaults to the job class name
sentry_monitor_check_ins slug: 'custom_slug'
define the monitor config with an interval
sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_interval(1, :minute)
define the monitor config with a crontab
sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_crontab('5 * * * *')
```
Bug Fixes
- Rename
http.method
tohttp.request.method
inSpan::DataConventions
#2106 - Increase
Envelope::Item::MAX_SERIALIZED_PAYLOAD_SIZE
to 1MB #2108 - Fix
db_config
beginnil
inActiveRecordSubscriber
#2111- Fixes #2109
- Always send envelope trace header from dynamic sampling context #2113
- Improve
TestHelper
's setup/teardown helpers (#2116)- Fixes #2103
- Fix Sidekiq tracing headers not being overwritten in case of schedules and retries #2118
- Fix exception event sending failed due to source sequence is illegal/malformed utf-8 #2083
- Fixes #2082
v5.11.0
Features
-
Make
:value
inSingleExceptionInterface
writable, so that it can be modified inbefore_send
underevent.exception.values[n].value
#2072 -
Add
sampled
field todynamic_sampling_context
#2092 -
Consolidate HTTP span data conventions with OpenTelemetry with
Sentry::Span::DataConventions
#2093 -
Consolidate database span data conventions with OpenTelemetry for ActiveRecord and Redis #2100
-
Add new
config.trace_propagation_targets
option to set targets for which headers are propagated in outgoing HTTP requests #2079
v5.10.0
Features
- Move
http.query
to span data in net/http integration #2039 - Validate
release
is aString
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
- Fixes #2054
- Ignore low-level Puma exceptions by default #2055
- Use allowlist to filter
ActiveSupport
breadcrumbs' data #2048 - ErrorHandler should cleanup the scope (#2059)
v5.9.0
Features
-
Add new boolean option
config.enable_tracing
to simplify enabling performance tracing #2005-
config.enable_tracing = true
will settraces_sample_rate
to1.0
if not set already -
config.enable_tracing = false
will turn off tracing even iftraces_sample_rate/traces_sampler
is set -
config.enable_tracing = nil
(default) will keep the current behaviour
-
-
Allow ignoring
excluded_exceptions
when manually capturing exceptions #2007Users can now ignore the SDK's
excluded_exceptions
by passingignore_exclusions
hint when usingSentry.capture_exception
.
v5.8.0
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 insentry-rails
#1968 -
Add
Sentry.add_global_event_processor
API #1976Users 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 #1989Users can now configure a
before_send_transaction
callback that runs similar tobefore_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
#1838Usage:
transaction = Sentry.get_current_scope.get_transaction transaction.set_measurement("metrics.foo", 0.5, "millisecond")
Bug Fixes
- Support redis-rb 5.0+ #1963
- Fixes #1932
- Skip private _config context in Sidekiq 7+ #1967
- Fixes #1956
- 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
- Fixes #1899
- Do not report exceptions when a Rails runner exits with
exit 0
#1988 - Ignore redis key if not UTF8 #1997
- Fixes #1992
Miscellaneous
- Deprecate
capture_exception_frame_locals
in favor ofinclude_local_variables
#1993
v5.7.0
Features
- Expose
span_id
inSpan
constructor #1945 - Expose
end_timestamp
inSpan#finish
andTransaction#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 #1944The 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.
-
v5.6.0
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 ofspan.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 releaseActiveRecord
connection pool only when theActiveRecord
connection is established -
Remove bad encoding arguments in redis span descriptions #1914
- Fixes #1911
-
Add missing
initialized?
checks tosentry-rails
#1919- Fixes #1885
-
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 MR. 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 theop
for filtering some requests.
Refactoring
- Make transaction a required argument of Span #1921
v5.5.0
Features
-
Support rack 3 #1884
- We no longer need the
HTTP_VERSION
check for ignoring the header
- We no longer need the
-
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
- in all outgoing requests in our net/http patch
- in Sentry transactions as Dynamic Sampling Context
- Create new Baggage entries as Head SDK (originator of trace) #1898
- Add Transaction source annotations to classify low quality (high cardinality) transaction names #1902
- Parse incoming W3C Baggage Headers and propagate them to continue traces #1869
Bug Fixes
- Memoize session.aggregation_key #1892
- Fixes #1891
- Execute
with_scope
's block even when SDK is not initialized #1897- Fixes #1896
- Make sure test helper clears the current scope before/after a test #1900
v5.4.2
Bug Fixes
v5.4.1
Bug Fixes
- Fix missing
spec.files
insentry-ruby.gemspec
- Fixes #1856
v5.4.0
Features
-
Expose
:values
inExceptionInterface
, so that it can be accessed inbefore_send
underevent.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 #1814Usage:
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 #1849If 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- Fixes #1840
- Rescue event's to JSON conversion error #1853
- Rescue
ThreadError
inSessionFlusher
and stop creating threads if flusher is killed #1851- Fixes #1848
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"
v5.3.1
Bug Fixes
- Don't require a DB connection, but release one if it is acquired #1812
- Fixes #1808
-
Sentry.with_child_span
should check SDK's initialization state #1819- Fixes #1818
Miscellaneous
- Warn users about
config.async
's deprecation #1803
v5.3.0
Features
- Add
Sentry.with_child_span
for easier span recording #1783
operation_result = Sentry.with_child_span(op: "my op") do |child_span|
my_operation
end
v5.2.1
Bug Fixes
- Also check stringified breadcrumbs key when reducing payload size #1758
- Fixes #1757
- Ignore internal Sidekiq::JobRetry::Skip exception #1763
- Fixes #1731
Miscellaneous
- Warn user if any integration is required after SDK initialization #1759
v5.2.0
Features
-
Log Redis command arguments when sending PII is enabled #1726
-
Add request env to sampling context #1749
Example
Sentry.init do |config| config.traces_sampler = lambda do |sampling_context| env = sampling_context[:env] if env["REQUEST_METHOD"] == "GET" 0.01 else 0.1 end end end
-
Check envelope size before sending it #1747
The SDK will now check if the envelope's event items are oversized before sending the envelope. It goes like this:
- If an event is oversized (200kb), the SDK will remove its breadcrumbs (which in our experience is the most common cause).
- If the event size now falls within the limit, it'll be sent.
- Otherwise, the event will be thrown away. The SDK will also log a debug message about the event's attributes size (in bytes) breakdown. For example,
{event_id: 34, level: 7, timestamp: 22, environment: 13, server_name: 14, modules: 935, message: 5, user: 2, tags: 2, contexts: 820791, extra: 2, fingerprint: 2, platform: 6, sdk: 40, threads: 51690}
This will help users report size-related issues in the future.
-
Automatic session tracking #1715
Example:
The SDK now supports automatic session tracking / release health by default in Rack based applications. Aggregate statistics on successful / errored requests are collected and sent to the server every minute. To use this feature, make sure the SDK can detect your app's release. Or you have set it with:
Sentry.init do |config| config.release = 'release-foo-v1' end
To disable this feature, set
config.auto_session_tracking
tofalse
.
Bug Fixes
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.