Skip to content

[bug] Handle gracefully malformed flag evaluations; migrate Date->Instant - #11535

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 18 commits into
masterfrom
leo.romanovsky/ffl-2339-instant-allocation-windows
Aug 7, 2026
Merged

[bug] Handle gracefully malformed flag evaluations; migrate Date->Instant#11535
gh-worker-dd-mergequeue-cf854d[bot] merged 18 commits into
masterfrom
leo.romanovsky/ffl-2339-instant-allocation-windows

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Motivation

Allocation windows are UTC instants, but converting parsed timestamps through Date loses sub-millisecond precision. Evaluation needs the original precision while the existing UFC v1 public Date fields remain compatible with agent code compiled against that model.

Malformed individual flags are skipped so valid flags can continue evaluating, but operators need a payload-free warning when a flag is rejected. Exposure contexts can also contain OpenFeature Instant values; sending those objects directly to Moshi can make exposure serialization fail repeatedly and block later batches.

Changes

The remote-config parser reads allocation startAt and endAt values through an Instant adapter and constructs allocations with Allocation.fromInstants. The Allocation model retains its public Date startAt and Date endAt fields for compatibility, while private precise Instant values and accessors preserve sub-millisecond timestamps for evaluator comparisons. Existing callers that construct allocations with Date continue to work.

When a flag cannot be parsed, the parser still skips only that flag and now emits a warning containing the flag key and parser error summary. The log excludes the flag payload and stack trace.

OpenFeature Instant context values are flattened to ISO-8601 strings before exposure serialization. Exposure serialization failures now log and drop only the poisoned batch, while transport failures retain the existing retry behavior.

Tests cover UTC offsets and fractional precision, retained Date compatibility, microsecond allocation boundaries, the real JsonReader.Token.NULL adapter path, Instant context flattening, and recovery after an unserializable exposure batch.

Decisions

Preserve the UFC v1 public Date fields instead of introducing an ABI-breaking field-type change. Precise Instant storage remains internal and evaluator code uses the accessors.

Keep ISO_OFFSET_DATE_TIME parsing so timestamps with offsets such as +01:00 and -05:00 remain accepted.

Keep malformed-flag logging summary-only. Passing the exception as a throwable argument could add stack-trace output, which is intentionally excluded from this warning.

Drop only batches that cannot be serialized. Continue retrying network and EVP delivery failures.

Validation

  • ./gradlew :products:feature-flagging:feature-flagging-bootstrap:spotlessCheck :products:feature-flagging:feature-flagging-lib:test :products:feature-flagging:feature-flagging-lib:spotlessCheck :products:feature-flagging:feature-flagging-api:test :products:feature-flagging:feature-flagging-api:spotlessCheck
    • BUILD SUCCESSFUL
  • ./gradlew :products:feature-flagging:feature-flagging-lib:test --tests com.datadog.featureflag.RemoteConfigServiceImplTest :products:feature-flagging:feature-flagging-lib:spotlessCheck
    • BUILD SUCCESSFUL in 18s

@leoromanovsky leoromanovsky added comp: openfeature OpenFeature comp: remote config Configuration at Runtime type: feature Enhancements and improvements tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes labels Jun 2, 2026
@datadog-datadog-prod-us1

This comment has been minimized.

@leoromanovsky leoromanovsky changed the title Use Instant for FFE allocation windows Use Instant and log dropped FFE flags Jun 2, 2026
Base automatically changed from leo.romanovsky/ffl-2339-java-provider-nonblocking-defaults to master June 2, 2026 17:52
…2339-instant-allocation-windows

# Conflicts:
#	products/feature-flagging/feature-flagging-lib/src/main/java/com/datadog/featureflag/RemoteConfigServiceImpl.java
#	products/feature-flagging/feature-flagging-lib/src/test/java/com/datadog/featureflag/RemoteConfigServiceImplTest.java
@dd-octo-sts

dd-octo-sts Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.07 s 13.98 s [-0.1%; +1.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.87 s 13.04 s [-2.1%; -0.5%] (maybe better)
startup:petclinic:appsec:Agent 16.91 s 16.69 s [+0.2%; +2.4%] (maybe worse)
startup:petclinic:iast:Agent 16.84 s 16.96 s [-1.6%; +0.2%] (no difference)
startup:petclinic:profiling:Agent 16.64 s 16.91 s [-2.7%; -0.4%] (maybe better)
startup:petclinic:sca:Agent 16.80 s 16.07 s [+0.1%; +8.9%] (maybe worse)
startup:petclinic:tracing:Agent 15.64 s 15.97 s [-6.3%; +2.2%] (no difference)

Commit: 1e10c60f · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@leoromanovsky
leoromanovsky marked this pull request as ready for review June 2, 2026 22:03
@leoromanovsky
leoromanovsky requested a review from a team as a code owner June 2, 2026 22:03
@leoromanovsky
leoromanovsky requested review from dd-oleksii and sameerank and removed request for a team June 2, 2026 22:03

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

LGTM! One tiny nit

@leoromanovsky
leoromanovsky enabled auto-merge June 3, 2026 20:15
@dd-octo-sts-c33ac5

dd-octo-sts-c33ac5 Bot commented Jun 5, 2026

Copy link
Copy Markdown

🐑 PR Shepherd is maintaining this PR

I watch your PR and automatically fix CI failures, rebase your branch, handle flaky tests, and push it to the merge queue when it's ready.

More about what I do → Guide

To pause me on this PR, add the flow-skip label.

…2339-instant-allocation-windows

# Conflicts:
#	products/feature-flagging/feature-flagging-lib/src/test/java/com/datadog/featureflag/RemoteConfigServiceImplTest.java
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 6, 2026
@leoromanovsky
leoromanovsky added this pull request to the merge queue Aug 6, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 6, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-06 04:04:32 UTC ℹ️ Start processing command /merge


2026-08-06 04:04:34 UTC ❌ MergeQueue

PR already in the queue with status in_progress

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 6, 2026
@PerfectSlayer PerfectSlayer removed the comp: remote config Configuration at Runtime label Aug 6, 2026
Exclude serialization failures from telemetry and log submission failures at debug level.

Environment: Datadog workspace
@leoromanovsky
leoromanovsky enabled auto-merge August 7, 2026 14:17
@leoromanovsky
leoromanovsky added this pull request to the merge queue Aug 7, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 7, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-07 14:51:19 UTC ℹ️ Start processing command /merge


2026-08-07 14:51:24 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-08-07 15:43:05 UTCMergeQueue: The build pipeline failed for this merge request

Build pipeline has failing jobs for ccdb965:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 7, 2026
@leoromanovsky
leoromanovsky added this pull request to the merge queue Aug 7, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 7, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-07 15:14:38 UTC ℹ️ Start processing command /merge


2026-08-07 15:14:40 UTC ❌ MergeQueue

PR already in the queue with status in_progress

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 7, 2026
@leoromanovsky

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 7, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-07 16:14:37 UTC ℹ️ Start processing command /merge


2026-08-07 16:14:42 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-08-07 17:03:35 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 4f6a1ea into master Aug 7, 2026
595 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the leo.romanovsky/ffl-2339-instant-allocation-windows branch August 7, 2026 17:03
@github-actions github-actions Bot added this to the 1.66.0 milestone Aug 7, 2026
@sarahchen6 sarahchen6 added the type: bug fix Bug fix label Aug 10, 2026
@PerfectSlayer PerfectSlayer removed the type: feature Enhancements and improvements label Aug 10, 2026
@sarahchen6 sarahchen6 removed the tag: no release notes Changes to exclude from release notes label Aug 10, 2026
@leoromanovsky leoromanovsky changed the title Use Instant and log dropped FFE flags [bug] Handle gracefully malformed flag evaluations; migrate Date->Instant Aug 10, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Remove the tag from the pull request title

If you need help, please check our contributing guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: openfeature OpenFeature tag: ai generated Largely based on code generated by an AI or LLM type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants