Skip to content

Fix network configuration telemetry reporting - #3979

Draft
kikoveiga wants to merge 1 commit into
developfrom
kikoveiga/fix-network-configuration-telemetry
Draft

kikoveiga wants to merge 1 commit into
developfrom
kikoveiga/fix-network-configuration-telemetry

Conversation

@kikoveiga

@kikoveiga kikoveiga commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

  • Preserve network/header configuration state before telemetry sampling and event limits are applied.
  • Report legacy OkHttp configuration through one SDK-acquisition callback that captures the header extractor safely.
  • Populate use_first_party_hosts from global hosts and per-SDK integration configuration.

Motivation

Android's network-tracking and resource-header percentages were much lower than iOS in the RUM configuration telemetry dashboard. The underlying telemetry can undercount enabled features: setup signals were sampled or capped before updating state, and the legacy interceptor could report headers before its constructor fields were initialized. First-party-host usage was also not populated.

Known limitation: this PR keeps the existing one-shot configuration snapshot, scheduled five seconds after SDK initialization. OkHttp clients configured after the snapshot is built are still not reflected in that event. Reporting late network setup is intentionally left for a follow-up.

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)

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Tests

✅ All CI checks and tests passed. Datadog automation helped this PR pass.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 1 test - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
• Patch Coverage: 87.43%
• Overall Coverage: 71.83% (+0.06%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 00c79d9 | Docs | View more details | Give us feedback!

@kikoveiga
kikoveiga marked this pull request as ready for review October 13, 2026 10:58
@kikoveiga
kikoveiga requested review from a team as code owners October 13, 2026 10:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T21:28:36.407495Z 00c79d9 Manual request
🔒 Security Review ✅ Completed 2026-10-13T21:21:23.645438Z 00c79d9 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kikoveiga
kikoveiga force-pushed the kikoveiga/fix-network-configuration-telemetry branch from 8b378d6 to e4488d8 Compare October 13, 2026 10:59

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

Normal RUM event processing erases the new integration-local host flag, causing subsequent configuration telemetry to report first-party hosts as disabled when no global hosts are configured.

Open Bits AI session

🤖 Bits Code Review · Commit 8b378d6

@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: 8b378d6c21

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

@kikoveiga
kikoveiga marked this pull request as draft October 13, 2026 11:49
@kikoveiga
kikoveiga force-pushed the kikoveiga/fix-network-configuration-telemetry branch 5 times, most recently from 46da062 to 9075614 Compare October 13, 2026 14:58
@kikoveiga

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 9075614bbd

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 9075614bbd

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

@kikoveiga
kikoveiga force-pushed the kikoveiga/fix-network-configuration-telemetry branch 3 times, most recently from 376eb8e to c6e4be7 Compare October 13, 2026 19:46
@kikoveiga
kikoveiga force-pushed the kikoveiga/fix-network-configuration-telemetry branch from c6e4be7 to 00c79d9 Compare October 13, 2026 19:47
@kikoveiga

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 00c79d9363

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 00c79d9363

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

return emptyList()
}
instances[key] = sdkCore
return referencesFor(key).mapNotNull { it.capture(sdkCore) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Defer callbacks that require enabled features

When instrumentation has called get() before Datadog.initialize, this captures it during core registration, before the app can subsequently call Rum.enable or Trace.enable. Consequently, reportNetworkInstrumentationConfigured calls GlobalRumMonitor.get while it still returns a no-op (logging a misleading warning and permanently dropping the networking-library API-usage event), while the legacy interceptor's updateTracingFeatureContext silently returns because the Trace feature is absent. Since the reference remains captured, later requests do not rerun either callback. Split the per-core configuration capture from feature-dependent reporting and replay the latter after the corresponding feature is registered.

AGENTS.md reference: AGENTS.md:L115-L115

Useful? React with 👍 / 👎.

return sdkCore
sdkCore to registry.registerAndGetNotifications(sdkInstanceName, sdkCore)
}
registry.notifyReferences(notifications)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep capture callbacks off the initialization thread

When an SdkReference starts observing before initialization, this invokes its public onSdkInstanceCaptured callback synchronously before Datadog.initialize returns. A customer callback that waits, performs I/O, or otherwise runs slowly now stalls SDK initialization—normally on the application's main thread—even though previously it ran only from the caller's explicit get(). Dispatch these callbacks through an existing executor, or otherwise keep arbitrary callback work out of the initialization path.

AGENTS.md reference: AGENTS.md:L113-L113

Useful? React with 👍 / 👎.

Comment on lines +35 to +38
is InternalTelemetryEvent.NetworkInstrumentationConfigured ->
event.resourceHeadersTracking ?: current.resourceHeadersTracking
is InternalTelemetryEvent.ResourceHeadersTrackingConfigured -> event.mode
else -> current.resourceHeadersTracking

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Merge header modes independently of callback order

When multiple integrations are created before SDK initialization with different header extractors, such as one using default headers and another using custom headers, their capture callbacks are obtained from a WeakHashMap in unspecified order. Each update here unconditionally replaces the previous non-null mode, so the one-shot configuration event can nondeterministically report either default_headers or custom for the same setup. Define deterministic aggregation, for example making CUSTOM dominate, rather than allowing the final callback to win.

Useful? React with 👍 / 👎.

Comment on lines +43 to +46
_InternalProxy.updateNetworkInstrumentationConfiguration(
sdkCore,
InternalTelemetryEvent.NetworkInstrumentationConfigured(resourceHeadersExtractor?.toTrackingMode())
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve updates when the core proxy declines them

When instrumentation is bound to an InternalSdkCore implementation other than the concrete DatadogCore, this proxy call returns false by contract, but the result is ignored and the NetworkInstrumentationConfigured event is never delivered to TelemetryEventHandler. Its fallback configuration therefore remains empty, causing track_network_requests and track_resource_headers to be reported as disabled for wrapper or reliability cores. Forward the event through the monitor when the proxy declines it, or otherwise retain it in the caller as the proxy contract requires.

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.

1 participant