Skip to content

Commit

Permalink
Merge branch 'master' into attempt_threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic authored Jan 2, 2025
2 parents 2181e70 + 7fe7f88 commit 536166e
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_batch_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
name: Build gems
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
ruby-version: 3.4
- name: Build gem source
run: ruby .scripts/batch_build.rb
- name: Archive Artifacts
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.4
- name: Capture sdk name
uses: actions-ecosystem/action-regex-match@v2
id: regex-match
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
ruby-version: "3.4"
bundler-cache: true
- name: Run rubocop
run: bundle exec rubocop
2 changes: 1 addition & 1 deletion .github/workflows/prepare_batch_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
token: ${{ steps.token.outputs.token }}
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare_raven_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
token: ${{ steps.token.outputs.token }}
fetch-depth: 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sentry_delayed_job_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- { ruby_version: "head" }
- { ruby_version: 'jruby-head' }
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Install sqlite
run: |
# See https://github.community/t5/GitHub-Actions/ubuntu-latest-Apt-repository-list-issues/td-p/41122/page/2
Expand All @@ -68,6 +68,6 @@ jobs:

- name: Upload Coverage
if: ${{ matrix.options.codecov }}
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/sentry_opentelemetry_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
exclude:
- { ruby_version: 'jruby-head' }
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
Expand All @@ -58,6 +58,6 @@ jobs:
run: bundle exec rake

- name: Upload Coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflows/sentry_rails_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ jobs:
- { ruby_version: "3.1", rails_version: 7.2.0 }
- { ruby_version: "3.2", rails_version: 7.2.0 }
- { ruby_version: "3.3", rails_version: 7.2.0 }
- { ruby_version: "3.4", rails_version: 7.2.0 }
- { ruby_version: "3.2", rails_version: "8.0.0" }
- { ruby_version: "3.3", rails_version: "8.0.0" }
- { ruby_version: "3.4", rails_version: "8.0.0" }
- { ruby_version: "jruby", rails_version: 6.1.0 }
- {
ruby_version: "3.2",
Expand All @@ -67,7 +69,7 @@ jobs:
rails_version: 7.1.0
}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Install sqlite and ImageMagick
run: |
# See https://github.community/t5/GitHub-Actions/ubuntu-latest-Apt-repository-list-issues/td-p/41122/page/2
Expand All @@ -84,6 +86,6 @@ jobs:
run: bundle exec rake

- name: Upload Coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/sentry_raven_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
rails_version: 6.0.0

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sentry_resque_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
exclude:
- { ruby_version: 'jruby-head' }
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
with:
Expand All @@ -67,6 +67,6 @@ jobs:
run: bundle exec rake

- name: Upload Coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
9 changes: 7 additions & 2 deletions .github/workflows/sentry_ruby_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ jobs:
rack_version: 3.1,
redis_rb_version: 5.3
}
- {
ruby_version: 3.4,
rack_version: 3.1,
redis_rb_version: 5.3
}
exclude:
- { ruby_version: 'jruby-head' }
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
Expand All @@ -79,6 +84,6 @@ jobs:
run: bundle exec rake

- name: Upload Coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
13 changes: 6 additions & 7 deletions .github/workflows/sentry_sidekiq_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fail-fast: false
matrix:
sidekiq_version: ["5.0", "6.5", "7.0"]
ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3", jruby]
ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4", jruby]
include:
- { ruby_version: 2.4, sidekiq_version: 5.0 }
- { ruby_version: 2.5, sidekiq_version: 5.0 }
Expand All @@ -46,12 +46,11 @@ jobs:
rubyopt: "--enable-frozen-string-literal --debug=frozen-string-literal",
},
}
- {
ruby_version: "3.2",
sidekiq_version: 7.0
}
- { ruby_version: "3.2", sidekiq_version: 7.0 }
- { ruby_version: "3.3", sidekiq_version: 7.0 }
- { ruby_version: "3.4", sidekiq_version: 7.0 }
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
Expand All @@ -70,6 +69,6 @@ jobs:
run: bundle exec rake

- name: Upload Coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

- Improve the accuracy of duration calculations in cron jobs monitoring ([#2471](https://github.com/getsentry/sentry-ruby/pull/2471))
- Use attempt_threshold to skip reporting on first N attempts ([#2503](https://github.com/getsentry/sentry-ruby/pull/2503))
- Support `code.namespace` for Ruby 3.4+ stacktraces ([#2506](https://github.com/getsentry/sentry-ruby/pull/2506))

### Bug fixes

- Default to `internal_error` error type for OpenTelemetry spans [#2473](https://github.com/getsentry/sentry-ruby/pull/2473)

### Internal

- Test Ruby 3.4 in CI ([#2506](https://github.com/getsentry/sentry-ruby/pull/2506))
- Upgrade actions workflows versions ([#2506](https://github.com/getsentry/sentry-ruby/pull/2506))

## 5.22.1

### Bug Fixes
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ You can contribute to this project in the following ways:

And if you have any questions, please feel free to reach out on [Discord].

## Develop This Project With Multi-root Workspaces

If you use editors that support [VS Code-style multi-root workspaces](https://code.visualstudio.com/docs/editor/multi-root-workspaces),
such as VS Code, Cursor...etc., opening the editor with `sentry-ruby.code-workspace` file will provide a better development experience.

## Contribute To Individual Gems

- Install the dependencies of a specific gem by running `bundle` in it's subdirectory. I.e:
Expand Down
2 changes: 1 addition & 1 deletion sentry-rails/lib/sentry/rails/backtrace_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Sentry
module Rails
class BacktraceCleaner < ActiveSupport::BacktraceCleaner
APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/
RENDER_TEMPLATE_PATTERN = /:in `.*_\w+_{2,3}\d+_\d+'/
RENDER_TEMPLATE_PATTERN = /:in (?:`|').*_\w+_{2,3}\d+_\d+'/

def initialize
super
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def subscribe!

if source_location
backtrace_line = Sentry::Backtrace::Line.parse(source_location)

span.set_data(Span::DataConventions::FILEPATH, backtrace_line.file) if backtrace_line.file
span.set_data(Span::DataConventions::LINENO, backtrace_line.number) if backtrace_line.number
span.set_data(Span::DataConventions::FUNCTION, backtrace_line.method) if backtrace_line.method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def foo
Post.all.to_a
end
query_line = __LINE__ - 2
rspec_class = self.name # RSpec::ExampleGroups::[....]

before do
transaction = Sentry::Transaction.new(sampled: true, hub: Sentry.get_current_hub)
Expand Down Expand Up @@ -94,6 +95,7 @@ def foo
data = span[:data]
expect(data["code.filepath"]).to eq(__FILE__)
expect(data["code.lineno"]).to eq(query_line)
expect(data["code.namespace"]).to eq(rspec_class) if RUBY_VERSION.to_f >= 3.4
expect(data["code.function"]).to eq("foo")
end
end
Expand Down
30 changes: 30 additions & 0 deletions sentry-ruby.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"folders": [
{
"path": "sentry-ruby"
},
{
"path": "sentry-rails"
},
{
"path": "sentry-sidekiq"
},
{
"path": "sentry-delayed_job"
},
{
"path": "sentry-resque"
},
{
"path": "sentry-opentelemetry"
},
{
"path": ".github"
}
],
"extensions": {
"recommendations": [
"Shopify.ruby-lsp"
]
}
}
7 changes: 4 additions & 3 deletions sentry-ruby/lib/sentry/backtrace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Line
RUBY_INPUT_FORMAT = /
^ \s* (?: [a-zA-Z]: | uri:classloader: )? ([^:]+ | <.*>):
(\d+)
(?: :in\s('|`)([^']+)')?$
(?: :in\s('|`)(?:([\w:]+)\#)?([^']+)')?$
/x

# org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
Expand All @@ -37,10 +37,11 @@ class Line
# @return [Line] The parsed backtrace line
def self.parse(unparsed_line, in_app_pattern = nil)
ruby_match = unparsed_line.match(RUBY_INPUT_FORMAT)

if ruby_match
_, file, number, _, method = ruby_match.to_a
_, file, number, _, module_name, method = ruby_match.to_a
file.sub!(/\.class$/, RB_EXTENSION)
module_name = nil
module_name = module_name
else
java_match = unparsed_line.match(JAVA_INPUT_FORMAT)
_, module_name, method, file, number = java_match.to_a
Expand Down

0 comments on commit 536166e

Please sign in to comment.