Skip to content

Conversation

@satween
Copy link
Contributor

@satween satween commented Jan 20, 2026

What does this PR do?

In this PR we are copying the main logic from TracingInterceptor / DatadogInterceptor into the NetworkTracingInstrumentation in order to:

  1. Support RUM <> APM integration for Cronet
  2. Create a foundation for single network instrumentation logic that should be shared across several networking libraries in the future.

Motivation

Continuing to add an integration for Cronet library meanwhile preparing infrastructure to migrate OkHttp onto the same logic.

Additional Notes

Note that in this PR we are not supporting deep network instrumentation that is being done by TracingInterceptor in OkHttp. This logic will be supported in a further PR as this one is already pretty big.

NOTE: In this PR as an experiment an AI agent helped to write tests and some docs. I've made few iterations of a fixes for that but if you spot any issues - let me know. AI wasn't involved into production code development.

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 January 20, 2026 16:21
@satween
Copy link
Contributor Author

satween commented Jan 20, 2026

@codex

@chatgpt-codex-connector
Copy link

To use Codex here, create a Codex account and connect to github.

@kikoveiga
Copy link
Contributor

@codex review

Copy link

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

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: 5ee7daf6e5

ℹ️ 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 on lines 36 to +41
override fun addHeader(header: String, value: String?): UrlRequest.Builder = apply {
headers[header] = listOfNotNull(value)
delegate.addHeader(header, value)
val currentValues = headers[header]?.toMutableList() ?: mutableListOf()
if (value != null) {
currentValues.add(value)
}
headers[header] = currentValues

Choose a reason for hiding this comment

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

P1 Badge Forward added headers to the Cronet delegate

DatadogUrlRequestBuilder.addHeader() now only updates the local headers map and never forwards to delegate.addHeader. Later, buildCronetRequest() calls addHeaders(headers), which invokes this same override again, so the delegate builder never receives any headers. This means every Cronet request built through DatadogCronetEngine will drop user-supplied headers and tracing headers, breaking authentication and trace propagation. Consider forwarding to delegate.addHeader (or ensuring addHeaders writes to the delegate) so the actual request carries the headers.

Useful? React with 👍 / 👎.

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.

3 participants