getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
927 stars 486 forks source link

Use Concurrent.usable_processor_count when it is available #2339

Closed st0012 closed 3 weeks ago

st0012 commented 4 weeks ago

It's a new API introduced in concurrent-ruby 1.3.1, which works better in the container environment.

https://github.com/ruby-concurrency/concurrent-ruby/pull/1038

Since there are gems like sorbet-runtime that still use older versions of concurrent-ruby, we can't directly bump concurrent-ruby's requirement, but need to check if the method is available before calling it.

Big thanks to @trevorturk for proposing this idea.

codecov[bot] commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.65%. Comparing base (8e62859) to head (adb69d2).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2339 +/- ## ========================================== - Coverage 98.66% 98.65% -0.01% ========================================== Files 205 205 Lines 13479 13483 +4 ========================================== + Hits 13299 13302 +3 - Misses 180 181 +1 ``` | [Components](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [sentry-ruby](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `99.02% <85.71%> (-0.01%)` | :arrow_down: | | [sentry-rails](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `97.41% <ø> (ø)` | | | [sentry-sidekiq](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `97.01% <ø> (ø)` | | | [sentry-resque](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `96.79% <ø> (ø)` | | | [sentry-delayed_job](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `98.92% <ø> (ø)` | | | [sentry-opentelemetry](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `100.00% <ø> (ø)` | | | [Files](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [sentry-ruby/spec/sentry/configuration\_spec.rb](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339?src=pr&el=tree&filepath=sentry-ruby%2Fspec%2Fsentry%2Fconfiguration_spec.rb&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5LXJ1Ynkvc3BlYy9zZW50cnkvY29uZmlndXJhdGlvbl9zcGVjLnJi) | `100.00% <100.00%> (ø)` | | | [sentry-ruby/lib/sentry/configuration.rb](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2339?src=pr&el=tree&filepath=sentry-ruby%2Flib%2Fsentry%2Fconfiguration.rb&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5LXJ1YnkvbGliL3NlbnRyeS9jb25maWd1cmF0aW9uLnJi) | `98.42% <80.00%> (-0.38%)` | :arrow_down: |
trevorturk commented 4 weeks ago

Nice, thanks! I wonder if we should move that / 2.0 into the new helper method since we can (hopefully) trust the new container version to do the right thing? Either way looks good enough. Thank you!

sl0thentr0py commented 3 weeks ago

ty both!