Skip to content

refactor(flags): share provider telemetry across context changes - #1307

Merged
leoromanovsky merged 24 commits into
developfrom
leo.romanovsky/provider-owned-flags-telemetry
Nov 20, 2026
Merged

leoromanovsky merged 24 commits into
developfrom
leo.romanovsky/provider-owned-flags-telemetry

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What and why?

The provider created a new exposure logger, evaluation aggregator, and HTTP client for each evaluation context. Context changes needed a telemetry handoff layer between clients. This PR removes that layer (follow-up from #1297).

How?

  • The provider owns one exposure logger, evaluation aggregator, and HTTP client. Each context keeps its own assignment repository.
  • Remove the telemetry handoff: inheritTelemetry, successor chains, inherited uploads, and timer bookkeeping.
  • Provider shutdown drains telemetry and closes only an SDK-owned HTTP client.
  • Abort a retired context's pending assignment fetch. Previously, closing the per-context HTTP client aborted it. Fetches now use http.AbortableRequest through send. This requires http: ^1.5.0.
  • A concurrent shutdown() waits for work that an earlier call started.
  • FlagsRepository.forRuntime builds repositories for the provider and DatadogFlags.

Validation

Tested commit Validation Result
bd089ec56223fdd271660e07d341fb2f78d72a9f datadog_flags unit tests 413 passed
bd089ec56223fdd271660e07d341fb2f78d72a9f datadog_flags_flutter unit tests 30 passed
1674e2c7bd93c360820be4c3d30167ad77b68865 Native integration, iOS simulator 5 passed

Review checklist

  • This pull request has appropriate unit and / or integration tests
  • This pull request references a Github or JIRA issue

Base automatically changed from leo.romanovsky/flags-aaron-feedback to develop November 18, 2026 14:57
Keep this branch's provider-owned telemetry design for conflicted Flags
files and apply the three #1297 commits that landed after this branch's
stack point: strict context switching export, empty-string targeting
keys, and internal __dd_ metadata keys.
@leoromanovsky leoromanovsky added crucible: reviewing A Crucible review has started; this PR has reviewer attention. and removed crucible: reviewing A Crucible review has started; this PR has reviewer attention. labels Nov 18, 2026
…metry

- Abort a retired context's pending assignment fetch. The cancel token
  exposes an abort trigger, and the fetcher sends an AbortableRequest.
  This raises the http dependency floor to ^1.5.0.
- Make a concurrent shutdown wait for work that an earlier call started.
- Add tests for re-initialization after shutdown, concurrent shutdown,
  and fetch abort on context retirement.
- Share repository construction through FlagsRepository.forRuntime.
- Document telemetry ownership and clarify provider names.
@leoromanovsky
leoromanovsky marked this pull request as ready for review November 18, 2026 16:01
@leoromanovsky
leoromanovsky requested review from a team as code owners November 18, 2026 16:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T19:17:27.202984Z 3e373ad New commits
🔒 Security Review ✅ Completed 2026-11-19T19:18:43.598053Z 3e373ad 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: bd089ec562

ℹ️ 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-datadog-prod-us1 datadog-datadog-prod-us1 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

Static review found no actionable defects in telemetry ownership, context retirement, cancellation, or shutdown. Native integration validation at the reviewed head remains outstanding.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit bd089ec

Replace the handwritten _CountingClient and _AbortRecordingClient fakes
with the existing _MockHttpClient, as AGENTS.md requires. Verify close
and upload counts with mocktail.
Keep the README at the develop version. The send requirement and the
http ^1.5.0 floor belong in the release notes.
@gh-worker-ownership-write-b05516
gh-worker-ownership-write-b05516 Bot removed the request for review from a team November 18, 2026 16:13
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3e373ad | Docs | Give us feedback!

@fuzzybinary

Copy link
Copy Markdown
Member

build-android failure will need #1314 once it's merged.

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

This mostly looks good and definitely simplifies the backoff. I do think the set is overkill though and worth looking into taking it out.

Once #1314 is merged here we can look at merging in.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 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: FAIL

The PR shares provider telemetry across context changes; the latest commit simplifies concurrent shutdown and clarifies draining behavior. One edge-case regression remains: a failed shutdown persists across reinitialization, causing later successful teardowns to rethrow the old error.

Open Bits AI session

🤖 Bits Code Review · Commit be48c21

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 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 PR shares telemetry across context changes while retaining per-context assignment repositories and draining uploads at shutdown. The latest commit clears settled shutdown futures without disturbing newer concurrent operations, fixing the earlier failure-retention regression; no findings remain open, while CI and native integration validation remain outstanding.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 3e373ad

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

Looks good. Thanks!

@leoromanovsky
leoromanovsky merged commit 0b8094d into develop Nov 20, 2026
18 checks passed
@leoromanovsky
leoromanovsky deleted the leo.romanovsky/provider-owned-flags-telemetry branch November 20, 2026 15: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.

2 participants