Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ config.rails.skippable_job_adapters = ["ActiveJob::QueueAdapters::MyAdapter"]

Tracing subscribers are responsible for capturing tracing spans from Rails instrumentation. The default subscribers are:

- `Sentry::Rails::Tracing::ActionControllerSubscriber`
- `Sentry::Rails::Tracing::ActionViewSubscriber`
- `Sentry::Rails::Tracing::ActiveRecordSubscriber`
- `Sentry::Rails::Tracing::ActiveStorageSubscriber`
Expand Down
45 changes: 36 additions & 9 deletions docs/platforms/ruby/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ Learn more about [DSN utilization](/product/sentry-basics/dsn-explainer/#dsn-uti
<SdkOption name="debug" type="Boolean" defaultValue="false">

This turns debug mode on or off. When enabled, SDK errors will be logged with backtrace.
If you want more output, use `config.logger.level`. `debug` only works for attaching backtraces to the messages.
If you want more output, use `config.sdk_logger.level`. `debug` only works for attaching backtraces to the messages.

</SdkOption>

<SdkOption name="logger" type="Sentry::Logger">
<SdkOption name="sdk_logger" type="Sentry::Logger">

The logger used by Sentry. The default for Rails is `Rails.logger`, otherwise it's `Sentry::Logger`. Make sure to change the logger level if you need debug output. **We don't recommend doing this in production unless absolutely necessary.**

```ruby
config.logger = Sentry::Logger.new(STDOUT)
config.logger.level = ::Logger::DEBUG # defaults to INFO
config.sdk_logger = Sentry::Logger.new(STDOUT)
config.sdk_logger.level = ::Logger::DEBUG # defaults to INFO
```

</SdkOption>
Expand Down Expand Up @@ -97,7 +97,7 @@ config.send_modules = false

<SdkOption name="include_local_variables" type="Boolean" defaultValue="false">

Whether to capture local variables from the raised exceptions frame. (In older versions, this was called `capture_exception_frame_locals`.)
Whether to capture local variables from the raised exceptions frame.

</SdkOption>

Expand Down Expand Up @@ -125,7 +125,6 @@ Sentry supports different breadcrumbs loggers in the Ruby SDK:
- `:http_logger` - Captures requests made with the standard `net/http` library.
- `:redis_logger` - Captures breadcrumbs from redis operations.
- `:active_support_logger` - Built on top of [ActiveSupport instrumentation](https://guides.rubyonrails.org/active_support_instrumentation.html) and provides many Rails-specific information.
- `:monotonic_active_support_logger` - Similar to `:active_support_logger` but breadcrumbs will have monotonic time values. Only available with Rails 6.1+.

And you can enable them with the `breadcrumbs_logger` option:

Expand Down Expand Up @@ -164,7 +163,7 @@ Sentry automatically sets the current environment from the environment variables

</SdkOption>

<SdkOption name="enabled_environments" type="Array">
<SdkOption name="enabled_environments" type="Array | nil" defaultValue="nil">

By default, events will be sent to Sentry in all environments. If you don't want to send events in a specific environment, you can unset the `SENTRY_DSN` variable in that environment.

Expand Down Expand Up @@ -314,6 +313,18 @@ config.propagate_traces = false

</SdkOption>

<SdkOption name="trace_ignore_status_codes" type="Array<Integer | Range>" defaultValue="[(301..303), (305..399), (401..404)]">

An optional property that disables tracing for HTTP requests with certain status codes.

Requests are not traced if the status code is contained in the provided list.

```ruby
config.trace_ignore_status_codes = [404, (502..511)]
```

</SdkOption>

<SdkOption name="instrumenter" type="Symbol" defaultValue=":sentry">

The instrumenter to use, `:sentry` or `:otel` for [use with OpenTelemetry](../../tracing/instrumentation/opentelemetry).
Expand All @@ -326,7 +337,7 @@ The below options can be used to hook the SDK in various ways and customize how

<SdkOption name="before_send" type="lambda | proc">

Provides a lambda or proc that's called with an SDK-specific message or error event object, and can return a modified event object, or `nil` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending.
Provides a lambda or proc that's called with a message or error event object, and can return a modified event object, or `nil` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending.

By the time `before_send` is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect.

Expand All @@ -336,7 +347,7 @@ By the time `before_send` is executed, all scope data has already been applied t

<SdkOption name="before_send_transaction" type="lambda | proc">

Provides a lambda or proc that's called with an SDK-specific transaction event object, and can return a modified transaction event object, or `nil` to skip reporting the event. One way this might be used is for manual PII stripping before sending.
Provides a lambda or proc that's called with a transaction event object, and can return a modified transaction event object, or `nil` to skip reporting the event. One way this might be used is for manual PII stripping before sending.

<PlatformContent includePath="configuration/before-send-transaction/" />

Expand All @@ -350,6 +361,14 @@ Provides a lambda or proc that's called with an SDK-specific log object, and can

</SdkOption>

<SdkOption name="before_send_check_in" type="lambda | proc">

Provides a lambda or proc that's called with a check-in event object, and can return a modified check-in event object, or `nil` to skip reporting the event.

<PlatformContent includePath="configuration/before-send-check-in/" />

</SdkOption>

<SdkOption name="backtrace_cleanup_callback" type="lambda">

If you want to clean up the backtrace of an exception before it's sent to Sentry, you can specify a callback with `backtrace_cleanup_callback`, for example:
Expand Down Expand Up @@ -484,6 +503,14 @@ A number between `0` and `1`, controlling the percentage chance a given sampled

</SdkOption>

<SdkOption name="profiles_sample_interval" type="Float" defaultValue="1e6 / 101">

Interval in microseconds at which the profiler will collect samples.

The default is 101 Hz. Note that the 101 is intentional to avoid **lockstep sampling**.

</SdkOption>

<SdkOption name="profiler_class" type="Class" defaultValue="Sentry::Profiler">

The profiler to use for collecting profiles.
Expand Down
16 changes: 1 addition & 15 deletions docs/platforms/ruby/common/migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,7 @@ Sentry.get_current_scope.set_transaction_name("NewTransaction")

### `Exception#raven_context`

`sentry-ruby` doesn't capture `raven_context` from exceptions anymore. However, you can use `before_send` to replicate the same behavior:

```rb
config.before_send = lambda do |event, hint|
if exception = hint[:exception]
exception.raven_context.each do |key, value|
# here I assume the event would be a Sentry::Event object
# however, it'll be a hash if you use the async callback (which will be removed in version 6.0)
event.send("#{key}=", value)
end
end

event
end
```
`sentry-ruby` doesn't capture `raven_context` from exceptions anymore. Just use `set_tags` or `set_extra` as above to set contextual data.

## Example Apps

Expand Down
12 changes: 12 additions & 0 deletions platform-includes/configuration/before-send-check-in/ruby.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```ruby
Sentry.init do |config|
# ...
config.before_send_check_in = lambda do |event, _hint|
if event.monitor_slug == "unimportant_job"
nil
else
event
end
end
end
```
Loading