RUM-13441: [Cronet] Migrating okHttp to new instrumentation API#3180
RUM-13441: [Cronet] Migrating okHttp to new instrumentation API#3180
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57939dbb75
ℹ️ 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".
8f048a3 to
91ec6c5
Compare
57939db to
404f86e
Compare
cb8e557 to
62046e7
Compare
d4a5e23 to
f3b2a1e
Compare
404f86e to
bc7f3d2
Compare
bc7f3d2 to
9e872b7
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e872b76aa
ℹ️ 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".
9e872b7 to
175ce9d
Compare
|
@codex review |
175ce9d to
3e13750
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 175ce9ddbf
ℹ️ 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".
3e13750 to
c200358
Compare
This comment has been minimized.
This comment has been minimized.
c200358 to
daf6d71
Compare
09b1282 to
2a39a00
Compare
| registry: RequestTracingStateRegistry, | ||
| rumNetworkInstrumentation: RumNetworkInstrumentation? | ||
| ) { | ||
| val userEventListenerFactory: EventListener.Factory = build().eventListenerFactory |
There was a problem hiding this comment.
This means that we will build OkHttpClient twice? OkHttpClient.Builder.build() here and then somewhere else as well? Won't it leak resources with such throwaway OkHttpClient?
There was a problem hiding this comment.
Yep, this is the trade-off we have to pay for the convenience of the public API we provide for the user.
The alternatives is less stable imo, as there is only two options:
- Reflection-based approach
- Overriding the customer's event listener with a separate method in the
OkHttpIntegrationPlugin
I believe this approach is way less impactful.
Regarding the resources - as builded client will be never used - I guess we are safe
2a39a00 to
c562706
Compare
|
|
||
| private fun OkHttpClient.Builder.withMethodUrlAndBodyReplacementInterceptor( | ||
| url: String, | ||
| body: okhttp3.RequestBody |
There was a problem hiding this comment.
very nit
| body: okhttp3.RequestBody | |
| body: RequestBody |
| @ExperimentalRumApi | ||
| @ExperimentalTraceApi | ||
| @Suppress("PackageNameVisibility") | ||
| internal fun OkHttpClient.Builder.configureDatadogInstrumentation( |
There was a problem hiding this comment.
e: file:...dd-sdk-android/sample/kotlin/src/main/kotlin/com/datadog/android/sample/SampleApplication.kt:104:10 Cannot access 'configureDatadogInstrumentation': it is internal in 'com.datadog.android.okhttp'
What does this PR do?
OkHttpinstrumentation to the new networking-library agnostic approach.DatadogInterceptor/TracingInterceptor/DatadogEventListenerapproach (all classes kept for the backward compatibility)
with a single unified entry point:
same as for Cronet
Motivation
Review checklist (to be filled by reviewers)