Use SecureRandom for Trace/Span ID generation, remove usage of SecureRandom.getStrongInstance#3379
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f01c0cda9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…Random.getStrongInstance
1f01c0c to
ecc8f56
Compare
kikoveiga
approved these changes
Apr 17, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3379 +/- ##
===========================================
- Coverage 72.01% 72.01% -0.01%
===========================================
Files 956 956
Lines 35307 35307
Branches 5862 5861 -1
===========================================
- Hits 25426 25424 -2
- Misses 8271 8277 +6
+ Partials 1610 1606 -4
🚀 New features to boost your workflow:
|
mariusc83
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR does the two things:
Use
SecureRandomforDatadogTracingIt fixes the regression when we pulled
dd-trace-java. In RUMM-233 + #141 we switched toSecureRandom, but during the latest pull ofdd-trace-javawe enabled its usage only for Otel, seedd-sdk-android/features/dd-sdk-android-trace-otel/src/main/kotlin/com/datadog/android/trace/opentelemetry/OtelTracerProvider.kt
Line 103 in e293f09
and later down the call chain
dd-sdk-android/features/dd-sdk-android-trace/src/main/kotlin/com/datadog/android/trace/internal/DatadogTracerBuilderAdapter.kt
Line 87 in e293f09
Small change in
Config.javaactivatesSecureRandomby default.Remove
SecureRandom#getInstanceStrongusageSecureRandom#getInstanceStrong() returns the generator which calls
/dev/randomand if there is not enough entropy any call to generate a random number will block until there is enough entropy.Default constructor though is using
/dev/urandomwhich doesn't block if there is not enough entropy. This is okay for our needs to generate ID. We are not using plainRandombecause it is using a timestamp as a seed, so span generated on two different devices at the same instant may have same ID.The change is aligned with iOS generator, which is using SystemRandomNumberGenerator
At least on Linux systems it also calls
/dev/urandomand not/dev/random.Review checklist (to be filled by reviewers)