Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikspang authored Oct 10, 2024
2 parents 0367db9 + 9d3a7be commit 313e913
Show file tree
Hide file tree
Showing 220 changed files with 2,257 additions and 307 deletions.
1 change: 1 addition & 0 deletions .github/workflows/sentry_ruby_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
working-directory: sentry-ruby
name: Ruby ${{ matrix.ruby_version }} & Rack ${{ matrix.rack_version }}, options - ${{ toJson(matrix.options) }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ Gemfile.lock
.ruby-gemset
.idea
*.rdb
.rgignore

examples/**/node_modules
10 changes: 10 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ inherit_gem:
Layout/SpaceInsideArrayLiteralBrackets:
Enabled: false

Layout/EmptyLineAfterMagicComment:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: true

Style/RedundantFreeze:
Enabled: true

AllCops:
Exclude:
- "sentry-raven/**/*"
- "sentry-*/tmp/**/*"
- "sentry-*/examples/**/*"
55 changes: 53 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,61 @@
## Unreleased

### Features

- Add support for Sentry Cache instrumentation, when using Rails.cache ([#2380](https://github.com/getsentry/sentry-ruby/pull/2380))

## 5.21.0

### Features

- Add support for $SENTRY_DEBUG and $SENTRY_SPOTLIGHT ([#2374](https://github.com/getsentry/sentry-ruby/pull/2374))
- Experimental support for multi-threaded profiling using [Vernier](https://github.com/jhawthorn/vernier) ([#2372](https://github.com/getsentry/sentry-ruby/pull/2372))

You can have much better profiles if you're using multi-threaded servers like Puma now by leveraging Vernier.
To use it, first add `vernier` to your `Gemfile` and make sure it is loaded before `sentry-ruby`.

```ruby
# Gemfile

gem 'vernier'
gem 'sentry-ruby'
```

Then, set a `profiles_sample_rate` and the new `profiler_class` configuration in your sentry initializer to use the new profiler.

```ruby
# config/initializers/sentry.rb
Sentry.init do |config|
# ...
config.profiles_sample_rate = 1.0
config.profiler_class = Sentry::Vernier::Profiler
end
```

### Internal

- Profile items have bigger size limit now ([#2421](https://github.com/getsentry/sentry-ruby/pull/2421))
- Consistent string freezing ([#2422](https://github.com/getsentry/sentry-ruby/pull/2422))

## 5.20.1

### Bug Fixes

- Skip `rubocop.yml` in `spec.files` ([#2420](https://github.com/getsentry/sentry-ruby/pull/2420))

## 5.20.0

- Add support for `$SENTRY_DEBUG` and `$SENTRY_SPOTLIGHT` ([#2374](https://github.com/getsentry/sentry-ruby/pull/2374))
- Support human readable intervals in `sidekiq-cron` ([#2387](https://github.com/getsentry/sentry-ruby/pull/2387))
- Add support for Sentry Cache instrumentation, when using Rails.cache ([#2380](https://github.com/getsentry/sentry-ruby/pull/2380))
- Set default app dirs pattern ([#2390](https://github.com/getsentry/sentry-ruby/pull/2390))
- Add new `strip_backtrace_load_path` boolean config (default true) to enable disabling load path stripping ([#2409](https://github.com/getsentry/sentry-ruby/pull/2409))

### Bug Fixes

- Fix error events missing a DSC when there's an active span ([#2408](https://github.com/getsentry/sentry-ruby/pull/2408))
- Verifies presence of client before adding a breadcrumb ([#2394](https://github.com/getsentry/sentry-ruby/pull/2394))
- Fix `Net:HTTP` integration for non-ASCII URI's ([#2417](https://github.com/getsentry/sentry-ruby/pull/2417))
- Prevent Hub from having nil scope and client ([#2402](https://github.com/getsentry/sentry-ruby/pull/2402))

## 5.19.0

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
git_source(:github) { |name| "https://github.com/#{name}.git" }

Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
git_source(:github) { |name| "https://github.com/#{name}.git" }

Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

Expand Down
1 change: 1 addition & 0 deletions sentry-delayed_job/bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "sentry/ruby"
Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/example/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "rails"
Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/example/app.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_job"
require "active_record"
require "delayed_job"
Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/lib/sentry-delayed_job.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "delayed_job"
require "sentry-ruby"
require "sentry/integrable"
Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/lib/sentry/delayed_job/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Sentry
class Configuration
attr_reader :delayed_job
Expand Down
4 changes: 3 additions & 1 deletion sentry-delayed_job/lib/sentry/delayed_job/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

module Sentry
module DelayedJob
VERSION = "5.19.0"
VERSION = "5.21.0"
end
end
6 changes: 4 additions & 2 deletions sentry-delayed_job/sentry-delayed_job.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "lib/sentry/delayed_job/version"

Gem::Specification.new do |spec|
Expand All @@ -11,7 +13,7 @@ Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY
spec.required_ruby_version = '>= 2.4'
spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples|\.rubocop\.yml)'`.split("\n")

github_root_uri = 'https://github.com/getsentry/sentry-ruby'
spec.homepage = "#{github_root_uri}/tree/#{spec.version}/#{spec.name}"
Expand All @@ -28,6 +30,6 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "sentry-ruby", "~> 5.19.0"
spec.add_dependency "sentry-ruby", "~> 5.21.0"
spec.add_dependency "delayed_job", ">= 4.0"
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

RSpec.describe Sentry::DelayedJob::Configuration do
Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/spec/sentry/delayed_job_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

RSpec.describe Sentry::DelayedJob do
Expand Down
2 changes: 2 additions & 0 deletions sentry-delayed_job/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/setup"
begin
require "debug/prelude"
Expand Down
2 changes: 2 additions & 0 deletions sentry-opentelemetry/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
git_source(:github) { |name| "https://github.com/#{name}.git" }

Expand Down
2 changes: 2 additions & 0 deletions sentry-opentelemetry/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

Expand Down
2 changes: 1 addition & 1 deletion sentry-opentelemetry/lib/sentry/opentelemetry/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Sentry
module OpenTelemetry
VERSION = "5.19.0"
VERSION = "5.21.0"
end
end
4 changes: 2 additions & 2 deletions sentry-opentelemetry/sentry-opentelemetry.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY
spec.required_ruby_version = '>= 2.4'
spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples|\.rubocop\.yml)'`.split("\n")

github_root_uri = 'https://github.com/getsentry/sentry-ruby'
spec.homepage = "#{github_root_uri}/tree/#{spec.version}/#{spec.name}"
Expand All @@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "sentry-ruby", "~> 5.19.0"
spec.add_dependency "sentry-ruby", "~> 5.21.0"
spec.add_dependency "opentelemetry-sdk", "~> 1.0"
end
2 changes: 2 additions & 0 deletions sentry-rails/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
git_source(:github) { |name| "https://github.com/#{name}.git" }

Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/app/jobs/sentry/send_event_job.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

if defined?(ActiveJob)
module Sentry
parent_job =
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/benchmarks/allocation_comparison.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'benchmark/memory'
require "sentry-ruby"
require "sentry/benchmarks/benchmark_transport"
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/benchmarks/allocation_report.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'benchmark/ipsa'
require "sentry-ruby"
require "sentry/benchmarks/benchmark_transport"
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/benchmarks/application.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/all"
require "action_controller"
require_relative "../spec/support/test_rails_app/app"
Expand Down
1 change: 1 addition & 0 deletions sentry-rails/bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "sentry/ruby"
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/lib/generators/sentry_generator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rails/generators/base"

class SentryGenerator < ::Rails::Generators::Base
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/lib/sentry-rails.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

require "sentry/rails/version"
require "sentry/rails"
2 changes: 2 additions & 0 deletions sentry-rails/lib/sentry/rails.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rails"
require "sentry-ruby"
require "sentry/integrable"
Expand Down
4 changes: 3 additions & 1 deletion sentry-rails/lib/sentry/rails/action_cable.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

module Sentry
module Rails
module ActionCableExtensions
class ErrorHandler
OP_NAME = "websocket.server".freeze
OP_NAME = "websocket.server"
SPAN_ORIGIN = "auto.http.rails.actioncable"

class << self
Expand Down
6 changes: 4 additions & 2 deletions sentry-rails/lib/sentry/rails/active_job.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Sentry
module Rails
module ActiveJobExtensions
Expand All @@ -16,8 +18,8 @@ def already_supported_by_sentry_integration?
end

class SentryReporter
OP_NAME = "queue.active_job".freeze
SPAN_ORIGIN = "auto.queue.active_job".freeze
OP_NAME = "queue.active_job"
SPAN_ORIGIN = "auto.queue.active_job"

class << self
def record(job, &block)
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/lib/sentry/rails/background_worker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Sentry
class BackgroundWorker
def _perform(&block)
Expand Down
6 changes: 4 additions & 2 deletions sentry-rails/lib/sentry/rails/backtrace_cleaner.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

require "active_support/backtrace_cleaner"
require "active_support/core_ext/string/access"

module Sentry
module Rails
class BacktraceCleaner < ActiveSupport::BacktraceCleaner
APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/.freeze
RENDER_TEMPLATE_PATTERN = /:in `.*_\w+_{2,3}\d+_\d+'/.freeze
APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/
RENDER_TEMPLATE_PATTERN = /:in `.*_\w+_{2,3}\d+_\d+'/

def initialize
super
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Sentry
module Rails
module Breadcrumb
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "sentry/rails/instrument_payload_cleanup_helper"

module Sentry
Expand Down
6 changes: 4 additions & 2 deletions sentry-rails/lib/sentry/rails/capture_exceptions.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

module Sentry
module Rails
class CaptureExceptions < Sentry::Rack::CaptureExceptions
RAILS_7_1 = Gem::Version.new(::Rails.version) >= Gem::Version.new("7.1.0.alpha")
SPAN_ORIGIN = "auto.http.rails".freeze
SPAN_ORIGIN = "auto.http.rails"

def initialize(_)
super
Expand All @@ -20,7 +22,7 @@ def collect_exception(env)
end

def transaction_op
"http.server".freeze
"http.server"
end

def capture_exception(exception, env)
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/lib/sentry/rails/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "sentry/rails/tracing/action_controller_subscriber"
require "sentry/rails/tracing/action_view_subscriber"
require "sentry/rails/tracing/active_record_subscriber"
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/lib/sentry/rails/controller_methods.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Sentry
module Rails
module ControllerMethods
Expand Down
4 changes: 3 additions & 1 deletion sentry-rails/lib/sentry/rails/controller_transaction.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

module Sentry
module Rails
module ControllerTransaction
SPAN_ORIGIN = "auto.view.rails".freeze
SPAN_ORIGIN = "auto.view.rails"

def self.included(base)
base.prepend_around_action(:sentry_around_action)
Expand Down
Loading

0 comments on commit 313e913

Please sign in to comment.