Skip to content

RUMM-3051: Remove okhttp3.internal package usage#1288

Merged
0xnm merged 1 commit into
developfrom
nogorodnikov/rumm-3051/remove-usage-of-okhttp3-internal-package
Feb 20, 2023
Merged

RUMM-3051: Remove okhttp3.internal package usage#1288
0xnm merged 1 commit into
developfrom
nogorodnikov/rumm-3051/remove-usage-of-okhttp3-internal-package

Conversation

@0xnm

@0xnm 0xnm commented Feb 17, 2023

Copy link
Copy Markdown
Member

What does this PR do?

Fixes #1282. This PR removes okhttp3.internal package usage, we were using okhttp3.internal.Util.EMPTY_REQUEST.

There is a warning about okhttp3.internal package usage for OkHttp 4.x, but with OkHttp 4.x this usage didn't cause any problems - the class and field were still there.

However, it seems things are finally moved for OkHttp 5.x (which is in alpha for now, changelog is here), so to be on the safe side we are getting rid of reference to okhttp3.internal.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm
0xnm requested a review from a team as a code owner February 17, 2023 10:23
@codecov-commenter

codecov-commenter commented Feb 17, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1288 (b918b0b) into develop (dde54aa) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #1288      +/-   ##
===========================================
+ Coverage    81.85%   81.92%   +0.06%     
===========================================
  Files          361      361              
  Lines        12835    12840       +5     
  Branches      2148     2149       +1     
===========================================
+ Hits         10506    10518      +12     
  Misses        1665     1665              
+ Partials       664      657       -7     
Impacted Files Coverage Δ
...droid/core/internal/net/RequestUniqueIdentifier.kt 100.00% <100.00%> (ø)
...android/log/internal/logger/TelemetryLogHandler.kt 71.43% <0.00%> (-28.57%) ⬇️
.../datadog/android/sessionreplay/utils/ThemeUtils.kt 83.33% <0.00%> (-16.67%) ⬇️
...id/rum/internal/ndk/DatadogNdkCrashEventHandler.kt 90.00% <0.00%> (-3.00%) ⬇️
.../android/rum/internal/monitor/DatadogRumMonitor.kt 88.36% <0.00%> (-0.53%) ⬇️
.../kotlin/com/datadog/android/v2/core/DatadogCore.kt 86.02% <0.00%> (+1.27%) ⬆️
...lin/com/datadog/android/rum/internal/RumFeature.kt 93.53% <0.00%> (+1.44%) ⬆️
...ndroid/telemetry/internal/TelemetryEventHandler.kt 71.88% <0.00%> (+1.56%) ⬆️
...al/persistence/file/batch/BatchFileOrchestrator.kt 95.28% <0.00%> (+1.57%) ⬆️
...core/internal/system/DefaultAndroidInfoProvider.kt 84.91% <0.00%> (+1.89%) ⬆️
... and 2 more

}
val contentType = body.contentType()
"$method•$url•$contentLength•$contentType"
// TODO RUMM-3062 It is possible that if requests are say GZIPed (as an example, or maybe

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thin you are missing something after as an example ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GZIP is an example :) I put the bracket at the wrong place, will update it.

// -1 is valid return value for contentLength() call according to the docs and stands
// for "unknown" case.
// We need to have a more precise identification.
if (contentType != null || contentLength != 0L) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we worried that we will have too many collisions if we follow what you stated above ? I guess there are many apps there with GZIPed requests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is the same behavior what we have right now (because EMPTY_REQUEST replace was the body with contentType == null and contentLength == 0), so we don't introduce any changes to the current behavior.

And later we can improve, this issue exists today as well.

@0xnm
0xnm force-pushed the nogorodnikov/rumm-3051/remove-usage-of-okhttp3-internal-package branch from 5634563 to b918b0b Compare February 17, 2023 14:53
@0xnm
0xnm requested a review from mariusc83 February 17, 2023 14:53
@0xnm
0xnm merged commit 278bb1c into develop Feb 20, 2023
@0xnm
0xnm deleted the nogorodnikov/rumm-3051/remove-usage-of-okhttp3-internal-package branch February 20, 2023 08:40
@xgouchet xgouchet added this to the 1.18.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use of an internal okHttp package causes issues/crashes when using a more recent version of okHttp(4+).

4 participants