Skip to content

[FFL-3355] Add independent native OpenFeature tracking hooks - #1507

Draft
sameerank wants to merge 4 commits into
developfrom
sameerank/FFL-3355/native-tracking-hooks
Draft

sameerank wants to merge 4 commits into
developfrom
sameerank/FFL-3355/native-tracking-hooks

Conversation

@sameerank

@sameerank sameerank commented Oct 21, 2026 •

Copy link
Copy Markdown

What does this PR do?

Add independent native-backed OpenFeature tracking hooks for DatadogCoreProvider (FFL-3355):

  • createDatadogExposureLoggingHook, createDatadogEvaluationLoggingHook, and createDatadogRumTrackingHook.
  • composeDatadogTrackingHooks with explicit initialization/shutdown, aligned with the browser hook API.
  • Separate exposure/evaluation bridge methods for iOS and both Android RN architectures, preserving the existing combined operation.
  • Forward split serial IDs to iOS for exposure deduplication and expose the native evaluation-intake endpoint override.
  • Add bridge, hook-lifecycle, client-isolation, and error/default regression tests and usage documentation.

Hooks submit asynchronously without JS batching. Shutdown disables the hooks but does not own or stop the shared native SDK. Site, consent, storage, aggregation, and upload remain native SDK responsibilities.

Motivation

Rules-based JS evaluation needs independently selectable tracking without triggering every native tracking operation or maintaining a second JS telemetry pipeline.

Additional Notes

Native dependencies and merge blockers

This draft depends on:

The checked-in native dependency pins still reference releases without these APIs (iOS 3.16.1 and Android 3.15.0). Update them to releases containing the native changes before merging/releasing, and verify matching-version compatibility between the core and OpenFeature RN packages. An unmodified checkout is not expected to build the new bridge against the currently pinned native releases.

Validation

  • Targeted tracking and fetch suites on the stacked branch: 51 tests passed. Fetch-specific cases are introduced by the companion fetch-helper PR, not this diff.
  • Android end-to-end upload verification, legacy-architecture runtime validation, and full repository CI remain pending.

Exploratory evaluation benchmarks (2026-10-22)

Rerun after the RUM hook moved to the named native Flags client via trackRumEvaluation. Measured on an iPhone 17 Pro / iOS 26.0 simulator with RN 0.76.9, Hermes, Fabric, minified production JS, and a freshly rebuilt native Debug app. The installed executable and native debug-library hashes matched the rebuilt artifacts and were identical across all three fresh-process runs. These are local exploratory measurements, not a benchmark or CI performance gate included in this PR.

Each run used the same boolean assignment and context, granted consent, and local-only intake endpoints. Each workload used eight warm-up rounds and 40 measured rounds with rotating scenario order. No native builds or Android emulator ran during measurement. Each run fetched its precomputed fixture exactly once and produced local exposure, evaluation, and RUM intake requests; those request counts do not establish per-scenario delivery.

Values below are per-run medians in microseconds per evaluation, including baseline evaluation cost, for bursts of 100 reads:

Run Core: no hooks Core: exposure + evaluation Core: all three hooks Regular provider: built-in tracking
1 40.8 116.6 142.2 32.1
2 40.5 113.8 140.1 31.9
3 40.4 115.4 141.9 32.9

Relative to no hooks, the paired median added burst cost was 72.7-75.6 us for exposure/evaluation and 99.3-101.1 us for all three hooks. RUM-only total burst medians were 75.5-77.3 us. With all hooks, the core-provider path took 4.3-4.4 times the regular provider's time in bursts.

For isolated reads after a 100 ms pause, per-run medians were:

Run Core: all three hooks Regular provider: built-in tracking
1 904.1 336.5
2 914.3 369.9
3 979.5 354.2

That is 2.5-2.8 times within each run. Simulator scheduling strongly affects isolated reads; compare paths within a run. These replace the earlier exploratory numbers, but are not a controlled before/after measurement of the RUM change because the older native binary's optimization level was not verified.

The regular DatadogOpenFeatureProvider reads cached, precomputed assignments and submits one asynchronous combined tracking call. DatadogCoreProvider evaluates rules locally and, with all hooks enabled, prepares payloads and submits three separate tracking calls. Both tracking-enabled paths had exposure, evaluation, and RUM enabled. This comparison includes differences in evaluation, metadata preparation, and hook execution; it does not isolate bridge overhead or compare JS rules evaluation with native rules evaluation.

Timing ends when the synchronous evaluation returns. Initialization/fetching, hook registration, and waiting for native completion, storage, or upload are excluded. Burst percentiles describe batch averages, not individual-call tail latency. Repeated flag/subject reads exercise deduplication and aggregation, not unique-event throughput. These are native Debug simulator measurements, not native Release measurements. Android performance, physical-device Release performance, and frame impact remain unmeasured. These results alone do not establish a need for JS batching.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • 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)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

✨ Unblock PR with BitsAI

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 4 Pipeline jobs failed

DataDog/dd-sdk-reactnative | test:native-android — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/dd-sdk-reactnative | test:native-ios — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/dd-sdk-reactnative | test:native-ios-newarch — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

View all 4 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

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

Route independent RUM hooks through the selected native Flags client and preserve telemetry opt-out. Warn once when core tracking helpers are unavailable, with regression coverage and updated usage guidance.

Ref: FFL-3355

This branch has not been deployed

No deployments
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