getsentry / getsentry/sentry-java

Micrometer OpenTelemetry support

Đang mở
#3,474 18 bình luận 0 reaction 1 người được giao Được @adinauer nhận Xem trên GitHub
Feature Java Spans
Ngôn ngữ chính
Kotlin
Star
1.4k
Fork
478
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
67

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.