Skip to content
Open
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
86 changes: 71 additions & 15 deletions docs/platforms/ruby/common/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,101 @@

<PlatformContent includePath="alert-using-a-framework" noGuides />

## Prerequisites
<PlatformContent includePath="getting-started-prerequisites" />

- You need a Sentry [account](https://sentry.io/signup/) and [project](/product/projects/)
- Ruby 2.4+ or any of the most recent JRuby versions
<StepConnector selector="h2" showNumbers={true}>

## Features
## Install

<PlatformSection supported={["ruby", "ruby.rails"]}>

Installing the Sentry SDK enables core features such as **Error Monitoring**, **Logs**, and **Application Metrics** by default. We'll show you how to send logs and metrics in [Verify Your Setup](#verify-your-setup).

</PlatformSection>

In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/profiling/).
<PlatformSection notSupported={["ruby","ruby.rails"]}>

Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
Installing the Sentry SDK enables core features such as **Error Monitoring** and **Application Metrics** by default. We'll show you how to send metrics in [Verify Your Setup](#verify-your-setup).

</PlatformSection>

Choose additional features you want to configure, and this guide will show you how to get set up:

<OnboardingOptionButtons
options={["error-monitoring", "performance", "profiling", "logs"]}
options={["error-monitoring", "performance", "profiling"]}
/>

## Install
<Include name="quick-start-features-expandable" />

### Install the Sentry SDK

<PlatformContent includePath="getting-started-install" />

## Configure

### Initialize the Sentry SDK
Configuration should happen as early as possible in your application's lifecycle.

<PlatformContent includePath="getting-started-config" />

## Verify
### Control the Data You Send to Sentry (Optional)

This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.
<SplitLayout>
<SplitSection>
<SplitSectionText>

<PlatformContent includePath="getting-started-verify" />
By default, the SDK sends user identity data (IP address, ID, and similar) and other data like HTTP bodies and URL query parameters. This will give you rich debugging context.

The SDK always filters sensitive values whose keys match a built-in denylist, such as `auth` or `password`, and sends `[Filtered]` instead.

To send less data, turn off the categories you don't need in the dataCollection option. For the full list of categories and their defaults, <PlatformLink to="/configuration/options/#data_collection">see the `dataCollection` options</PlatformLink>.

</SplitSectionText>
<SplitSectionCode>

```ruby
require 'sentry-ruby'

<Alert>
Sentry.init do |config|
config.dsn = '___PUBLIC_DSN___'

Learn more about manually capturing an error or message in our <PlatformLink to="/usage/">Usage documentation</PlatformLink>.
config.data_collection.user_info = false
config.data_collection.http_bodies = []
# other categories
end
```

</Alert>
</SplitSectionCode>
</SplitSection>
</SplitLayout>

To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
## Verify Your Setup

Let's test your setup and confirm that data reaches your Sentry project.

<PlatformContent includePath="getting-started-verify" />

### View Captured Data in Sentry

Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear).

<Include name="quick-start-locate-data-expandable" />

## Next Steps

At this point, you should have integrated Sentry into your application and should already be sending data to your Sentry project.

Now's a good time to customize your setup and look into more advanced topics.
Our next recommended steps for you are:

- Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup
- Continue to <PlatformLink to="/configuration/">customize your configuration</PlatformLink>

<Expandable permalink={false} title="Are you having problems setting up the SDK?">

- Find various topics in <PlatformLink to="/troubleshooting/">Troubleshooting</PlatformLink>
- [Get support](https://www.sentry.help/en/)

</Expandable>

</StepConnector>
1 change: 1 addition & 0 deletions docs/platforms/ruby/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
title: Ruby
description: Learn how to set up Sentry in your Ruby app, capture your first errors and traces, and view them in Sentry.
caseStyle: snake_case
supportLevel: production
sdk: "sentry.ruby"
1 change: 1 addition & 0 deletions docs/platforms/ruby/guides/delayed_job/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
title: DelayedJob
description: Learn how to set up Sentry in your app, capture your first errors and traces, and view them in Sentry.
sdk: "sentry.ruby.delayed_job"
1 change: 1 addition & 0 deletions docs/platforms/ruby/guides/rack/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title: Rack Middleware
description: Learn how to set up Sentry in your app, capture your first errors and traces, and view them in Sentry.
1 change: 1 addition & 0 deletions docs/platforms/ruby/guides/rails/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
title: Rails
description: Learn how to set up Sentry in your Ruby on Rails app, capture your first errors and traces, and view them in Sentry.
sdk: "sentry.ruby.rails"
1 change: 1 addition & 0 deletions docs/platforms/ruby/guides/resque/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
title: Resque
description: Learn how to set up Sentry in your app, capture your first errors and traces, and view them in Sentry.
sdk: "sentry.ruby.resque"
1 change: 1 addition & 0 deletions docs/platforms/ruby/guides/sidekiq/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
title: Sidekiq
description: Learn how to set up Sentry in your app, capture your first errors and traces, and view them in Sentry.
sdk: "sentry.ruby.sidekiq"
18 changes: 18 additions & 0 deletions includes/quick-start-features-expandable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,22 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo";

</PlatformSection>

<PlatformSection supported={["ruby", "ruby.rails"]}>

<FeatureInfo
features={["issues", "tracing", "profiling", "logs", "metrics"]}
type="learnMore"
/>

</PlatformSection>

<PlatformSection supported={["ruby.delayed_job", "ruby.resque", "ruby.sidekiq", "ruby.rack"]}>

<FeatureInfo
features={["issues", "tracing", "profiling", "metrics"]}
type="learnMore"
/>

</PlatformSection>

</Expandable>
18 changes: 18 additions & 0 deletions includes/quick-start-locate-data-expandable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,22 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo";

</PlatformSection>

<PlatformSection supported={["ruby", "ruby.rails"]}>

<FeatureInfo
features={["issues", "tracing", "profiling", "logs", "metrics"]}
type="findInSentry"
/>

</PlatformSection>

<PlatformSection supported={["ruby.delayed_job", "ruby.resque", "ruby.sidekiq", "ruby.rack"]}>

<FeatureInfo
features={["issues", "tracing", "profiling", "metrics"]}
type="findInSentry"
/>

</PlatformSection>

</Expandable>
35 changes: 25 additions & 10 deletions platform-includes/getting-started-config/ruby.mdx
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
<SplitLayout>
<SplitSection>
<SplitSectionText>

Import and initialize the SDK in your app's entry point:

</SplitSectionText>
<SplitSectionCode>


```ruby
require 'sentry-ruby'

Sentry.init do |config|
config.dsn = '___PUBLIC_DSN___'

# get breadcrumbs from logs
# Get breadcrumbs from logs
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#breadcrumbs_logger
config.breadcrumbs_logger = [:sentry_logger, :http_logger]

# To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
# https://docs.sentry.io/platforms/ruby/configuration/options/#data_collection
# config.data_collection.user_info = false
# config.data_collection.http_bodies = []
# ___PRODUCT_OPTION_START___ performance

# enable tracing
# we recommend adjusting this value in production
# Set tracesSampleRate to 1.0 to capture 100%
# of transactions for tracing.
# We recommend adjusting this value in production
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#traces_sample_rate
config.traces_sample_rate = 1.0
# ___PRODUCT_OPTION_END___ performance
# ___PRODUCT_OPTION_START___ profiling

# enable profiling
# this is relative to traces_sample_rate
# Enable profiling for a percentage of sessions relative to traces_sample_rate.
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#profiles_sample_rate
config.profiles_sample_rate = 1.0
# ___PRODUCT_OPTION_END___ profiling
end
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>
73 changes: 46 additions & 27 deletions platform-includes/getting-started-config/ruby.rack.mdx
Original file line number Diff line number Diff line change
@@ -1,69 +1,84 @@
### With Rackup
#### With Rackup

Add `use Sentry::Rack::CaptureExceptions` to your `config.ru` or other rackup file:
<SplitLayout>
<SplitSection>
<SplitSectionText>

Import and initialize the SDK and add `use Sentry::Rack::CaptureExceptions` to your `config.ru` or other rackup file:

</SplitSectionText>
<SplitSectionCode>

```ruby {filename:config.ru}
require 'sentry-ruby'

Sentry.init do |config|
config.dsn = '___PUBLIC_DSN___'

# get breadcrumbs from logs
# Get breadcrumbs from logs
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#breadcrumbs_logger
config.breadcrumbs_logger = [:sentry_logger, :http_logger]

# To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
# https://docs.sentry.io/platforms/ruby/configuration/options/#data_collection
# config.data_collection.user_info = false
# config.data_collection.http_bodies = []
# ___PRODUCT_OPTION_START___ performance

# enable tracing
# we recommend adjusting this value in production
# Set tracesSampleRate to 1.0 to capture 100%
# of transactions for tracing.
# We recommend adjusting this value in production
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#traces_sample_rate
config.traces_sample_rate = 1.0
# ___PRODUCT_OPTION_END___ performance
# ___PRODUCT_OPTION_START___ profiling

# enable profiling
# this is relative to traces_sample_rate
# Enable profiling for a percentage of sessions relative to traces_sample_rate.
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#profiles_sample_rate
config.profiles_sample_rate = 1.0
# ___PRODUCT_OPTION_END___ profiling
end

use Sentry::Rack::CaptureExceptions
```

### Without Rackup
</SplitSectionCode>
</SplitSection>
</SplitLayout>

<Alert level="warning">
#### Without Rackup

If you're not using Rackup to run your app, then Sentry initialization code **must**
be placed before your code requires Sinatra:
<SplitLayout>
<SplitSection>
<SplitSectionText>

</Alert>
If you're not using Rackup to run your app, you have to place Sentry's initialization code **before** your code requires Sinatra:

</SplitSectionText>
<SplitSectionCode>

```ruby {filename:app.rb}
require 'sentry-ruby'

Sentry.init do |config|
config.dsn = '___PUBLIC_DSN___'

# get breadcrumbs from logs
# Get breadcrumbs from logs
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#breadcrumbs_logger
config.breadcrumbs_logger = [:sentry_logger, :http_logger]

# To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
# https://docs.sentry.io/platforms/ruby/configuration/options/#data_collection
# config.data_collection.user_info = false
# config.data_collection.http_bodies = []
# ___PRODUCT_OPTION_START___ performance

# enable tracing
# we recommend adjusting this value in production
# Set tracesSampleRate to 1.0 to capture 100%
# of transactions for tracing.
# We recommend adjusting this value in production
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#traces_sample_rate
config.traces_sample_rate = 1.0
# ___PRODUCT_OPTION_END___ performance
# ___PRODUCT_OPTION_START___ profiling

# enable profiling
# this is relative to traces_sample_rate
# Enable profiling for a percentage of sessions relative to traces_sample_rate.
# Learn more at
# https://docs.sentry.io/platforms/ruby/configuration/options/#profiles_sample_rate
config.profiles_sample_rate = 1.0
# ___PRODUCT_OPTION_END___ profiling
end
Expand All @@ -76,3 +91,7 @@ get "/" do
raise "foo"
end
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>
Loading
Loading