Skip to content

RUM-13974: [Cronet] Supporting APM on network layer for Cronet#3171

Merged
satween merged 2 commits into
developfrom
tvaleev/feature/RUM-13974-APM-DNI
Feb 27, 2026
Merged

RUM-13974: [Cronet] Supporting APM on network layer for Cronet#3171
satween merged 2 commits into
developfrom
tvaleev/feature/RUM-13974-APM-DNI

Conversation

@satween

@satween satween commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds APM support for Cronet network layer (i.e., automatic tracing for all redirects that happen during the application-level request).

Additional Notes

Note that Cronet does not provide any info for retries, so retry requests cannot be traced as it is done in
OkHttp.

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)

@satween
satween requested a review from a team as a code owner February 10, 2026 15:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6032733f61

ℹ️ 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".

@datadog-official

This comment has been minimized.

@codecov-commenter

codecov-commenter commented Feb 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.00000% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.41%. Comparing base (18b420c) to head (f3b2a1e).
⚠️ Report is 175 commits behind head on develop.

Files with missing lines Patch % Lines
...id/trace/ApmNetworkInstrumentationConfiguration.kt 45.45% 17 Missing and 1 partial ⚠️
...ndroid/trace/internal/ApmNetworkInstrumentation.kt 72.50% 0 Missing and 11 partials ⚠️
...dog/android/cronet/internal/DatadogCronetEngine.kt 81.82% 8 Missing ⚠️
...g/android/cronet/internal/CronetRequestCallback.kt 87.27% 1 Missing and 6 partials ⚠️
...a/com/datadog/android/internal/network/HttpSpec.kt 88.37% 5 Missing ⚠️
...g/android/cronet/internal/CronetHttpRequestInfo.kt 61.54% 3 Missing and 2 partials ⚠️
...et/internal/CronetRedirectTracingRequestWrapper.kt 84.62% 1 Missing and 3 partials ⚠️
.../datadog/android/cronet/CronetIntegrationPlugin.kt 94.12% 1 Missing and 2 partials ⚠️
...g/android/cronet/internal/CronetHttpRequestBody.kt 0.00% 3 Missing ⚠️
...roid/rum/internal/net/RumNetworkInstrumentation.kt 88.89% 0 Missing and 2 partials ⚠️
... and 6 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3171      +/-   ##
===========================================
- Coverage    71.46%   71.41%   -0.05%     
===========================================
  Files          928      933       +5     
  Lines        34444    34580     +136     
  Branches      5812     5847      +35     
===========================================
+ Hits         24613    24692      +79     
- Misses        8224     8249      +25     
- Partials      1607     1639      +32     
Files with missing lines Coverage Δ
...om/datadog/android/trace/ApmNetworkTracingScope.kt 100.00% <100.00%> (ø)
...android/trace/internal/DatadogPropagationHelper.kt 66.46% <100.00%> (+0.87%) ⬆️
...og/android/trace/internal/DatadogTracingToolkit.kt 33.33% <100.00%> (ø)
.../android/trace/internal/net/RequestTracingState.kt 100.00% <100.00%> (ø)
.../android/cronet/internal/CronetHttpResponseInfo.kt 81.82% <100.00%> (ø)
...android/cronet/internal/CronetUrlRequestBuilder.kt 96.97% <100.00%> (ø)
...android/cronet/internal/CronetUrlRequestWrapper.kt 100.00% <100.00%> (ø)
.../instrumentation/network/HttpRequestInfoBuilder.kt 0.00% <0.00%> (ø)
...og/android/cronet/internal/CronetRequestContext.kt 86.41% <93.33%> (ø)
...onet/internal/CronetRequestFinishedInfoListener.kt 88.33% <83.33%> (ø)
... and 13 more

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread dd-sdk-android-core/api/apiSurface Outdated
@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch 2 times, most recently from a60e49c to feefe5b Compare February 12, 2026 11:46
@satween
satween requested a review from 0xnm February 12, 2026 13:34
@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch 2 times, most recently from 8f048a3 to 91ec6c5 Compare February 17, 2026 03:18
@0xnm

0xnm commented Feb 17, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91ec6c595f

ℹ️ 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".

@0xnm 0xnm left a comment

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.

LGTM, but there is a lint failure. Also there are some comments from Codex above.

@0xnm 0xnm left a comment

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.

One thing I forgot to mention is ApmNetworkTracingScope members naming. I have a concern about APPLICATION_LEVEL_REQUESTS_ONLY - one may think that this is application requests vs application+libraries (all) requests tracking, because some observability SDKs have a possibility to instrument HTTP clients implicitly, without having direct access to them.

Maybe we should come with better name, especially considering that we are trying to bring OkHttp-native concept to the generic HTTP instrumentation.

@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch from 91ec6c5 to dd12a69 Compare February 20, 2026 15:01
@satween
satween requested a review from a team as a code owner February 20, 2026 15:01
@satween
satween requested a review from 0xnm February 20, 2026 15:01
@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch 5 times, most recently from cb8e557 to 62046e7 Compare February 20, 2026 17:52
@OliviaShoup

Copy link
Copy Markdown

thanks for the PR @satween! i've made an editorial review card so a docs team member can take a look: https://datadoghq.atlassian.net/browse/DOCS-13466

@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch from 249cd2d to 750a2b1 Compare February 23, 2026 11:24
@0xnm

0xnm commented Feb 23, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 750a2b11d0

ℹ️ 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".

Comment thread integrations/dd-sdk-android-cronet/README.md Outdated
Comment thread integrations/dd-sdk-android-cronet/README.md Outdated
Comment thread features/dd-sdk-android-trace/api/apiSurface Outdated
brett0000FF
brett0000FF previously approved these changes Feb 23, 2026
Comment thread integrations/dd-sdk-android-cronet/README.md Outdated
Comment thread integrations/dd-sdk-android-cronet/README.md
@satween
satween requested a review from a team as a code owner February 25, 2026 15:41
@satween
satween requested a review from 0xnm February 25, 2026 15:42
@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch from bb178c6 to 993383a Compare February 26, 2026 09:44

@0xnm 0xnm left a comment

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've added some comments: the most important points are ApmNetworkInstrumentationConfiguration constructor visibility and setCustomDistributedTraceConfiguration (we need to see if we can the necessary the other way, more intuitive and less error-prone).

Comment thread features/dd-sdk-android-trace/api/apiSurface Outdated
Comment thread integrations/dd-sdk-android-cronet/README.md Outdated
Comment thread integrations/dd-sdk-android-cronet/README.md Outdated
Comment thread integrations/dd-sdk-android-cronet/README.md Outdated
@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch from 993383a to d4a5e23 Compare February 27, 2026 09:01
@satween
satween requested a review from 0xnm February 27, 2026 09:01
0xnm
0xnm previously approved these changes Feb 27, 2026
Comment on lines +43 to +52
internal var traceOrigin: String? = null,
internal var redacted404ResourceName: Boolean = true,
internal var sdkInstanceName: String? = null,
internal var localTracerFactory: (SdkCore, Set<TracingHeaderType>) -> DatadogTracer = DEFAULT_LOCAL_TRACER_FACTORY,
internal var traceContextInjection: TraceContextInjection = TraceContextInjection.SAMPLED,
internal var tracedRequestListener: NetworkTracedRequestListener = NoOpNetworkTracedRequestListener(),
internal var traceSampler: Sampler<DatadogSpan> = DeterministicTraceSampler(DEFAULT_TRACE_SAMPLE_RATE),
internal var globalTracerProvider: () -> DatadogTracer? = { GlobalDatadogTracer.getOrNull() },
internal var networkTracingScope: ApmNetworkTracingScope = ApmNetworkTracingScope.EXCLUDE_INTERNAL_REDIRECTS,
internal var headerPropagationOnly: Boolean = false

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.

note: this a bit differers from configuration patterns we have in the codebase, because we use XXXConfiguration.Builder instead of having mutable configuration, so there is inconsistency API-wise.

Although it is not a big deal.

@0xnm

0xnm commented Feb 27, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4a5e23eff

ℹ️ 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".

@satween
satween force-pushed the tvaleev/feature/RUM-13974-APM-DNI branch from d4a5e23 to f3b2a1e Compare February 27, 2026 10:55
@satween
satween requested a review from 0xnm February 27, 2026 12:42
@satween
satween merged commit 8a78565 into develop Feb 27, 2026
26 checks passed
@satween
satween deleted the tvaleev/feature/RUM-13974-APM-DNI branch February 27, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants