-
Notifications
You must be signed in to change notification settings - Fork 347
Add agentless Feature Flagging configuration source #11892
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
Open
leoromanovsky
wants to merge
24
commits into
master
Choose a base branch
from
leo.romanovsky/ffl-2693-java-agentless-configuration-source
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b8bbd26
Define Feature Flagging configuration source contract
leoromanovsky 4baefdb
Add Datadog-managed agentless UFC polling
leoromanovsky d378350
Support custom agentless UFC endpoints
leoromanovsky f9e70e6
Select the Feature Flagging configuration source
leoromanovsky 17a02ad
Warn on agentless authentication failures
leoromanovsky 0f02a2a
Merge remote-tracking branch 'origin/master' into rewrite/java-agentl…
leoromanovsky 5057539
fix(ffe): handle nullable agentless response bodies
leoromanovsky 7aa2181
Merge branch 'master' into leo.romanovsky/ffl-2693-java-agentless-con…
leoromanovsky ffbf970
Address agentless poller review feedback
leoromanovsky 3b9b97c
Fix feature flag config test imports
leoromanovsky eaaea27
Address additional agentless source review feedback
leoromanovsky 76917d6
Support the UFC CDN response contract
leoromanovsky 2cee183
Harden agentless configuration responses
leoromanovsky ebc28ca
Separate UFC transport parsers
leoromanovsky 0984370
Fix feature flagging test formatting
leoromanovsky c146f09
Fix feature flagging parser coverage
leoromanovsky 488b477
Address final feature flagging review feedback
leoromanovsky c0575ac
Merge branch 'master' into leo.romanovsky/ffl-2693-java-agentless-con…
vjfridge 3ae9cf0
Merge branch 'master' into leo.romanovsky/ffl-2693-java-agentless-con…
leoromanovsky eaa99ce
fix(feature-flags): align configuration source semantics
leoromanovsky 2c0ee6c
feat(feature-flags): delay agentless polling until provider use
leoromanovsky bd0e347
feat(communication): support mapped retried HTTP calls
leoromanovsky cfaca97
fix(feature-flags): align agentless HTTP behavior
leoromanovsky 6df48d1
fix(feature-flags): complete initial poll during activation
leoromanovsky 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
53 changes: 53 additions & 0 deletions
53
communication/src/test/java/datadog/communication/http/OkHttpUtilsRetryTest.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,53 @@ | ||
| package datadog.communication.http; | ||
|
|
||
| import static datadog.communication.http.OkHttpUtils.sendWithRetries; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| import java.net.ConnectException; | ||
| import java.util.concurrent.atomic.AtomicInteger; | ||
| import okhttp3.Call; | ||
| import okhttp3.OkHttpClient; | ||
| import okhttp3.Request; | ||
| import okhttp3.ResponseBody; | ||
| import okhttp3.mockwebserver.MockResponse; | ||
| import okhttp3.mockwebserver.MockWebServer; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class OkHttpUtilsRetryTest { | ||
|
|
||
| @Test | ||
| void retriesResponseMappingFailureThroughCallFactory() throws Exception { | ||
| final MockWebServer server = new MockWebServer(); | ||
| final OkHttpClient client = new OkHttpClient(); | ||
| final AtomicInteger mappingAttempts = new AtomicInteger(); | ||
| server.enqueue(new MockResponse().setBody("first")); | ||
| server.enqueue(new MockResponse().setBody("second")); | ||
| server.start(); | ||
|
|
||
| try { | ||
| final Request request = new Request.Builder().url(server.url("/configuration")).build(); | ||
|
|
||
| final String body = | ||
| sendWithRetries( | ||
| (Call.Factory) client, | ||
| new HttpRetryPolicy.Factory(1, 0, 1), | ||
| request, | ||
| response -> { | ||
| try (ResponseBody responseBody = response.body()) { | ||
| if (mappingAttempts.getAndIncrement() == 0) { | ||
| throw new ConnectException("response body could not be mapped"); | ||
| } | ||
| return responseBody.string(); | ||
| } | ||
| }); | ||
|
|
||
| assertEquals("second", body); | ||
| assertEquals(2, mappingAttempts.get()); | ||
| assertEquals(2, server.getRequestCount()); | ||
| } finally { | ||
| client.dispatcher().executorService().shutdownNow(); | ||
| client.connectionPool().evictAll(); | ||
| server.shutdown(); | ||
| } | ||
| } | ||
| } |
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
48 changes: 48 additions & 0 deletions
48
...nt-bootstrap/src/test/java/datadog/trace/bootstrap/AgentFeatureFlaggingLifecycleTest.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,48 @@ | ||
| package datadog.trace.bootstrap; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| import java.util.concurrent.atomic.AtomicInteger; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class AgentFeatureFlaggingLifecycleTest { | ||
|
|
||
| @BeforeEach | ||
| void reset() { | ||
| FakeFeatureFlaggingSystem.stopCalls.set(0); | ||
| } | ||
|
|
||
| @Test | ||
| void shutdownInvokesFeatureFlaggingSystemStopThroughAgentClassLoader() { | ||
| final ClassLoader classLoader = | ||
| new ClassLoader(null) { | ||
| @Override | ||
| public Class<?> loadClass(final String name) throws ClassNotFoundException { | ||
| if ("com.datadog.featureflag.FeatureFlaggingSystem".equals(name)) { | ||
| return FakeFeatureFlaggingSystem.class; | ||
| } | ||
| return super.loadClass(name); | ||
| } | ||
| }; | ||
|
|
||
| Agent.shutdownFeatureFlagging(classLoader); | ||
|
|
||
| assertEquals(1, FakeFeatureFlaggingSystem.stopCalls.get()); | ||
| } | ||
|
|
||
| @Test | ||
| void shutdownIsNoopBeforeAgentClassLoaderExists() { | ||
| Agent.shutdownFeatureFlagging(null); | ||
|
|
||
| assertEquals(0, FakeFeatureFlaggingSystem.stopCalls.get()); | ||
| } | ||
|
|
||
| public static final class FakeFeatureFlaggingSystem { | ||
| private static final AtomicInteger stopCalls = new AtomicInteger(); | ||
|
|
||
| public static void stop() { | ||
| stopCalls.incrementAndGet(); | ||
| } | ||
| } | ||
| } |
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
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.
can this line be removed now that
AgentFeature.FEATURE_FLAGGINGis no longer referenced on line 286?