Skip to content

FFLSDK-272: Send additional Flagging state telemetry on flag requests - #4030

Open
typotter wants to merge 1 commit into
developfrom
typo/android-flags-request-diagnostics
Open

typotter wants to merge 1 commit into
developfrom
typo/android-flags-request-diagnostics

Conversation

@typotter

@typotter typotter commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

References FFLSDK-272.

Send 3 new fields in the precomputed assignments POST:

  • sdk.instance_id - uniquely identifies the in-memory configuration-owning client instance
  • fetch.sequence - a logical fetch operation in the SDK's lifecycle
  • fetch.trigger - the SDK's internal accounting of what triggered the fetch

Motivation

Distinguish configuration-owning SDK instances and logical fetches when investigating repeated assignment requests in edge request logs.

Implementation

EvaluationsManager owns the UUIDv7 instance ID and fetch sequence. Each accepted fetch captures an immutable diagnostics value, which travels with that fetch to the existing request factory. The factory adds its fields directly to the structured request body and serializes the complete body once.

The in-package UUIDv7Generator supplies the instance ID. A diagnostics trigger enum uses initialization and context_change, consistently across SDKs.

Additional Notes

Local validation: all 613 Flags unit tests, Detekt, ktlint and API checks passed. The API check used the unchanged generated reference with apiDump excluded to avoid the existing Gradle task-ordering conflict. Tests cover instance identity, logical sequencing, concurrent acceptance and the complete request body. Verify deployed edge/proxy acceptance and the EVP schema prerequisite before SDK release.

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)

Reviewer selection

🤖 Automatically generated · runs asynchronously. The FFE reviewer-routing workflow maintains this section; it does not replace human review.

✅ Complete — reviewer coverage verified.

What happened: The workflow matched this PR to the published registry, selected 2 reviewers for its initiative and any additional review areas, and checked their pending requests or submitted reviews on the evaluated head. Existing reviewers and teams were preserved. Coverage is not approval.

Decision

Initiative: fallback / android

Why this match: Android Flags SDK maintenance. The change adds an internal diagnostics object to the precomputed-assignments POST body. The object holds a UUIDv7 SDK instance ID, a logical fetch sequence and a fetch trigger (initialization or context_change), which help investigate repeated assignment requests in edge logs. EvaluationsManager creates one diagnostics value per fetch, and the downloader and request factory pass it into the request body. Initialization, readiness, configuration receipt and evaluation outcomes are unchanged. There is no onboarding or setup-verification behavior (guided-onboarding), no EVP evaluation telemetry or consent handling (flag-evaluation-evp), and no tag scoping or offline bootstrap. No registered project fits, so the Android fallback applies. The fallback's path and language constraints match the changed Kotlin flags sources.

Why these owners: The matched initiative has fewer than two approved, non-author candidates. The approved global pool supplies the remaining review owners; proposed memberships were not activated.

  • @sameerank — final owner (final-review-owners): Global review owner filling the remaining slot and responsible for obtaining review. Review requested.
  • @greghuels — final owner (final-review-owners): Global review owner filling the remaining slot and responsible for obtaining review. Review requested.

The PR author is excluded from reviewer selection.

Debug or fix a problem

Workflow run · Bits Code session

  • Wrong project or pod? Clarify this PR’s purpose, or correct the reviewer registry and publish the change. Sheet edits take effect after publication.
  • Need another reviewer now? Request them in GitHub. This workflow only adds requests and keeps existing reviewers.
  • Stuck beyond five minutes or failed? Inspect the run’s failed step and available Bits session. After fixing the cause, rerun the workflow with this PR URL and dry_run=false. Unchanged completed runs are skipped. If the receipt says needs_reconciliation or a write outcome is uncertain, ask the workflow owner to reconcile GitHub and the receipt before retrying; do not delete the lock blindly.
  • Report a problem: Comment on the reviewer-routing skill PR with this PR URL, the workflow run link, and the expected initiative or reviewer correction.
Evidence and run details

Changed paths: features/dd-sdk-android-flags/src/main/kotlin/com/datadog/android/flags/internal/diagnostics/FlagsRequestDiagnostics.kt, features/dd-sdk-android-flags/src/main/kotlin/com/datadog/android/flags/internal/evaluation/EvaluationsManager.kt, features/dd-sdk-android-flags/src/main/kotlin/com/datadog/android/flags/internal/net/PrecomputedAssignmentsDownloader.kt, features/dd-sdk-android-flags/src/main/kotlin/com/datadog/android/flags/internal/net/PrecomputedAssignmentsReader.kt, features/dd-sdk-android-flags/src/main/kotlin/com/datadog/android/flags/internal/net/PrecomputedAssignmentsRequestFactory.kt

Evaluated head: b29a63304c2e103f89dc2703fd7e267c2c121503

Registry revision: revision:54491247-28c5-4ac2-a03b-579fcf68b1c0

Pinned skill source: d214cfc65ae154b97d39af5cf32caf48aaec9bf0

Instructions: workflow-injected snapshot (no plugin loaded)

Instruction snapshot SHA-256: f23b2a88c13c0da90e2dd58246a14f257af91e2195c555039bd555b52e6f3516

@linear-code

linear-code Bot commented Oct 22, 2026

Copy link
Copy Markdown

FFLSDK-272

@typotter
typotter marked this pull request as ready for review October 22, 2026 15:52
@typotter
typotter requested review from a team as code owners October 22, 2026 15:52
@typotter
typotter requested a review from vjfridge October 22, 2026 15:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-26T16:05:57.582232Z b29a633 New commits
🔒 Security Review ✅ Completed 2026-10-26T16:07:07.704810Z b29a633 New commits
ℹ️ 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.

@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: 05fcdef98b

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

@typotter
typotter requested a review from btthomas October 22, 2026 15:59

@datadog-prod-us1-6 datadog-prod-us1-6 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.

Bits Code Review: PASS

More details

The diagnostics preserve existing assignment data while maintaining a stable per-client identity and synchronized fetch sequence. The completed static review identified no actionable defect, but focused tests could not execute because a required aapt2 dependency was unavailable in the offline cache.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 05fcdef

@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 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: 83.33%
• Overall Coverage: 71.78% (-0.01%)

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

vjfridge
vjfridge previously approved these changes Oct 23, 2026

@vjfridge vjfridge 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.

Looks like we have merge conflict to resolve and I left a couple non-blocking comments but otherwise looks good to me!

@typotter
typotter force-pushed the typo/android-flags-request-diagnostics branch 3 times, most recently from 61f6dce to 6cfb11c Compare October 26, 2026 15:52
@typotter
typotter requested a balanced review from Copilot October 26, 2026 15:53

Copilot AI 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.

🔵 Needs a closer look

Deployed edge/proxy acceptance of the new payload and the prerequisite EVP schema remain unverified.

2 open issues
What changed in this PR

Adds per-instance and per-fetch diagnostics to Flags assignment requests, helping distinguish SDK clients and logical fetches when investigating repeated requests.

Changes:

  • Generates a UUIDv7 instance ID and captures fetch sequence and trigger in an immutable snapshot.
  • Passes diagnostics through the downloader and serializes them into the request body.
  • Adds identity, sequencing, concurrency, UUID format, and request-body tests.
File Description
features/​dd-sdk-android-flags/​src/​test/​kotlin/​com/​datadog/​android/​flags/​utils/​forge/​ForgeConfigurator.kt Registers the diagnostics fixture factory.
features/​dd-sdk-android-flags/​src/​test/​kotlin/​com/​datadog/​android/​flags/​utils/​forge/​FlagsRequestDiagnosticsForgeryFactory.kt Generates diagnostics test fixtures.
features/​dd-sdk-android-flags/​src/​test/​kotlin/​com/​datadog/​android/​flags/​internal/​net/​PrecomputedAssignmentsRequestFactoryTest.kt Verifies diagnostic fields and unchanged request content.
features/​dd-sdk-android-flags/​src/​test/​kotlin/​com/​datadog/​android/​flags/​internal/​evaluation/​EvaluationsManagerTest.kt Tests instance identity and logical fetch sequencing.
features/​dd-sdk-android-flags/​src/​test/​kotlin/​com/​datadog/​android/​flags/​internal/​diagnostics/​UUIDv7GeneratorTest.kt Checks UUID timestamp, version, variant, and uniqueness.
features/​dd-sdk-android-flags/​src/​main/​kotlin/​com/​datadog/​android/​flags/​internal/​net/​PrecomputedAssignmentsRequestFactory.kt Adds optional diagnostics to request JSON.
features/​dd-sdk-android-flags/​src/​main/​kotlin/​com/​datadog/​android/​flags/​internal/​net/​PrecomputedAssignmentsReader.kt Accepts a diagnostics snapshot.
features/​dd-sdk-android-flags/​src/​main/​kotlin/​com/​datadog/​android/​flags/​internal/​net/​PrecomputedAssignmentsDownloader.kt Forwards diagnostics to the request factory.
features/​dd-sdk-android-flags/​src/​main/​kotlin/​com/​datadog/​android/​flags/​internal/​evaluation/​EvaluationsManager.kt Owns instance identity and allocates fetch diagnostics.
features/​dd-sdk-android-flags/​src/​main/​kotlin/​com/​datadog/​android/​flags/​internal/​diagnostics/​FlagsRequestDiagnostics.kt Defines diagnostics, triggers, and UUIDv7 generation.
detekt_custom_unsafe_calls.yml Registers the JSON map constructor as potentially throwing.

Review effort: Balanced

Capture typed diagnostics with each logical fetch and serialize them directly in the precomputed request body for edge request-log correlation.
@typotter
typotter force-pushed the typo/android-flags-request-diagnostics branch from 6cfb11c to b29a633 Compare October 26, 2026 16:03
@typotter
typotter requested a review from vjfridge October 26, 2026 16:03
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.

4 participants