Repository navigation
Let applications record feature flag exposures with ExposureHook #12775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
danyal002
merged 13 commits into
danyal.khan/EX-3800-shared-exposure-cache
from
danyal.khan/EX-3815-exposure-hook
Oct 14, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5546cc8
Parse features on UFC splits
danyal002 96b182b
Cover the features adapter factory and exclude the Feature POJO from …
danyal002 de6f1aa
Let applications record feature flag exposures with ExposureHook
danyal002 b601b26
Parse the destinations of UFC split features
danyal002 45bf1fb
Deliver only HOOK features to exposure hooks
danyal002 7744320
Replace getCacheHit() with a primitive isCacheHit()
danyal002 4a665f2
Cap the unknown feature destinations the evaluator remembers
danyal002 5d6c7de
State when shouldSend() matches Datadog, and surface hook failures
danyal002 0a4631e
Test that the Datadog exposure logging setting turns sending off
danyal002 9135fa2
Lead the exposure README with the flag metadata any hook can read
danyal002 821c32a
Test evaluation with an agent whose Split has no features
danyal002 5dff911
Correct when shouldSend() matches what Datadog receives
danyal002 c2e1838
Send EXPOSURE and EVALUATION feature flag features to Datadog (#12797)
danyal002 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...-flagging-api/src/main/java/datadog/trace/api/openfeature/DatadogExposureLoggingGate.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package datadog.trace.api.openfeature; | ||
|
|
||
| import datadog.trace.api.featureflag.config.FeatureFlaggingConfig; | ||
| import datadog.trace.bootstrap.config.provider.ConfigProvider; | ||
| import java.util.function.BooleanSupplier; | ||
|
|
||
| /** | ||
| * Reads {@code DD_FEATURE_FLAGS_EXPOSURES_DATADOG_LOGGING_ENABLED} with full {@link ConfigProvider} | ||
| * precedence. When false, exposures are not sent to Datadog, but the exposure cache and customer | ||
| * {@link ExposureHook}s keep working. On by default. | ||
| */ | ||
| final class DatadogExposureLoggingGate { | ||
|
|
||
| private DatadogExposureLoggingGate() {} | ||
|
|
||
| static boolean isEnabled() { | ||
| return isEnabled( | ||
| () -> | ||
| ConfigProvider.getInstance() | ||
| .getBoolean( | ||
| FeatureFlaggingConfig.FEATURE_FLAGS_EXPOSURES_DATADOG_LOGGING_ENABLED, true)); | ||
|
danyal002 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| static boolean isEnabled(final BooleanSupplier setting) { | ||
| try { | ||
| return setting.getAsBoolean(); | ||
| } catch (final Throwable t) { | ||
| // Keep the default rather than silently stop sending exposures. | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 Comment from Claude working with Aaron Silverman:
[P2] Add a table to the README that maps each capability to the
dd-java-agentversion it needs, and state the oldest agent that this provider supports. With an older agent this map is empty, and nothing tells the reader why.dd-openfeatureanddd-java-agentship separately, and the provider turns a capability off when the installed agent lacks it. Today the only signal is a log line at startup: a warning for the serial-id checks, a debug message for the feature checks. This stack adds three of these checks. A table puts the rules in one place, and it shows which checks can go once the oldest supported agent reaches their version.Suggested section — fill in the three placeholders at release time
If you take the OpenFeature SDK bump that I suggested on #12774, add one more line under the table: "Sending exposures through OpenFeature's
MultiProvideralso needsdev.openfeature:sdk1.23.0 or later."Where the versions come from — the first release tag that contains each class, field or constructor
ExposureEvent(traced across the module move in #10412)8aa326fafev1.56.0Split.serialId(#11658)05671ce3b0v1.65.0FlagEvalEvent95065ee8b2v1.66.0ExposureEventconstructor with a serial id (#12432)598bc41cdbv1.67.0These tags show when each piece first shipped. I did not check that the current provider runs end to end on each of those agents, so the oldest supported version is for you to fill in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an "Agent versions" table in 9135fa2, checked against the release tags: serial ids on splits need 1.65.0, flag evaluation events 1.66.0, and serial ids on exposures 1.67.0. I left out the oldest supported agent, because I could not confirm it. I will add it once it is settled.
This was replied to by Claude.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 Comment from Claude working with Aaron Silverman:
[P3] Replace "The first release that includes this change" with a version number before release, and add rows for #12797's two capabilities. As written, that placeholder would ship in the README.
#12797 adds features on exposures and on flag evaluation events, each behind its own agent check (
EXPOSURE_FEATURES_SUPPORTED,FlagEvalLoggingHook.FEATURES_SUPPORTED), but it does not change the README. These capabilities can arrive in a later agent release thanSplit.features, so give each row its own version, even if the numbers end up the same. Leaving out the oldest supported agent until it is confirmed is fine.Suggested rows — fill in each version at release