getsentry / getsentry/sentry-java

Micrometer OpenTelemetry support

オープン
#3,474 コメント 18 件 リアクション 0 件 担当者 1 名 @adinauer が担当を希望しています GitHub で見る
Feature Java Spans
主要言語
Kotlin
スター
1.4k
フォーク
478
平均マージ
2日 23時間
マージ済み PR(30日)
67

説明

### Integration

sentry-spring-jakarta

### Java Version

17

### Version

7.8.0

### Steps to Reproduce

While profiling some reactive code using project Reactor with automatic context propagation and Sentry, I noticed quite a lot of time is spent instantiating `SecureRandom` objects as the `SentryReactorThreadLocalAccessor.getValue` call will always cause a new `TracesSampler` thus a new `SecureRandom` object to be created when `hub == null || hub instanceof NoOpHub` in `Sentry#getCurrentHub`.

SecureRandom objects are said to be thread-safe by the javadoc, would it be possible/safe to just reuse the same instance? Or reuse the TracesSampler? Or avoid cloning the NoOpHub alltogether..?

### Expected Result

Not so much time spent creating SecureRandom objects

### Actual Result

Screenshot of profiling results:

Screenshot 2024-06-11 at 21 17 17

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。