Skip to content

Commit 36750b0

Browse files
authored
feat(ruby): Document integrations - gems and patches (#11115)
1 parent 3a27b66 commit 36750b0

File tree

3 files changed

+98
-21
lines changed
  • docs/platforms/ruby/common
  • platform-includes/enriching-events/breadcrumbs/breadcrumbs-example

3 files changed

+98
-21
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ config.inspect_exception_causes_for_exclusion = true
191191

192192
</ConfigKey>
193193

194+
<ConfigKey name="enabled-patches">
195+
196+
Some of our integrations work via patches that need to be enabled. Use this option to control which patches are loaded when the SDK is initialized.
197+
198+
The list of all available patches is: `[:http, :redis, :puma, :graphql, :faraday]`.
199+
200+
The list of patches enabled by default is: `[:http, :redis, :puma]`.
201+
202+
```ruby
203+
# enable :faraday patch
204+
config.enabled_patches << :faraday
205+
206+
# disable :puma patch
207+
config.enabled_patches.delete(:puma)
208+
```
209+
210+
</ConfigKey>
211+
194212
<ConfigKey name="skip-rake-integration">
195213

196214
Determine whether to ignore exceptions caused by rake integrations. The default is `false`.
@@ -223,7 +241,7 @@ To disable all tracing, you'll either need to set <PlatformIdentifier name="trac
223241

224242
<ConfigKey name="traces-sampler">
225243

226-
A lambda or proc that's responsible for determining the chance that a given transaction has of being sent to Sentry (from 0-100%). It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent).
244+
A lambda or proc that's responsible for determining the chance that a given transaction has of being sent to Sentry (from 0-100%). It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent).
227245

228246
It can also be used for filtering transactions, by returning 0 for those that are of no interest. Either this or <PlatformIdentifier name="traces-sample-rate" /> must be defined to enable tracing.
229247

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Integrations
3+
description: "Sentry provides additional integrations designed to change configuration or add instrumentation to your application."
4+
sidebar_order: 40
5+
---
6+
7+
The Sentry SDK uses integrations to hook into the functionality of popular frameworks and libraries to automatically instrument your application and give you the best data out of the box.
8+
9+
Some of our integrations are available as separate gems while others are available as patches that can be enabled from the `sentry-ruby` gem. You can find an overview of all available integrations below.
10+
11+
## Gems
12+
13+
The following table lists all integrations available as gems.
14+
15+
Simply add the relevant gems to your Gemfile and run `bundle install` to install them.
16+
17+
| Integration | `Gemfile` |
18+
| --------------------------------------------------------------------------------------------------------------------- | :--------------: |
19+
| <LinkWithPlatformIcon platform="ruby.rails" label="Rails" url="/platforms/ruby/guides/rails" /> | `gem "sentry-rails"` |
20+
| <LinkWithPlatformIcon platform="ruby.sidekiq" label="Sidekiq" url="/platforms/ruby/guides/sidekiq" /> | `gem "sentry-sidekiq"` |
21+
| <LinkWithPlatformIcon platform="ruby.delayed_job" label="Delayed Job" url="/platforms/ruby/guides/delayed_job/" /> | `gem "sentry-delayed_job"` |
22+
| <LinkWithPlatformIcon platform="ruby.resque" label="Resque" url="/platforms/ruby/guides/resque" /> | `gem "sentry-resque"` |
23+
| <LinkWithPlatformIcon platform="ruby.opentelemetry" label="OpenTelemetry" url="/platforms/ruby/tracing/instrumentation/opentelemetry" /> | `gem "sentry-opentelemetry"` |
24+
25+
## Patches
26+
27+
The following table lists all integrations available as patches and which ones are enabled by default.
28+
29+
You can use [`config.enabled_patches`](/platforms/ruby/configuration/options/#enabled-patches) to enable or disable them.
30+
31+
```ruby
32+
# enable :faraday patch
33+
config.enabled_patches << :faraday
34+
35+
# disable :puma patch
36+
config.enabled_patches.delete(:puma)
37+
```
38+
39+
| Patch | **Auto-enabled** |
40+
| ----------------------------|:----------------:|
41+
| `:http` ||
42+
| `:redis` ||
43+
| `:puma` ||
44+
| `:faraday` | |
45+
| `:graphql` | |
46+
47+
## Features
48+
49+
### Rails
50+
51+
The Rails integration is a feature rich integration that:
52+
53+
* captures Errors anywhere in your Rails application
54+
* creates Transactions for incoming HTTP Requests
55+
* records Spans in those Transactions for various important operations like:
56+
* database queries (performed with `activerecord`)
57+
* view renders
58+
59+
### Queues
60+
61+
The various Queue integrations for Sidekiq, Delayed Job and Resque create distributed traces connecting tasks that are performed in the background asynchronously.
62+
63+
The Rails integration also includes this functionality for `ActiveJob`.
64+
65+
### OpenTelemetry
66+
67+
The OpenTelemetry integration is used for exporting spans instrumented by an OpenTelemetry SDK into Sentry. See the [OpenTelemetry Setup](/platforms/ruby/tracing/instrumentation/opentelemetry) instructions for more details.
68+
69+
### HTTP Requests
70+
71+
Outgoing HTTP Requests are instrumented as Spans by the `:http` (for requests done with `Net::HTTP`) and `:faraday` patches.
72+
73+
### GraphQL
74+
75+
GraphQL operations are instrumented as Spans by the `:graphql` patch.
76+
77+
### Puma
78+
79+
The `:puma` patch captures low level exceptions outside your application stack.

platform-includes/enriching-events/breadcrumbs/breadcrumbs-example/ruby.mdx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,3 @@ crumb = Sentry::Breadcrumb.new(
66
)
77
Sentry.add_breadcrumb(crumb)
88
```
9-
10-
Appropriate places to inject Breadcrumbs may be places like your HTTP library:
11-
12-
```ruby
13-
# Instrumenting Faraday with a middleware:
14-
15-
class SentryFaradayMiddleware
16-
def call
17-
# Add a breadcrumb every time we complete an HTTP request
18-
@app.call(request_env).on_complete do |response_env|
19-
crumb = Sentry::Breadcrumb.new(
20-
data: { response_env: response_env },
21-
category: "faraday",
22-
message: "Completed request to #{request_env[:url]}"
23-
)
24-
Sentry.add_breadcrumb(crumb)
25-
end
26-
end
27-
end
28-
```

0 commit comments

Comments
 (0)