-
Notifications
You must be signed in to change notification settings - Fork 352
Send agentless Feature Flags exposures directly to EVP #12195
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
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b9e2b15
Send agentless exposures directly to EVP
leoromanovsky 085ebc5
Prepare exposure delivery before agentless activation
leoromanovsky 9992388
Assert lazy agentless configuration startup
leoromanovsky 3716594
log message
leoromanovsky 77cf62d
Merge remote-tracking branch 'origin/master' into agent/java-direct-e…
leoromanovsky 9ed502c
Defer direct exposure intake fallback
leoromanovsky a836431
test(openfeature): cover direct exposure fallback branches
leoromanovsky 3e668a1
fix(feature-flags): prevent lost agentless activation
leoromanovsky 3a10840
test(feature-flags): cover agentless startup rollback
leoromanovsky 614ec21
fix(feature-flags): remove obsolete SpotBugs suppression
leoromanovsky 6b3be03
fix(feature-flagging): defer agentless initialization
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
18 changes: 18 additions & 0 deletions
18
communication/src/main/java/datadog/communication/HttpResponseException.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,18 @@ | ||
| package datadog.communication; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** An HTTP request failed with a non-success response. */ | ||
| public final class HttpResponseException extends IOException { | ||
|
|
||
| private final int statusCode; | ||
|
|
||
| public HttpResponseException(final int statusCode, final String message) { | ||
| super(message); | ||
| this.statusCode = statusCode; | ||
| } | ||
|
|
||
| public int getStatusCode() { | ||
| return statusCode; | ||
| } | ||
| } |
65 changes: 65 additions & 0 deletions
65
communication/src/test/java/datadog/communication/EvpProxyApiTest.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,65 @@ | ||
| package datadog.communication; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
|
||
| import datadog.communication.http.HttpRetryPolicy; | ||
| import java.io.IOException; | ||
| import okhttp3.MediaType; | ||
| import okhttp3.OkHttpClient; | ||
| import okhttp3.RequestBody; | ||
| import okhttp3.mockwebserver.MockResponse; | ||
| import okhttp3.mockwebserver.MockWebServer; | ||
| import okhttp3.mockwebserver.RecordedRequest; | ||
| import org.junit.jupiter.api.AfterEach; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class EvpProxyApiTest { | ||
|
|
||
| private MockWebServer server; | ||
| private OkHttpClient client; | ||
|
|
||
| @BeforeEach | ||
| void setUp() throws IOException { | ||
| server = new MockWebServer(); | ||
| server.start(); | ||
| client = new OkHttpClient.Builder().build(); | ||
| } | ||
|
|
||
| @AfterEach | ||
| void tearDown() throws IOException { | ||
| client.dispatcher().executorService().shutdownNow(); | ||
| client.connectionPool().evictAll(); | ||
| server.shutdown(); | ||
| } | ||
|
|
||
| @Test | ||
| void reportsHttpStatusForRejectedRequest() throws Exception { | ||
| server.enqueue(new MockResponse().setResponseCode(404).setBody("not found")); | ||
| final EvpProxyApi api = | ||
| new EvpProxyApi( | ||
| "123", | ||
| server.url("/evp_proxy/v4/"), | ||
| "event-platform-intake", | ||
| HttpRetryPolicy.Factory.NEVER_RETRY, | ||
| client, | ||
| false); | ||
|
|
||
| final HttpResponseException exception = | ||
| assertThrows( | ||
| HttpResponseException.class, | ||
| () -> | ||
| api.post( | ||
| "exposures", | ||
| RequestBody.create(MediaType.parse("application/json"), "{}"), | ||
| stream -> null, | ||
| null, | ||
| false)); | ||
|
|
||
| assertEquals(404, exception.getStatusCode()); | ||
| final RecordedRequest request = server.takeRequest(); | ||
| assertEquals("/evp_proxy/v4/api/v2/exposures", request.getPath()); | ||
| assertEquals("event-platform-intake", request.getHeader("X-Datadog-EVP-Subdomain")); | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.