Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 9631ced

Browse files
LaunchDarklyReleaseBoteli-darklyLaunchDarklyReleaseBotaengelbergantonmos
authored
prepare 6.1.0 release (#306)
* add contextKinds to summary + misc fixes * events schema 4 * update client API to use contexts; enable v2 contract tests * misc fixes * javadoc & test app fixes * javadoc fix * javadoc fix * unskip some tests since the behavior was fixed in java-sdk-common * bad attribute in clause should be reported as an error * update TestData to be context-aware * misc fixes + javadoc * fix allFlagsState to not generate prereq eval events * factor context deduplication logic out of DefaultEventProcessor * fix JSON serialization test * refactor diagnostic events logic to abstract out server-side-specific info * separate inner events implementation from public interface, don't expose event types * fix benchmarks * fix benchmarks * rm unused * rm unused * separate Java-SDK-specific HTTP functionality from events logic * fix tests * don't close the underlying Writer when we stop using the JsonWriter * rm unused * remove references to Java 8 types and Guava from shared event/HTTP code * fix benchmarks * also try not to use java.time.Duration in the event tests * also avoid using lambdas in event test code * move shared code into internal packages before splitting it off * add "...ForAll" TestData methods to replace "...ForAllUsers" * replace all component factory interfaces with a single generic one * change HttpConfiguration and LoggingConfiguration to concrete classes * bump okhttp & okhttp-eventsource dependencies * update comment to clarify that level() doesn't apply to SLF4J * update readme to mention different logging examples in hello-java * switch to use snapshot build of java-logging, pending next release * level setting does not apply to SLF4J and JUL * use java-logging 1.1.0 release * make sure META-INF files are never mistaken for classes and relocated * update shared data store test logic to pass ClientContext with logger * enable external javadoc links for com.launchdarkly.logging types * use variable for dependency version * remove another Guava usage * make events test code independent of server-side data model * fix flaky big segment status polling tests * fix benchmark code * update benchmarks * javadoc formatting * javadocs * undo accidental reversion * remove some more stray references to java-server-sdk test helper code * more efficient equals() and hashCode() for Operator * method can be static * clarify comment * typo * remove event logic, migrate to using java-sdk-internal * adjust for API change * use constant * fix packaging tests * remove inapplicable benchmarks * add error message if makefile can't run * force result to be "not in experiment" if bucketing calculation failed due to context kind not found * use newer HTTP/TCP test helpers * Update Windows orb, fix Windows JDK install in CI (#372) * update snakeyaml for CVE-CVE-2022-25857 * latest snakeyaml is 1.31 * bump snakeyaml version for CVE-2022-38752 * disable Windows Java 11 build * minor test updates for java-sdk-internal API changes * fix packaging of com.launchdarkly.logging classes * rm debugging * reconsidered - let's include the logging classes in the jars * fix packaging test logic * correct documentation * remove secondary meta-attribute * rm obsolete references to UserAttribute * support passing LDUser instead of LDContext in all SDK methods (#379) * support passing LDUser instead of LDContext in all SDK methods * actually we should use default methods * rm unused * enable test capability for user type * update java-sdk-common dependency * use okhttp-eventsource 3.0.0-SNAPSHOT * use non-snapshot okhttp-eventsource * include nested segment references in dependency update checks * use java-sdk-internal 1.0.0 * remove SLF4J dependency, remove "all" jar, simplify build (#381) * don't generate evaluation events for invalid context * use synchronous EventSource * comments * revise implementation of special HTTP configurations test * make sure we set readTimeout last * use okhttp-eventsource 4.0.0 * use newer HTTP test helpers (#385) * use synchronous EventSource (5.x backport) * update Gradle to 7.6 + fix snapshot releases * fix #288 (#289) * add unit test for externally-contributed YAML security fix * backport YAML CVE fix from 6.x * prepare 5.10.5 release (#290) * update CI and Gradle to test with newer JDKs (#259) * update okhttp to 3.14.9 (fixes incompatibility with OpenJDK 8.0.252) * prepare 4.14.2 release (#205) * Releasing version 4.14.2 * update okhttp to 4.8.1 (fixes incompatibility with OpenJDK 8.0.252) * gitignore * Bump SnakeYAML from 1.19 to 1.26 to address CVE-2017-18640 * prepare 4.14.3 release (#209) * Releasing version 4.14.3 * comments * only log initialization message once in polling mode * [ch89935] Correct some logging call format strings (#264) Also adds debug logs for full exception information in a couple locations. * [ch90109] Remove outdated trackMetric comment from before service support. (#265) * Fix compatibility with Java 7. * Remove import that is no longer used. * add Java 7 build (#267) * prepare 4.14.4 release (#214) * Releasing version 4.14.4 * add and use getSocketFactory * alignment * add socketFactory to builder * test socket factory builder * preserve dummy CI config file when pushing to gh-pages (#271) * fix concatenation when base URI has a context path (#270) * fix shaded jar builds to exclude Jackson classes and not modify Jackson return types (#268) * add test httpClientCanUseCustomSocketFactory for DefaultFeatureRequestor * add httpClientCanUseCustomSocketFactory() test for DefaultEventSenderTest * add httpClientCanUseCustomSocketFactory() test to StreamProcessorTest * pass URI to in customSocketFactory event test * make test less ambiguous * copy rules to new FlagBuilder instances (#273) * Bump guava version (#274) * Removed the guides link * increment versions when loading file data, so FlagTracker will work (#275) * increment versions when loading file data, so FlagTracker will work * update doc comment about flag change events with file data * add ability to ignore duplicate keys in file data (#276) * add alias events (#278) * add alias events and function * update tests for new functionality * update javadoc strings * add validation of javadoc build to CI * update commons-codec to 1.15 (#279) * Add support for experiment rollouts * add tests and use seed for allocating user to partition * test serialization and add check for isExperiment * fix PollingProcessorTest test race condition + other test issues (#282) * use launchdarkly-java-sdk-common 1.1.0-alpha-expalloc.2 * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * changes per code review comments * Please enter the commit message for your changes. Lines starting * fix null pointer exception * address code review comments * address more comments * missed a ! for isUntracked() * fix default boolean for json * make untracked FALSE by default * refactoring of bucketing logic to remove the need for an extra result object (#283) * add comment to enum * various JSON fixes, update common-sdk (#284) * simlpify the logic and make it match node/.Net sdks * Update src/main/java/com/launchdarkly/sdk/server/EventFactory.java Co-authored-by: Sam Stokes <[email protected]> * add the same comment as the Node SDK * Remove outdated/meaningless doc comment. (#286) * protect against NPEs if flag/segment JSON contains a null value * use java-sdk-common 1.2.0 * fix Jackson-related build issues (again) (#288) * update to okhttp-eventsource patch for stream retry bug, improve tests (#289) * update to okhttp-eventsource patch for stream retry bug, improve test * add test for appropriate stream retry * add public builder for FeatureFlagsState (#290) * add public builder for FeatureFlagsState * javadoc fixes * clarify FileData doc comment to say you shouldn't use offline mode (#291) * improve validation of SDK key so we won't throw an exception that contains the key (#293) * fix javadoc link in FileData comment (#294) * fix PollingProcessor 401 behavior and use new HTTP test helpers (#292) * re-fix metadata to remove Jackson dependencies, also remove Class-Path from manifest (#295) * make FeatureFlagsState.Builder.build() public (#297) * clean up tests using java-test-helpers 1.1.0 (#296) * use Releaser v2 config + newer CI images (#298) * [ch123129] Fix `PollingDataSourceBuilder` example. (#299) * Updates docs URLs * always use US locale when parsing HTTP dates * use Gson 2.8.9 * don't try to send more diagnostic events after an unrecoverable HTTP error * ensure module-info file isn't copied into our jars during build * use Gradle 7 * update build for benchmarks * more Gradle 7 compatibility changes for benchmark job * test with Java 17 in CI (#307) * test with Java 17 in CI * also test in Java 17 for Windows * fix choco install command * do date comparisons as absolute times, regardless of time zone (#310) * fix suppression of nulls in JSON representations (#311) * fix suppression of nulls in JSON representations * distinguish between situations where we do or do not want to suppress nulls * fix identify/track null user key check, also don't create index event for alias * use latest java-sdk-common * fix setting of trackEvents/trackReason in allFlagsState data when there's an experiment * implement contract tests (#314) * Merge Big Segments feature branch for 5.7.0 release (#316) Includes Big Segments implementation and contract test support for the new behavior. * Fix for pom including SDK common library as a dependency. (#317) * use new logging API * update readme notes about logging * set base logger name for SDK per test * comment * javadoc fixes * revert accidental commit * Upload JUnit XML to CircleCI on failure (#320) Fix a bug in the CircleCI config that was only uploading JUnit XML on _success_, not failure. * Add application tag support (#319) * Enforce 64 character limit on application tag values (#323) * fix "wrong type" logic in evaluations when default value is null * Rename master to main in .ldrelease/config.yml (#325) * Simpler way of setting base URIs in Java (#322) Now supports the `ServiceEndpoints` config for setting custom URIs for endpoints in a single place * update logging info in readme * use 1.0.0 release of logging package * misc cleanup * remove unnecessary extra interfaces, just use default methods instead * make BigSegmentStoreWrapper.pollingDetectsStaleStatus test less timing-sensitive * make LDEndToEndClientTest.test____SpecialHttpConfigurations less timing-sensitive * make data source status tests less timing-sensitive * use streaming JSON parsing for incoming LD data * fix tests * rm unused * rm unused * use okhttp-eventsource 2.6.0 * update eventsource to 2.6.1 to fix pom/manifest problem * increase efficiency of summary event data structures (#335) * make reusable EvaluationDetail instances as part of flag preprocessing (#336) * make evaluator result object immutable and reuse instances * comment * avoid creating List iterators during evaluations * remove unnecessary copy * fix allFlagsState to not generate prereq eval events * add "...ForAll" TestData methods to replace "...ForAllUsers" * bump okhttp & okhttp-eventsource dependencies * update comment to clarify that level() doesn't apply to SLF4J * update readme to mention different logging examples in hello-java * switch to use snapshot build of java-logging, pending next release * level setting does not apply to SLF4J and JUL * use java-logging 1.1.0 release * make sure META-INF files are never mistaken for classes and relocated * update shared data store test logic to pass ClientContext with logger * enable external javadoc links for com.launchdarkly.logging types * use variable for dependency version * fix flaky big segment status polling tests * Update Windows orb, fix Windows JDK install in CI (#372) * update snakeyaml for CVE-CVE-2022-25857 * latest snakeyaml is 1.31 * bump snakeyaml version for CVE-2022-38752 * disable Windows Java 11 build * fix packaging of com.launchdarkly.logging classes * rm debugging * reconsidered - let's include the logging classes in the jars * fix packaging test logic * correct documentation * use synchronous EventSource (5.x backport) * backport YAML CVE fix from 6.x Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: ssrm <[email protected]> Co-authored-by: Harpo Roeder <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Elliot <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Sam Stokes <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Ember Stevens <[email protected]> Co-authored-by: ember-stevens <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> * Releasing version 5.10.5 * don't allow uncaught RuntimeException on stream thread and don't report errors on shutdown * prepare 5.10.6 release (#292) * prepare 4.14.2 release (#205) * Releasing version 4.14.2 * update okhttp to 4.8.1 (fixes incompatibility with OpenJDK 8.0.252) * gitignore * Bump SnakeYAML from 1.19 to 1.26 to address CVE-2017-18640 * prepare 4.14.3 release (#209) * Releasing version 4.14.3 * comments * only log initialization message once in polling mode * [ch89935] Correct some logging call format strings (#264) Also adds debug logs for full exception information in a couple locations. * [ch90109] Remove outdated trackMetric comment from before service support. (#265) * Fix compatibility with Java 7. * Remove import that is no longer used. * add Java 7 build (#267) * prepare 4.14.4 release (#214) * Releasing version 4.14.4 * add and use getSocketFactory * alignment * add socketFactory to builder * test socket factory builder * preserve dummy CI config file when pushing to gh-pages (#271) * fix concatenation when base URI has a context path (#270) * fix shaded jar builds to exclude Jackson classes and not modify Jackson return types (#268) * add test httpClientCanUseCustomSocketFactory for DefaultFeatureRequestor * add httpClientCanUseCustomSocketFactory() test for DefaultEventSenderTest * add httpClientCanUseCustomSocketFactory() test to StreamProcessorTest * pass URI to in customSocketFactory event test * make test less ambiguous * copy rules to new FlagBuilder instances (#273) * Bump guava version (#274) * Removed the guides link * increment versions when loading file data, so FlagTracker will work (#275) * increment versions when loading file data, so FlagTracker will work * update doc comment about flag change events with file data * add ability to ignore duplicate keys in file data (#276) * add alias events (#278) * add alias events and function * update tests for new functionality * update javadoc strings * add validation of javadoc build to CI * update commons-codec to 1.15 (#279) * Add support for experiment rollouts * add tests and use seed for allocating user to partition * test serialization and add check for isExperiment * fix PollingProcessorTest test race condition + other test issues (#282) * use launchdarkly-java-sdk-common 1.1.0-alpha-expalloc.2 * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * changes per code review comments * Please enter the commit message for your changes. Lines starting * fix null pointer exception * address code review comments * address more comments * missed a ! for isUntracked() * fix default boolean for json * make untracked FALSE by default * refactoring of bucketing logic to remove the need for an extra result object (#283) * add comment to enum * various JSON fixes, update common-sdk (#284) * simlpify the logic and make it match node/.Net sdks * Update src/main/java/com/launchdarkly/sdk/server/EventFactory.java Co-authored-by: Sam Stokes <[email protected]> * add the same comment as the Node SDK * Remove outdated/meaningless doc comment. (#286) * protect against NPEs if flag/segment JSON contains a null value * use java-sdk-common 1.2.0 * fix Jackson-related build issues (again) (#288) * update to okhttp-eventsource patch for stream retry bug, improve tests (#289) * update to okhttp-eventsource patch for stream retry bug, improve test * add test for appropriate stream retry * add public builder for FeatureFlagsState (#290) * add public builder for FeatureFlagsState * javadoc fixes * clarify FileData doc comment to say you shouldn't use offline mode (#291) * improve validation of SDK key so we won't throw an exception that contains the key (#293) * fix javadoc link in FileData comment (#294) * fix PollingProcessor 401 behavior and use new HTTP test helpers (#292) * re-fix metadata to remove Jackson dependencies, also remove Class-Path from manifest (#295) * make FeatureFlagsState.Builder.build() public (#297) * clean up tests using java-test-helpers 1.1.0 (#296) * use Releaser v2 config + newer CI images (#298) * [ch123129] Fix `PollingDataSourceBuilder` example. (#299) * Updates docs URLs * always use US locale when parsing HTTP dates * use Gson 2.8.9 * don't try to send more diagnostic events after an unrecoverable HTTP error * ensure module-info file isn't copied into our jars during build * use Gradle 7 * update build for benchmarks * more Gradle 7 compatibility changes for benchmark job * test with Java 17 in CI (#307) * test with Java 17 in CI * also test in Java 17 for Windows * fix choco install command * do date comparisons as absolute times, regardless of time zone (#310) * fix suppression of nulls in JSON representations (#311) * fix suppression of nulls in JSON representations * distinguish between situations where we do or do not want to suppress nulls * fix identify/track null user key check, also don't create index event for alias * use latest java-sdk-common * fix setting of trackEvents/trackReason in allFlagsState data when there's an experiment * implement contract tests (#314) * Merge Big Segments feature branch for 5.7.0 release (#316) Includes Big Segments implementation and contract test support for the new behavior. * Fix for pom including SDK common library as a dependency. (#317) * use new logging API * update readme notes about logging * set base logger name for SDK per test * comment * javadoc fixes * revert accidental commit * Upload JUnit XML to CircleCI on failure (#320) Fix a bug in the CircleCI config that was only uploading JUnit XML on _success_, not failure. * Add application tag support (#319) * Enforce 64 character limit on application tag values (#323) * fix "wrong type" logic in evaluations when default value is null * Rename master to main in .ldrelease/config.yml (#325) * Simpler way of setting base URIs in Java (#322) Now supports the `ServiceEndpoints` config for setting custom URIs for endpoints in a single place * update logging info in readme * use 1.0.0 release of logging package * misc cleanup * remove unnecessary extra interfaces, just use default methods instead * make BigSegmentStoreWrapper.pollingDetectsStaleStatus test less timing-sensitive * make LDEndToEndClientTest.test____SpecialHttpConfigurations less timing-sensitive * make data source status tests less timing-sensitive * use streaming JSON parsing for incoming LD data * fix tests * rm unused * rm unused * use okhttp-eventsource 2.6.0 * update eventsource to 2.6.1 to fix pom/manifest problem * increase efficiency of summary event data structures (#335) * make reusable EvaluationDetail instances as part of flag preprocessing (#336) * make evaluator result object immutable and reuse instances * comment * avoid creating List iterators during evaluations * remove unnecessary copy * fix allFlagsState to not generate prereq eval events * add "...ForAll" TestData methods to replace "...ForAllUsers" * bump okhttp & okhttp-eventsource dependencies * update comment to clarify that level() doesn't apply to SLF4J * update readme to mention different logging examples in hello-java * switch to use snapshot build of java-logging, pending next release * level setting does not apply to SLF4J and JUL * use java-logging 1.1.0 release * make sure META-INF files are never mistaken for classes and relocated * update shared data store test logic to pass ClientContext with logger * enable external javadoc links for com.launchdarkly.logging types * use variable for dependency version * fix flaky big segment status polling tests * Update Windows orb, fix Windows JDK install in CI (#372) * update snakeyaml for CVE-CVE-2022-25857 * latest snakeyaml is 1.31 * bump snakeyaml version for CVE-2022-38752 * disable Windows Java 11 build * fix packaging of com.launchdarkly.logging classes * rm debugging * reconsidered - let's include the logging classes in the jars * fix packaging test logic * correct documentation * use synchronous EventSource (5.x backport) * backport YAML CVE fix from 6.x * don't allow uncaught RuntimeException on stream thread and don't report errors on shutdown Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: ssrm <[email protected]> Co-authored-by: Harpo Roeder <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Elliot <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Sam Stokes <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Ember Stevens <[email protected]> Co-authored-by: ember-stevens <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> * Releasing version 5.10.6 * don't log a JSON error if the stream closes while we're parsing an event (#391) * prepare 5.10.7 release (#294) * Releasing version 4.14.2 * update okhttp to 4.8.1 (fixes incompatibility with OpenJDK 8.0.252) * gitignore * Bump SnakeYAML from 1.19 to 1.26 to address CVE-2017-18640 * prepare 4.14.3 release (#209) * Releasing version 4.14.3 * comments * only log initialization message once in polling mode * [ch89935] Correct some logging call format strings (#264) Also adds debug logs for full exception information in a couple locations. * [ch90109] Remove outdated trackMetric comment from before service support. (#265) * Fix compatibility with Java 7. * Remove import that is no longer used. * add Java 7 build (#267) * prepare 4.14.4 release (#214) * Releasing version 4.14.4 * add and use getSocketFactory * alignment * add socketFactory to builder * test socket factory builder * preserve dummy CI config file when pushing to gh-pages (#271) * fix concatenation when base URI has a context path (#270) * fix shaded jar builds to exclude Jackson classes and not modify Jackson return types (#268) * add test httpClientCanUseCustomSocketFactory for DefaultFeatureRequestor * add httpClientCanUseCustomSocketFactory() test for DefaultEventSenderTest * add httpClientCanUseCustomSocketFactory() test to StreamProcessorTest * pass URI to in customSocketFactory event test * make test less ambiguous * copy rules to new FlagBuilder instances (#273) * Bump guava version (#274) * Removed the guides link * increment versions when loading file data, so FlagTracker will work (#275) * increment versions when loading file data, so FlagTracker will work * update doc comment about flag change events with file data * add ability to ignore duplicate keys in file data (#276) * add alias events (#278) * add alias events and function * update tests for new functionality * update javadoc strings * add validation of javadoc build to CI * update commons-codec to 1.15 (#279) * Add support for experiment rollouts * add tests and use seed for allocating user to partition * test serialization and add check for isExperiment * fix PollingProcessorTest test race condition + other test issues (#282) * use launchdarkly-java-sdk-common 1.1.0-alpha-expalloc.2 * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * Update src/test/java/com/launchdarkly/sdk/server/EvaluatorTest.java Co-authored-by: Sam Stokes <[email protected]> * changes per code review comments * Please enter the commit message for your changes. Lines starting * fix null pointer exception * address code review comments * address more comments * missed a ! for isUntracked() * fix default boolean for json * make untracked FALSE by default * refactoring of bucketing logic to remove the need for an extra result object (#283) * add comment to enum * various JSON fixes, update common-sdk (#284) * simlpify the logic and make it match node/.Net sdks * Update src/main/java/com/launchdarkly/sdk/server/EventFactory.java Co-authored-by: Sam Stokes <[email protected]> * add the same comment as the Node SDK * Remove outdated/meaningless doc comment. (#286) * protect against NPEs if flag/segment JSON contains a null value * use java-sdk-common 1.2.0 * fix Jackson-related build issues (again) (#288) * update to okhttp-eventsource patch for stream retry bug, improve tests (#289) * update to okhttp-eventsource patch for stream retry bug, improve test * add test for appropriate stream retry * add public builder for FeatureFlagsState (#290) * add public builder for FeatureFlagsState * javadoc fixes * clarify FileData doc comment to say you shouldn't use offline mode (#291) * improve validation of SDK key so we won't throw an exception that contains the key (#293) * fix javadoc link in FileData comment (#294) * fix PollingProcessor 401 behavior and use new HTTP test helpers (#292) * re-fix metadata to remove Jackson dependencies, also remove Class-Path from manifest (#295) * make FeatureFlagsState.Builder.build() public (#297) * clean up tests using java-test-helpers 1.1.0 (#296) * use Releaser v2 config + newer CI images (#298) * [ch123129] Fix `PollingDataSourceBuilder` example. (#299) * Updates docs URLs * always use US locale when parsing HTTP dates * use Gson 2.8.9 * don't try to send more diagnostic events after an unrecoverable HTTP error * ensure module-info file isn't copied into our jars during build * use Gradle 7 * update build for benchmarks * more Gradle 7 compatibility changes for benchmark job * test with Java 17 in CI (#307) * test with Java 17 in CI * also test in Java 17 for Windows * fix choco install command * do date comparisons as absolute times, regardless of time zone (#310) * fix suppression of nulls in JSON representations (#311) * fix suppression of nulls in JSON representations * distinguish between situations where we do or do not want to suppress nulls * fix identify/track null user key check, also don't create index event for alias * use latest java-sdk-common * fix setting of trackEvents/trackReason in allFlagsState data when there's an experiment * implement contract tests (#314) * Merge Big Segments feature branch for 5.7.0 release (#316) Includes Big Segments implementation and contract test support for the new behavior. * Fix for pom including SDK common library as a dependency. (#317) * use new logging API * update readme notes about logging * set base logger name for SDK per test * comment * javadoc fixes * revert accidental commit * Upload JUnit XML to CircleCI on failure (#320) Fix a bug in the CircleCI config that was only uploading JUnit XML on _success_, not failure. * Add application tag support (#319) * Enforce 64 character limit on application tag values (#323) * fix "wrong type" logic in evaluations when default value is null * Rename master to main in .ldrelease/config.yml (#325) * Simpler way of setting base URIs in Java (#322) Now supports the `ServiceEndpoints` config for setting custom URIs for endpoints in a single place * update logging info in readme * use 1.0.0 release of logging package * misc cleanup * remove unnecessary extra interfaces, just use default methods instead * make BigSegmentStoreWrapper.pollingDetectsStaleStatus test less timing-sensitive * make LDEndToEndClientTest.test____SpecialHttpConfigurations less timing-sensitive * make data source status tests less timing-sensitive * use streaming JSON parsing for incoming LD data * fix tests * rm unused * rm unused * use okhttp-eventsource 2.6.0 * update eventsource to 2.6.1 to fix pom/manifest problem * increase efficiency of summary event data structures (#335) * make reusable EvaluationDetail instances as part of flag preprocessing (#336) * make evaluator result object immutable and reuse instances * comment * avoid creating List iterators during evaluations * remove unnecessary copy * fix allFlagsState to not generate prereq eval events * add "...ForAll" TestData methods to replace "...ForAllUsers" * bump okhttp & okhttp-eventsource dependencies * update comment to clarify that level() doesn't apply to SLF4J * update readme to mention different logging examples in hello-java * switch to use snapshot build of java-logging, pending next release * level setting does not apply to SLF4J and JUL * use java-logging 1.1.0 release * make sure META-INF files are never mistaken for classes and relocated * update shared data store test logic to pass ClientContext with logger * enable external javadoc links for com.launchdarkly.logging types * use variable for dependency version * fix flaky big segment status polling tests * Update Windows orb, fix Windows JDK install in CI (#372) * update snakeyaml for CVE-CVE-2022-25857 * latest snakeyaml is 1.31 * bump snakeyaml version for CVE-2022-38752 * disable Windows Java 11 build * fix packaging of com.launchdarkly.logging classes * rm debugging * reconsidered - let's include the logging classes in the jars * fix packaging test logic * correct documentation * use synchronous EventSource (5.x backport) * backport YAML CVE fix from 6.x * don't allow uncaught RuntimeException on stream thread and don't report errors on shutdown * don't log a JSON error if the stream closes while we're parsing an event (#391) Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: ssrm <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Harpo Roeder <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Elliot <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Sam Stokes <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Ember Stevens <[email protected]> Co-authored-by: ember-stevens <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> * Releasing version 5.10.7 * fix: segment cycle detection * Currently passing harness tests, but need to clean up query param code. It's not very elegant or future proof at the moment * Minor changes moving helper function into internal repo * chore: bump snakeyaml * fix: Yaml constructor * Additional unit tests for filtering and cleaning up * Bumping java-sdk-internal --------- Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> Co-authored-by: Anton Mostovoy <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: ssrm <[email protected]> Co-authored-by: Harpo Roeder <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Elliot <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Robert J. Neal <[email protected]> Co-authored-by: Sam Stokes <[email protected]> Co-authored-by: Ember Stevens <[email protected]> Co-authored-by: ember-stevens <[email protected]> Co-authored-by: Alex Engelberg <[email protected]> Co-authored-by: Louis Chan <[email protected]> Co-authored-by: Louis Chan <[email protected]> Co-authored-by: Todd Anderson <[email protected]> Co-authored-by: tanderson-ld <[email protected]>
1 parent 12a235b commit 9631ced

File tree

15 files changed

+215
-67
lines changed

15 files changed

+215
-67
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ ext.versions = [
7373
"guava": "30.1-jre",
7474
"jackson": "2.11.2",
7575
"launchdarklyJavaSdkCommon": "2.0.0",
76-
"launchdarklyJavaSdkInternal": "1.0.0",
76+
"launchdarklyJavaSdkInternal": "1.1.0",
7777
"launchdarklyLogging": "1.1.0",
7878
"okhttp": "4.9.3", // specify this for the SDK build instead of relying on the transitive dependency from okhttp-eventsource
7979
"okhttpEventsource": "4.1.0",

contract-tests/service/src/main/java/sdktest/Representations.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static class SdkConfigParams {
3535
public static class SdkConfigStreamParams {
3636
URI baseUri;
3737
long initialRetryDelayMs;
38+
String filter;
3839
}
3940

4041
public static class SdkConfigEventParams {

contract-tests/service/src/main/java/sdktest/SdkClientEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ private LDConfig buildSdkConfig(SdkConfigParams params, String tag) {
300300
if (params.streaming.initialRetryDelayMs > 0) {
301301
dataSource.initialReconnectDelay(Duration.ofMillis(params.streaming.initialRetryDelayMs));
302302
}
303+
dataSource.payloadFilter(params.streaming.filter);
303304
builder.dataSource(dataSource);
304305
}
305306

contract-tests/service/src/main/java/sdktest/TestService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public class TestService {
3232
"context-type",
3333
"service-endpoints",
3434
"tags",
35-
"user-type"
35+
"user-type",
36+
"filtering"
3637
};
3738

3839
static final Gson gson = new GsonBuilder().serializeNulls().create();

src/main/java/com/launchdarkly/sdk/server/ComponentsImpl.java

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ private ComponentsImpl() {}
5353

5454
static final class InMemoryDataStoreFactory implements ComponentConfigurer<DataStore>, DiagnosticDescription {
5555
static final InMemoryDataStoreFactory INSTANCE = new InMemoryDataStoreFactory();
56+
5657
@Override
5758
public DataStore build(ClientContext context) {
5859
return new InMemoryDataStore();
@@ -154,18 +155,17 @@ public DataSource build(ClientContext context) {
154155
context.getServiceEndpoints().getStreamingBaseUri(),
155156
StandardEndpoints.DEFAULT_STREAMING_BASE_URI,
156157
"streaming",
157-
baseLogger
158-
);
158+
baseLogger);
159159

160160
return new StreamProcessor(
161161
toHttpProperties(context.getHttp()),
162162
context.getDataSourceUpdateSink(),
163163
context.getThreadPriority(),
164164
ClientContextImpl.get(context).diagnosticStore,
165165
streamUri,
166+
payloadFilter,
166167
initialReconnectDelay,
167-
logger
168-
);
168+
logger);
169169
}
170170

171171
@Override
@@ -202,17 +202,20 @@ public DataSource build(ClientContext context) {
202202
context.getServiceEndpoints().getPollingBaseUri(),
203203
StandardEndpoints.DEFAULT_POLLING_BASE_URI,
204204
"polling",
205-
baseLogger
206-
);
205+
baseLogger);
206+
207+
DefaultFeatureRequestor requestor = new DefaultFeatureRequestor(
208+
toHttpProperties(context.getHttp()),
209+
pollUri,
210+
payloadFilter,
211+
logger);
207212

208-
DefaultFeatureRequestor requestor = new DefaultFeatureRequestor(toHttpProperties(context.getHttp()), pollUri, logger);
209213
return new PollingProcessor(
210214
requestor,
211215
context.getDataSourceUpdateSink(),
212216
ClientContextImpl.get(context).sharedExecutor,
213217
pollInterval,
214-
logger
215-
);
218+
logger);
216219
}
217220

218221
@Override
@@ -241,17 +244,15 @@ public EventProcessor build(ClientContext context) {
241244
null, // use default request path for server-side events
242245
null, // use default request path for client-side events
243246
0, // 0 means default retry delay
244-
context.getBaseLogger().subLogger(Loggers.EVENTS_LOGGER_NAME)
245-
);
247+
context.getBaseLogger().subLogger(Loggers.EVENTS_LOGGER_NAME));
246248
} else {
247249
eventSender = new EventSenderWrapper(eventSenderConfigurer.build(context));
248250
}
249251
URI eventsUri = StandardEndpoints.selectBaseUri(
250252
context.getServiceEndpoints().getEventsBaseUri(),
251253
StandardEndpoints.DEFAULT_EVENTS_BASE_URI,
252254
"events",
253-
context.getBaseLogger()
254-
);
255+
context.getBaseLogger());
255256
EventsConfiguration eventsConfig = new EventsConfiguration(
256257
allAttributesPrivate,
257258
capacity,
@@ -264,8 +265,7 @@ public EventProcessor build(ClientContext context) {
264265
flushInterval.toMillis(),
265266
false,
266267
false,
267-
privateAttributes
268-
);
268+
privateAttributes);
269269
return new DefaultEventProcessorWrapper(context, eventsConfig);
270270
}
271271

@@ -350,8 +350,7 @@ public HttpConfiguration build(ClientContext clientContext) {
350350
socketFactory,
351351
socketTimeout,
352352
sslSocketFactory,
353-
trustManager
354-
);
353+
trustManager);
355354
}
356355
}
357356

@@ -378,7 +377,7 @@ public PersistentDataStoreBuilderImpl(ComponentConfigurer<PersistentDataStore> s
378377
@Override
379378
public LDValue describeConfiguration(ClientContext clientContext) {
380379
if (persistentDataStoreConfigurer instanceof DiagnosticDescription) {
381-
return ((DiagnosticDescription)persistentDataStoreConfigurer).describeConfiguration(clientContext);
380+
return ((DiagnosticDescription) persistentDataStoreConfigurer).describeConfiguration(clientContext);
382381
}
383382
return LDValue.of("custom");
384383
}
@@ -393,8 +392,7 @@ public DataStore build(ClientContext context) {
393392
recordCacheStats,
394393
context.getDataStoreUpdateSink(),
395394
ClientContextImpl.get(context).sharedExecutor,
396-
context.getBaseLogger().subLogger(Loggers.DATA_STORE_LOGGER_NAME)
397-
);
395+
context.getBaseLogger().subLogger(Loggers.DATA_STORE_LOGGER_NAME));
398396
}
399397
}
400398

@@ -434,8 +432,7 @@ public ServiceEndpoints createServiceEndpoints() {
434432
return new ServiceEndpoints(
435433
StandardEndpoints.DEFAULT_STREAMING_BASE_URI,
436434
StandardEndpoints.DEFAULT_POLLING_BASE_URI,
437-
StandardEndpoints.DEFAULT_EVENTS_BASE_URI
438-
);
435+
StandardEndpoints.DEFAULT_EVENTS_BASE_URI);
439436
}
440437
return new ServiceEndpoints(streamingBaseUri, pollingBaseUri, eventsBaseUri);
441438
}
@@ -455,7 +452,6 @@ static HttpProperties toHttpProperties(HttpConfiguration httpConfig) {
455452
httpConfig.getSocketFactory(),
456453
httpConfig.getSocketTimeout().toMillis(),
457454
httpConfig.getSslSocketFactory(),
458-
httpConfig.getTrustManager()
459-
);
455+
httpConfig.getTrustManager());
460456
}
461457
}

src/main/java/com/launchdarkly/sdk/server/DefaultFeatureRequestor.java

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
package com.launchdarkly.sdk.server;
22

3+
import static com.launchdarkly.sdk.server.DataModelSerialization.parseFullDataSet;
4+
5+
import java.io.IOException;
6+
import java.net.URI;
7+
import java.nio.file.Files;
8+
import java.nio.file.Path;
9+
10+
import javax.annotation.Nullable;
11+
312
import com.google.common.annotations.VisibleForTesting;
413
import com.google.gson.stream.JsonReader;
514
import com.launchdarkly.logging.LDLogger;
15+
import com.launchdarkly.sdk.internal.http.HttpConsts;
616
import com.launchdarkly.sdk.internal.http.HttpErrors.HttpErrorException;
717
import com.launchdarkly.sdk.internal.http.HttpHelpers;
818
import com.launchdarkly.sdk.internal.http.HttpProperties;
919
import com.launchdarkly.sdk.server.subsystems.DataStoreTypes.FullDataSet;
1020
import com.launchdarkly.sdk.server.subsystems.DataStoreTypes.ItemDescriptor;
1121
import com.launchdarkly.sdk.server.subsystems.SerializationException;
1222

13-
import java.io.IOException;
14-
import java.net.URI;
15-
import java.nio.file.Files;
16-
import java.nio.file.Path;
17-
18-
import static com.launchdarkly.sdk.server.DataModelSerialization.parseFullDataSet;
19-
2023
import okhttp3.Cache;
2124
import okhttp3.Headers;
2225
import okhttp3.OkHttpClient;
@@ -28,19 +31,36 @@
2831
*/
2932
final class DefaultFeatureRequestor implements FeatureRequestor {
3033
private static final long MAX_HTTP_CACHE_SIZE_BYTES = 10 * 1024 * 1024; // 10 MB
31-
32-
@VisibleForTesting final URI baseUri;
34+
3335
private final OkHttpClient httpClient;
34-
private final URI pollingUri;
36+
@VisibleForTesting
37+
final URI pollingUri;
3538
private final Headers headers;
3639
private final Path cacheDir;
3740
private final LDLogger logger;
3841

39-
DefaultFeatureRequestor(HttpProperties httpProperties, URI baseUri, LDLogger logger) {
40-
this.baseUri = baseUri;
41-
this.pollingUri = HttpHelpers.concatenateUriPath(baseUri, StandardEndpoints.POLLING_REQUEST_PATH);
42+
/**
43+
* Creates a {@link DefaultFeatureRequestor}
44+
*
45+
* @param httpProperties that will be used
46+
* @param baseUri that will be used
47+
* @param payloadFilter identifier that will be used to filter objects in the
48+
* payload, provide null for no filtering
49+
* @param logger to log with
50+
*/
51+
DefaultFeatureRequestor(HttpProperties httpProperties, URI baseUri, @Nullable String payloadFilter, LDLogger logger) {
4252
this.logger = logger;
43-
53+
54+
URI tempUri = HttpHelpers.concatenateUriPath(baseUri, StandardEndpoints.POLLING_REQUEST_PATH);
55+
if (payloadFilter != null) {
56+
if (!payloadFilter.isEmpty()) {
57+
tempUri = HttpHelpers.addQueryParam(tempUri, HttpConsts.QUERY_PARAM_FILTER, payloadFilter);
58+
} else {
59+
logger.info("Payload filter \"{}\" is not valid, not applying filter.", payloadFilter);
60+
}
61+
}
62+
this.pollingUri = tempUri;
63+
4464
OkHttpClient.Builder httpBuilder = httpProperties.toHttpClientBuilder();
4565
this.headers = httpProperties.toHeadersBuilder().build();
4666

@@ -59,7 +79,7 @@ public void close() {
5979
HttpProperties.shutdownHttpClient(httpClient);
6080
Util.deleteDirectory(cacheDir);
6181
}
62-
82+
6383
public FullDataSet<ItemDescriptor> getAllData(boolean returnDataEvenIfCached)
6484
throws IOException, HttpErrorException, SerializationException {
6585
Request request = new Request.Builder()

src/main/java/com/launchdarkly/sdk/server/StreamProcessor.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.launchdarkly.logging.LDLogger;
2020
import com.launchdarkly.logging.LogValues;
2121
import com.launchdarkly.sdk.internal.events.DiagnosticStore;
22+
import com.launchdarkly.sdk.internal.http.HttpConsts;
2223
import com.launchdarkly.sdk.internal.http.HttpHelpers;
2324
import com.launchdarkly.sdk.internal.http.HttpProperties;
2425
import com.launchdarkly.sdk.server.StreamProcessorEvents.DeleteData;
@@ -84,8 +85,10 @@ final class StreamProcessor implements DataSource {
8485
private final DataSourceUpdateSink dataSourceUpdates;
8586
private final HttpProperties httpProperties;
8687
private final Headers headers;
87-
@VisibleForTesting final URI streamUri;
88-
@VisibleForTesting final Duration initialReconnectDelay;
88+
@VisibleForTesting
89+
final URI streamUri;
90+
@VisibleForTesting
91+
final Duration initialReconnectDelay;
8992
private final DiagnosticStore diagnosticAccumulator;
9093
private final int threadPriority;
9194
private final DataStoreStatusProvider.StatusListener statusListener;
@@ -102,17 +105,27 @@ final class StreamProcessor implements DataSource {
102105
int threadPriority,
103106
DiagnosticStore diagnosticAccumulator,
104107
URI streamUri,
108+
String payloadFilter,
105109
Duration initialReconnectDelay,
106-
LDLogger logger
107-
) {
110+
LDLogger logger) {
108111
this.dataSourceUpdates = dataSourceUpdates;
109112
this.httpProperties = httpProperties;
110113
this.diagnosticAccumulator = diagnosticAccumulator;
111114
this.threadPriority = threadPriority;
112-
this.streamUri = streamUri;
113115
this.initialReconnectDelay = initialReconnectDelay;
114116
this.logger = logger;
115117

118+
URI tempUri = HttpHelpers.concatenateUriPath(streamUri, StandardEndpoints.STREAMING_REQUEST_PATH);
119+
if (payloadFilter != null) {
120+
if (!payloadFilter.isEmpty()) {
121+
tempUri = HttpHelpers.addQueryParam(tempUri, HttpConsts.QUERY_PARAM_FILTER, payloadFilter);
122+
} else {
123+
logger.info("Payload filter \"{}\" is not valid, not applying filter.", payloadFilter);
124+
}
125+
}
126+
this.streamUri = tempUri;
127+
128+
116129
this.headers = httpProperties.toHeadersBuilder()
117130
.add("Accept", "text/event-stream")
118131
.build();
@@ -144,8 +157,6 @@ private void onStoreStatusChanged(DataStoreStatusProvider.Status newStatus) {
144157
public Future<Void> start() {
145158
final CompletableFuture<Void> initFuture = new CompletableFuture<>();
146159

147-
URI endpointUri = HttpHelpers.concatenateUriPath(streamUri, StandardEndpoints.STREAMING_REQUEST_PATH);
148-
149160
// Notes about the configuration of the EventSource below:
150161
//
151162
// 1. Setting streamEventData(true) is an optimization to let us read the event's data field directly
@@ -158,7 +169,7 @@ public Future<Void> start() {
158169
// LD client gets. A read timeout on the stream will result in the connection being cycled, so we set
159170
// this to be slightly more than the expected interval between heartbeat signals.
160171

161-
HttpConnectStrategy eventSourceHttpConfig = ConnectStrategy.http(endpointUri)
172+
HttpConnectStrategy eventSourceHttpConfig = ConnectStrategy.http(this.streamUri)
162173
.headers(headers)
163174
.clientBuilderActions(clientBuilder -> {
164175
httpProperties.applyToHttpClientBuilder(clientBuilder);

src/main/java/com/launchdarkly/sdk/server/integrations/PollingDataSourceBuilder.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public abstract class PollingDataSourceBuilder implements ComponentConfigurer<Da
3434
public static final Duration DEFAULT_POLL_INTERVAL = Duration.ofSeconds(30);
3535

3636
protected Duration pollInterval = DEFAULT_POLL_INTERVAL;
37+
38+
protected String payloadFilter;
3739

3840
/**
3941
* Sets the interval at which the SDK will poll for feature flag updates.
@@ -52,4 +54,16 @@ public PollingDataSourceBuilder pollInterval(Duration pollInterval) {
5254
}
5355
return this;
5456
}
57+
58+
/**
59+
* Sets the Payload Filter that will be used to filter the objects (flags, segments, etc.)
60+
* from this data source.
61+
*
62+
* @param payloadFilter the filter to be used
63+
* @return the builder
64+
*/
65+
public PollingDataSourceBuilder payloadFilter(String payloadFilter) {
66+
this.payloadFilter = payloadFilter;
67+
return this;
68+
}
5569
}

src/main/java/com/launchdarkly/sdk/server/integrations/StreamingDataSourceBuilder.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.launchdarkly.sdk.server.integrations;
22

3+
import java.time.Duration;
4+
35
import com.launchdarkly.sdk.server.Components;
46
import com.launchdarkly.sdk.server.LDConfig.Builder;
57
import com.launchdarkly.sdk.server.subsystems.ComponentConfigurer;
68
import com.launchdarkly.sdk.server.subsystems.DataSource;
79

8-
import java.time.Duration;
9-
1010
/**
1111
* Contains methods for configuring the streaming data source.
1212
* <p>
@@ -31,6 +31,8 @@ public abstract class StreamingDataSourceBuilder implements ComponentConfigurer<
3131

3232
protected Duration initialReconnectDelay = DEFAULT_INITIAL_RECONNECT_DELAY;
3333

34+
protected String payloadFilter;
35+
3436
/**
3537
* Sets the initial reconnect delay for the streaming connection.
3638
* <p>
@@ -48,4 +50,16 @@ public StreamingDataSourceBuilder initialReconnectDelay(Duration initialReconnec
4850
this.initialReconnectDelay = initialReconnectDelay == null ? DEFAULT_INITIAL_RECONNECT_DELAY : initialReconnectDelay;
4951
return this;
5052
}
53+
54+
/**
55+
* Sets the Payload Filter that will be used to filter the objects (flags, segments, etc.)
56+
* from this data source.
57+
*
58+
* @param payloadFilter the filter to be used
59+
* @return the builder
60+
*/
61+
public StreamingDataSourceBuilder payloadFilter(String payloadFilter) {
62+
this.payloadFilter = payloadFilter;
63+
return this;
64+
}
5165
}

0 commit comments

Comments
 (0)