Skip to content

Commit 59c8de0

Browse files
authored
feat(ruby): Prepare docs for 6.0 major (#15248)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR To be merged as soon as 6.0 is released. getsentry/sentry-ruby#2352 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [x] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [x] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs)
1 parent e210ee9 commit 59c8de0

File tree

4 files changed

+49
-25
lines changed

4 files changed

+49
-25
lines changed

docs/platforms/ruby/common/configuration/integration_options.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ config.rails.skippable_job_adapters = ["ActiveJob::QueueAdapters::MyAdapter"]
2828

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

31-
- `Sentry::Rails::Tracing::ActionControllerSubscriber`
3231
- `Sentry::Rails::Tracing::ActionViewSubscriber`
3332
- `Sentry::Rails::Tracing::ActiveRecordSubscriber`
3433
- `Sentry::Rails::Tracing::ActiveStorageSubscriber`

docs/platforms/ruby/common/configuration/options.mdx

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ Learn more about [DSN utilization](/product/sentry-basics/dsn-explainer/#dsn-uti
2525
<SdkOption name="debug" type="Boolean" defaultValue="false">
2626

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

3030
</SdkOption>
3131

32-
<SdkOption name="logger" type="Sentry::Logger">
32+
<SdkOption name="sdk_logger" type="Sentry::Logger">
3333

3434
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.**
3535

3636
```ruby
37-
config.logger = Sentry::Logger.new(STDOUT)
38-
config.logger.level = ::Logger::DEBUG # defaults to INFO
37+
config.sdk_logger = Sentry::Logger.new(STDOUT)
38+
config.sdk_logger.level = ::Logger::DEBUG # defaults to INFO
3939
```
4040

4141
</SdkOption>
@@ -97,7 +97,7 @@ config.send_modules = false
9797

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

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

102102
</SdkOption>
103103

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

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

@@ -164,7 +163,7 @@ Sentry automatically sets the current environment from the environment variables
164163

165164
</SdkOption>
166165

167-
<SdkOption name="enabled_environments" type="Array">
166+
<SdkOption name="enabled_environments" type="Array | nil" defaultValue="nil">
168167

169168
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.
170169

@@ -314,6 +313,18 @@ config.propagate_traces = false
314313

315314
</SdkOption>
316315

316+
<SdkOption name="trace_ignore_status_codes" type="Array<Integer | Range>" defaultValue="[(301..303), (305..399), (401..404)]">
317+
318+
An optional property that disables tracing for HTTP requests with certain status codes.
319+
320+
Requests are not traced if the status code is contained in the provided list.
321+
322+
```ruby
323+
config.trace_ignore_status_codes = [404, (502..511)]
324+
```
325+
326+
</SdkOption>
327+
317328
<SdkOption name="instrumenter" type="Symbol" defaultValue=":sentry">
318329

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

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

329-
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.
340+
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.
330341

331342
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.
332343

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

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

339-
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.
350+
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.
340351

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

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

351362
</SdkOption>
352363

364+
<SdkOption name="before_send_check_in" type="lambda | proc">
365+
366+
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.
367+
368+
<PlatformContent includePath="configuration/before-send-check-in/" />
369+
370+
</SdkOption>
371+
353372
<SdkOption name="backtrace_cleanup_callback" type="lambda">
354373

355374
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:
@@ -484,6 +503,14 @@ A number between `0` and `1`, controlling the percentage chance a given sampled
484503

485504
</SdkOption>
486505

506+
<SdkOption name="profiles_sample_interval" type="Float" defaultValue="1e6 / 101">
507+
508+
Interval in microseconds at which the profiler will collect samples.
509+
510+
The default is 101 Hz. Note that the 101 is intentional to avoid **lockstep sampling**.
511+
512+
</SdkOption>
513+
487514
<SdkOption name="profiler_class" type="Class" defaultValue="Sentry::Profiler">
488515

489516
The profiler to use for collecting profiles.

docs/platforms/ruby/common/migration.mdx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,7 @@ Sentry.get_current_scope.set_transaction_name("NewTransaction")
279279

280280
### `Exception#raven_context`
281281

282-
`sentry-ruby` doesn't capture `raven_context` from exceptions anymore. However, you can use `before_send` to replicate the same behavior:
283-
284-
```rb
285-
config.before_send = lambda do |event, hint|
286-
if exception = hint[:exception]
287-
exception.raven_context.each do |key, value|
288-
# here I assume the event would be a Sentry::Event object
289-
# however, it'll be a hash if you use the async callback (which will be removed in version 6.0)
290-
event.send("#{key}=", value)
291-
end
292-
end
293-
294-
event
295-
end
296-
```
282+
`sentry-ruby` doesn't capture `raven_context` from exceptions anymore. Just use `set_tags` or `set_extra` as above to set contextual data.
297283

298284
## Example Apps
299285

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
```ruby
2+
Sentry.init do |config|
3+
# ...
4+
config.before_send_check_in = lambda do |event, _hint|
5+
if event.monitor_slug == "unimportant_job"
6+
nil
7+
else
8+
event
9+
end
10+
end
11+
end
12+
```

0 commit comments

Comments
 (0)