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

prepare 5.4.0 release #229

Closed
wants to merge 945 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
945 commits
Select commit Hold shift + click to select a range
ae5da18
(5.0, but not dependent on other PRs) allow configuration of worker t…
eli-darkly May 8, 2020
5d56e8d
set up initial JMH benchmarks
eli-darkly May 8, 2020
eb8f1df
Merge branch '5.x' into eb/ch67913/data-source-status
eli-darkly May 8, 2020
a45df89
CI fix
eli-darkly May 8, 2020
a13193f
save report file
eli-darkly May 8, 2020
0c50b7b
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 8, 2020
58bf660
adapt benchmarks to 5.0 API
eli-darkly May 8, 2020
94202d3
benchmarks need Gson in order to use shared test code
eli-darkly May 8, 2020
fecff19
decouple event HTTP logic from event processing
eli-darkly May 9, 2020
a3409c2
Merge branch 'eb/ch76308/event-sender' into eb/ch76308/event-sender-5.x
eli-darkly May 9, 2020
8822060
add end-to-end test for events
eli-darkly May 9, 2020
d9aab4b
Merge branch 'eb/ch76308/event-sender' into eb/ch76308/event-sender-5.x
eli-darkly May 10, 2020
2349290
javadoc fixes
eli-darkly May 11, 2020
c9ece43
minor PR feedback
eli-darkly May 11, 2020
9690842
make DataSourceUpdatesImpl responsible for detecting store failures; …
eli-darkly May 12, 2020
1398c7c
Merge pull request #227 from launchdarkly/eb/ch67913/data-source-status
eli-darkly May 12, 2020
d6c90d1
(#7) implement time-dependent escalation of data source error logging…
eli-darkly May 12, 2020
d207958
Merge branch '5.x' into eb/ch76308/event-sender-5.x
eli-darkly May 12, 2020
40d45fa
fix swapped log levels
eli-darkly May 12, 2020
6bd5afe
better synchronization usage
eli-darkly May 12, 2020
fcd9631
don't need to wait 1 second during tests
eli-darkly May 12, 2020
de0831d
Merge pull request #230 from launchdarkly/eb/ch76308/event-sender
eli-darkly May 12, 2020
0231669
Merge branch 'master' into eb/ch76308/event-sender-5.x
eli-darkly May 12, 2020
8a9d9dd
make events URI construction reliable regardless of whether base URI …
eli-darkly May 13, 2020
f516bf0
Merge pull request #231 from launchdarkly/eb/ch76308/event-sender-bas…
eli-darkly May 13, 2020
8b06363
Merge branch 'master' into eb/ch76308/event-sender-5.x
eli-darkly May 13, 2020
d1456e9
merge from public after release
LaunchDarklyCI May 13, 2020
142846d
Merge branch 'master' into 5.x
eli-darkly May 13, 2020
6718e4c
prepare 5.0.0-rc2 release (#194)
eli-darkly May 14, 2020
a3c25f4
Merge branch '5.x' of github.com:launchdarkly/java-server-sdk into 5.x
eli-darkly May 14, 2020
e8621a2
typo
eli-darkly May 14, 2020
c5340c8
typo
eli-darkly May 15, 2020
6035ee1
add DataSourceStatusProvider.waitFor()
eli-darkly May 15, 2020
60e1825
comment fix
eli-darkly May 15, 2020
88fa2e0
typo
eli-darkly May 15, 2020
c32bebd
rm debugging
eli-darkly May 15, 2020
74c0828
improve comments
eli-darkly May 16, 2020
bc09057
fix race condition in LDClientEndToEndTest
eli-darkly May 19, 2020
34ecff9
Merge pull request #233 from launchdarkly/eb/ch76308/diagnostic-event…
eli-darkly May 19, 2020
fd1178d
Merge branch 'master' into 5.x
eli-darkly May 19, 2020
a61e287
Merge branch '5.x' into eb/ch76894/wait-for-status
eli-darkly May 19, 2020
2106219
move flag change stuff into FlagTracker facade, simplify value listener
eli-darkly May 19, 2020
bad0ea8
Merge pull request #232 from launchdarkly/eb/ch76894/wait-for-status
eli-darkly May 19, 2020
cbd309a
move LDClientInterface into interfaces package and rename initialized…
eli-darkly May 19, 2020
6247e76
Merge branch 'master' into eb/ch76240/benchmarks-4.x
eli-darkly May 19, 2020
ab99c82
more benchmark implementation
eli-darkly May 19, 2020
70da524
Merge branch '5.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 19, 2020
eb74a92
port some more benchmarks from 4.x
eli-darkly May 19, 2020
d353873
Merge pull request #235 from launchdarkly/eb/ch59586/client-interface
eli-darkly May 20, 2020
ffda80a
Merge branch '5.x' into eb/ch25268/flag-tracker
eli-darkly May 20, 2020
223e038
fix merge conflict
eli-darkly May 20, 2020
4cdb376
preprocess various things to speed up evaluations
eli-darkly May 22, 2020
d97a5bc
(5.0) don't bother creating event objects if they won't be sent
eli-darkly May 22, 2020
b56d541
cleaner EventFactory design
eli-darkly May 22, 2020
7515cf8
add test coverage step to CI
eli-darkly May 22, 2020
6132374
add test coverage reporting + improve DefaultEventProcessor tests
eli-darkly May 22, 2020
436ec07
clarify meaning of "events" in javadoc comment
eli-darkly May 22, 2020
d50f669
Merge pull request #234 from launchdarkly/eb/ch25268/flag-tracker
eli-darkly May 22, 2020
631d872
note about benchmarks in CONTRIBUTING
eli-darkly May 22, 2020
a1de46c
rm unused
eli-darkly May 23, 2020
5a1e237
Merge branch '5.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
5e19ff6
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
6565ccc
formatting
eli-darkly May 23, 2020
2a8a284
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
87163c7
use JMH average time mode, not throughput
eli-darkly May 23, 2020
0358ae9
measure in nanoseconds
eli-darkly May 23, 2020
035ff29
fix import
eli-darkly May 23, 2020
0946574
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
4f8273f
move benchmark code to 5.0-like packages for easier cross-comparison
eli-darkly May 23, 2020
6f08081
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
c84cda9
move test data generation out of benchmarks
eli-darkly May 23, 2020
846976c
more configuration tweaks
eli-darkly May 23, 2020
338947c
show more benchmark output
eli-darkly May 23, 2020
db5dc8c
show more benchmark output
eli-darkly May 23, 2020
37e88c6
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
a45bcd9
fix event benchmark synchronization
eli-darkly May 23, 2020
080c599
add jmhReport HTML output
eli-darkly May 23, 2020
d80d245
fix report step
eli-darkly May 23, 2020
4832b76
fix synchronization again
eli-darkly May 23, 2020
2bd5a37
fix event benchmarks so they don't test the construction of the input…
eli-darkly May 23, 2020
0815938
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-4…
eli-darkly May 23, 2020
0cefb4e
fix data file name
eli-darkly May 23, 2020
e2be6e9
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
c52418f
Merge branch 'eb/ch76240/benchmarks-4.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 23, 2020
d184426
Merge branch '5.x' into eb/ch77594/coverage
eli-darkly May 23, 2020
58d1e12
Merge branch '5.x' into eb/ch77442/preprocessing
eli-darkly May 23, 2020
f6961fa
Merge branch 'eb/ch77442/preprocessing' into eb/ch77571/no-events
eli-darkly May 23, 2020
4c47222
Merge branch 'eb/ch77571/no-events' into eb/ch77594/coverage
eli-darkly May 23, 2020
26575df
CI fix (always store test results)
eli-darkly May 23, 2020
1986569
improve test coverage of low-level eval logic to >99%
eli-darkly May 23, 2020
e6e37a5
revert change to flush payload queue behavior
eli-darkly May 23, 2020
ab43703
avoid test race condition
eli-darkly May 23, 2020
d264569
Merge branch 'eb/ch77594/coverage' into eb/ch77594/coverage-2-eval
eli-darkly May 23, 2020
a9b6c81
add test coverage reporting
eli-darkly May 23, 2020
38a4922
CI fix
eli-darkly May 23, 2020
4e3eee3
CI fix
eli-darkly May 23, 2020
051a9d5
Merge branch 'eb/ch77594/coverage-0' into eb/ch77594/coverage-1-events
eli-darkly May 23, 2020
4b85a3f
more event test improvements
eli-darkly May 23, 2020
b898d81
misc cleanup + test improvements
eli-darkly May 23, 2020
ca2e196
Merge branch 'eb/ch77594/coverage-1-events' into eb/ch77594/coverage-…
eli-darkly May 23, 2020
60046ef
misc cleanup + test improvements
eli-darkly May 23, 2020
0f898fa
make intVariation and doubleVariation non-nullable
eli-darkly May 23, 2020
3b0e95b
(5.0) don't use jar magic to find out our own version string
eli-darkly May 23, 2020
f6b7ff2
fix test
eli-darkly May 23, 2020
3fb019f
Merge branch 'eb/ch77594-ch77639/coverage-3-client' into eb/ch77640/v…
eli-darkly May 23, 2020
b3f313c
make intVariation and doubleVariation non-nullable
eli-darkly May 23, 2020
38dacc8
Merge branch 'eb/ch77639/int-double-non-null' into eb/ch77640/version…
eli-darkly May 23, 2020
472dfc7
better unit test coverage of LDClient and FeatureFlagsState
eli-darkly May 23, 2020
3ccd7cb
test coverage improvements + minor fixes
eli-darkly May 24, 2020
7c75b3a
better temp file handling in file data source tests
eli-darkly May 24, 2020
8da3e27
revert file data source implementation change for now
eli-darkly May 24, 2020
306797e
revert unnecessary change
eli-darkly May 24, 2020
e07643f
comment about file watching on Mac
eli-darkly May 24, 2020
1d57156
add slight delay to avoid timing-dependent test flakiness
eli-darkly May 26, 2020
3fad450
test fixes/comments
eli-darkly May 26, 2020
07bb8f5
(5.0) use simpler and more stable logger names
eli-darkly May 26, 2020
2d0628d
better instructions
eli-darkly May 27, 2020
427a87e
more convenient way to set EventSource logger name
eli-darkly May 27, 2020
a89504e
(5.0) add HTTP default headers method + some component refactoring
eli-darkly May 28, 2020
6ce1d8a
don't need to pass the whole config object to describeConfiguration()
eli-darkly May 28, 2020
5d54f0a
simplify test logic for HTTP headers
eli-darkly May 28, 2020
29cf2d7
Merge pull request #236 from launchdarkly/eb/ch77442/preprocessing
eli-darkly May 28, 2020
e336c92
Merge pull request #237 from launchdarkly/eb/ch77571/no-events
eli-darkly May 28, 2020
86050fb
Merge pull request #240 from launchdarkly/eb/ch77594/coverage-0
eli-darkly May 28, 2020
ec01e5b
Merge branch '5.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 28, 2020
c36c6f3
Merge pull request #241 from launchdarkly/eb/ch77594/coverage-1-events
eli-darkly May 29, 2020
bd2162e
Merge pull request #242 from launchdarkly/eb/ch77594/coverage-2-eval
eli-darkly May 29, 2020
daf04c4
Merge pull request #243 from launchdarkly/eb/ch77639/int-double-non-null
eli-darkly May 29, 2020
2719973
Merge pull request #244 from launchdarkly/eb/ch77640/version-string
eli-darkly May 29, 2020
8b24c81
(5.0) final test coverage improvements, for now, with enforcement
eli-darkly May 29, 2020
55f14d1
re-simplify DataBuilder
eli-darkly May 29, 2020
3df7da4
increase timeouts
eli-darkly May 29, 2020
6fc2a7a
misc fixes
eli-darkly May 29, 2020
8b27de5
rm unnecessary override
eli-darkly May 29, 2020
262eb19
Merge branch '5.x' into eb/ch76240/benchmarks-5.x
eli-darkly May 29, 2020
43778a3
indents
eli-darkly May 29, 2020
128b8cc
Merge pull request #245 from launchdarkly/eb/ch77594/coverage-3-client
eli-darkly May 29, 2020
b959c6c
Merge pull request #238 from launchdarkly/eb/ch76240/benchmarks-4.x
eli-darkly May 29, 2020
279ccd5
Merge pull request #239 from launchdarkly/eb/ch76240/benchmarks-5.x
eli-darkly May 29, 2020
6ddb11b
Merge branch 'master' into 5.x
eli-darkly May 29, 2020
37fbfe5
Merge branch '5.x' into eb/ch76203/logger-names
eli-darkly May 29, 2020
fc3d40e
Merge branch '5.x' into eb/ch77594/coverage-4-misc
eli-darkly May 29, 2020
4df1c40
Merge branch 'eb/ch77594/coverage-4-misc' into eb/ch78049/http-headers
eli-darkly May 29, 2020
dbe962f
update benchmark code for API change
eli-darkly May 29, 2020
8b74838
Merge branch 'eb/ch78049/http-headers' into eb/ch77594/coverage-5-misc
eli-darkly May 29, 2020
4b00cde
Merge pull request #246 from launchdarkly/eb/ch77594/coverage-4-misc
eli-darkly May 29, 2020
73062ca
support loading file data from a classpath resource
eli-darkly May 30, 2020
f02f835
update metadata so Releaser knows about 4.x branch
eli-darkly May 30, 2020
9dfc1be
Merge branch '4.x' into 5.x
eli-darkly May 30, 2020
4a3a7fb
minor test fixes
eli-darkly May 30, 2020
0fbd4b0
make class final
eli-darkly May 30, 2020
91941fa
rm beta changelog items
eli-darkly May 30, 2020
851c53b
Merge branch 'eb/debugging'
eli-darkly May 30, 2020
4dd0822
test data source
eli-darkly Jun 1, 2020
907882d
more info about coverage in CONTRIBUTING.md
eli-darkly Jun 1, 2020
7165ca4
Merge pull request #248 from launchdarkly/eb/ch78049/http-headers
eli-darkly Jun 1, 2020
79d11bf
Merge branch 'master' into eb/ch76203/logger-names
eli-darkly Jun 2, 2020
234e905
Merge pull request #247 from launchdarkly/eb/ch76203/logger-names
eli-darkly Jun 2, 2020
75630d0
Merge branch 'master' into eb/ch77594/coverage-5-misc
eli-darkly Jun 2, 2020
1eabb73
Merge branch 'eb/ch77594/coverage-5-misc' into eb/ch76824/classpath-file
eli-darkly Jun 2, 2020
01df1f3
Merge pull request #249 from launchdarkly/eb/ch77594/coverage-5-misc
eli-darkly Jun 2, 2020
ff3d3d1
Merge pull request #250 from launchdarkly/eb/ch76824/classpath-file
eli-darkly Jun 2, 2020
d219b44
Merge branch 'master' into eb/ch78216/test-data
eli-darkly Jun 2, 2020
fa2b39c
misc fixes/tests
eli-darkly Jun 2, 2020
705d25b
use java-sdk-common 1.0.0
eli-darkly Jun 2, 2020
2a44530
use okhttp-eventsource 2.3.0
eli-darkly Jun 2, 2020
9d23a88
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
eli-darkly Jun 2, 2020
ddd886a
use okhttp-eventsource 2.3.1 for thread fix
eli-darkly Jun 18, 2020
6374424
Merge pull request #252 from launchdarkly/eb/ch80009/eventsource-thread
eli-darkly Jun 19, 2020
6fb600d
fix flaky tests due to change in EventSource error reporting
eli-darkly Jun 19, 2020
e22d43f
Merge pull request #253 from launchdarkly/eb/ch80009/flaky-test
eli-darkly Jun 19, 2020
8642c8b
merge from public after release
LaunchDarklyCI Jun 19, 2020
8873f44
remove support for indirect put and indirect patch
eli-darkly Jun 23, 2020
9a034e2
Merge pull request #254 from launchdarkly/eb/ch80666/no-indirect-patch
eli-darkly Jun 23, 2020
0293f58
fix typo in javadoc example code
eli-darkly Jun 24, 2020
8a08fc7
Merge pull request #255 from launchdarkly/eb/ch80837/javadoc-typo
eli-darkly Jun 24, 2020
4ad9351
clean up polling logic, fix status updating after an outage, don't re…
eli-darkly Jun 25, 2020
f14119a
merge from public after release
LaunchDarklyCI Jun 25, 2020
d41ae6c
slightly change semantics of boolean setters, improve tests, misc cle…
eli-darkly Aug 4, 2020
378b8e8
avoid NPEs if LDUser was deserialized by Gson (#257)
eli-darkly Aug 4, 2020
4836ea3
fix release metadata
eli-darkly Aug 5, 2020
96e58e7
prepare 4.14.1 release (#200)
LaunchDarklyCI Aug 5, 2020
22149a9
Releasing version 4.14.1
LaunchDarklyCI Aug 5, 2020
2d0d5cd
merge from public after release
LaunchDarklyCI Aug 5, 2020
ef8a801
Merge branch '4.x'
eli-darkly Aug 5, 2020
8825a48
exclude Kotlin metadata from jar + fix misc Gradle problems
eli-darkly Aug 18, 2020
ae46e03
Merge pull request #258 from launchdarkly/eb/ch87032/kotlin-symbols
eli-darkly Aug 18, 2020
b7ce928
merge from public after release
LaunchDarklyCI Aug 19, 2020
b32abc3
update CI and Gradle to test with newer JDKs (#259)
eli-darkly Aug 24, 2020
eefc460
update okhttp to 3.14.9 (fixes incompatibility with OpenJDK 8.0.252)
eli-darkly Aug 31, 2020
87120a4
Merge pull request #260 from launchdarkly/eb/ch88298/okhttp-update-4.x
eli-darkly Sep 1, 2020
0403392
prepare 4.14.2 release (#205)
LaunchDarklyCI Sep 1, 2020
2daeb92
Releasing version 4.14.2
LaunchDarklyCI Sep 1, 2020
7c09c6a
merge from public after release
LaunchDarklyCI Sep 1, 2020
7a9772c
Merge branch '4.x'
eli-darkly Sep 1, 2020
f3f01ec
update okhttp to 4.8.1 (fixes incompatibility with OpenJDK 8.0.252)
eli-darkly Sep 1, 2020
7025ae7
Merge pull request #261 from launchdarkly/eb/ch88298/okhttp-update-5.x
eli-darkly Sep 1, 2020
d1e311e
merge from public after release
LaunchDarklyCI Sep 1, 2020
f5a8555
gitignore
eli-darkly Sep 1, 2020
52c36be
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
gwhelanLD Sep 3, 2020
9fe8f5b
merge from public after release
LaunchDarklyCI Sep 3, 2020
ac9bdb1
Bump SnakeYAML from 1.19 to 1.26 to address CVE-2017-18640
ssrm Sep 3, 2020
d1e0637
Merge pull request #262 from launchdarkly/eb/ch88108/snakeyaml-update
eli-darkly Sep 3, 2020
4f8f980
prepare 4.14.3 release (#209)
LaunchDarklyCI Sep 3, 2020
a6777a8
Releasing version 4.14.3
LaunchDarklyCI Sep 3, 2020
89954b5
merge from public after release
LaunchDarklyCI Sep 3, 2020
a83942e
Merge branch '4.x'
eli-darkly Sep 3, 2020
326e8e1
Merge branch 'master' into eb/ch78216/test-data
eli-darkly Sep 4, 2020
b800f23
comments
eli-darkly Sep 4, 2020
7cb20cd
Merge pull request #251 from launchdarkly/eb/ch78216/test-data
eli-darkly Sep 4, 2020
06fdd3e
only log initialization message once in polling mode
eli-darkly Sep 4, 2020
03e2ad8
Merge pull request #263 from launchdarkly/eb/ch88859/polling-logging
eli-darkly Sep 4, 2020
a448abc
merge from public after release
LaunchDarklyCI Sep 4, 2020
078fe16
[ch89935] Correct some logging call format strings (#264)
gwhelanLD Sep 17, 2020
136eb1b
[ch90109] Remove outdated trackMetric comment from before service sup…
gwhelanLD Sep 18, 2020
889a1c6
Fix compatibility with Java 7.
gwhelanLD Sep 25, 2020
67dea95
Remove import that is no longer used.
gwhelanLD Sep 25, 2020
402b8fe
Merge pull request #266 from launchdarkly/gw/ch90182/fix-java-7-compat
eli-darkly Sep 28, 2020
ee5e212
add Java 7 build (#267)
eli-darkly Sep 28, 2020
cd60e6d
prepare 4.14.4 release (#214)
LaunchDarklyCI Sep 28, 2020
424c7d5
Releasing version 4.14.4
LaunchDarklyCI Sep 28, 2020
72ac981
merge from public after release
LaunchDarklyCI Sep 28, 2020
0113451
add and use getSocketFactory
hroederld Sep 28, 2020
346f655
alignment
hroederld Sep 28, 2020
305f555
add socketFactory to builder
hroederld Sep 28, 2020
7c2eea8
test socket factory builder
hroederld Sep 28, 2020
7f1d8c8
Merge branch '4.x'
eli-darkly Sep 28, 2020
8b51b95
preserve dummy CI config file when pushing to gh-pages (#271)
eli-darkly Sep 30, 2020
f6ae98e
fix concatenation when base URI has a context path (#270)
eli-darkly Oct 1, 2020
b33e5bf
fix shaded jar builds to exclude Jackson classes and not modify Jacks…
eli-darkly Oct 1, 2020
e4ba1cd
merge from public after release
LaunchDarklyCI Oct 1, 2020
18af928
add test httpClientCanUseCustomSocketFactory for DefaultFeatureRequestor
hroederld Oct 7, 2020
fa90fbf
add httpClientCanUseCustomSocketFactory() test for DefaultEventSender…
hroederld Oct 7, 2020
a0b7894
add httpClientCanUseCustomSocketFactory() test to StreamProcessorTest
hroederld Oct 7, 2020
9aeeaaa
merge in master and fix conflict
hroederld Oct 7, 2020
86a601e
pass URI to in customSocketFactory event test
hroederld Oct 9, 2020
ad21f51
[ch90672] Add socketFactory support to SDK
hroederld Oct 9, 2020
8919a07
make test less ambiguous
hroederld Oct 10, 2020
f1808d9
Merge pull request #272 from launchdarkly/hr/ch90672/socketfactory-te…
hroederld Oct 10, 2020
9b20c08
merge from public after release
LaunchDarklyCI Oct 10, 2020
d727737
copy rules to new FlagBuilder instances (#273)
bwoskow-ld Dec 1, 2020
51cb8cf
merge from public after release
LaunchDarklyCI Dec 2, 2020
ace4ad4
Bump guava version (#274)
bwoskow-ld Jan 6, 2021
f86c2c6
merge from public after release
LaunchDarklyCI Jan 15, 2021
88a2e8b
Removed the guides link
bwoskow-ld Feb 3, 2021
9f2ab7b
increment versions when loading file data, so FlagTracker will work (…
eli-darkly Feb 19, 2021
3ba8b90
merge from public after release
LaunchDarklyCI Feb 20, 2021
0d6e3c6
add ability to ignore duplicate keys in file data (#276)
eli-darkly Mar 9, 2021
148dcf1
merge from public after release
LaunchDarklyCI Mar 9, 2021
57e4dd2
add alias events (#278)
apache-hb Apr 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/main/java/com/launchdarkly/sdk/server/EventFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ abstract Event.FeatureRequest newUnknownFeatureRequestEvent(
abstract Event.Custom newCustomEvent(String key, LDUser user, LDValue data, Double metricValue);

abstract Event.Identify newIdentifyEvent(LDUser user);


abstract Event.AliasEvent newAliasEvent(LDUser user, LDUser previousUser);

final Event.FeatureRequest newFeatureRequestEvent(
DataModel.FeatureFlag flag,
LDUser user,
Expand Down Expand Up @@ -166,6 +168,11 @@ Event.Custom newCustomEvent(String key, LDUser user, LDValue data, Double metric
Event.Identify newIdentifyEvent(LDUser user) {
return new Event.Identify(timestampFn.get(), user);
}

@Override
Event.AliasEvent newAliasEvent(LDUser user, LDUser previousUser) {
return new Event.AliasEvent(timestampFn.get(), user, previousUser);
}
}

static final class Disabled extends EventFactory {
Expand All @@ -191,6 +198,11 @@ final Custom newCustomEvent(String key, LDUser user, LDValue data, Double metric
final Identify newIdentifyEvent(LDUser user) {
return null;
}

@Override
Event.AliasEvent newAliasEvent(LDUser user, LDUser previousUser) {
return null;
}
}

private static boolean isExperiment(DataModel.FeatureFlag flag, EvaluationReason reason) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,38 @@ private final void writeOutputEvent(Event event, JsonWriter jw) throws IOExcepti
jw.value(fe.getPrereqOf());
}
writeEvaluationReason("reason", fe.getReason(), jw);
jw.endObject();
if (!fe.getContextKind().equals("user")) {
jw.name("contextKind").value(fe.getContextKind());
}
} else if (event instanceof Event.Identify) {
startEvent(event, "identify", event.getUser() == null ? null : event.getUser().getKey(), jw);
writeUser(event.getUser(), jw);
jw.endObject();
} else if (event instanceof Event.Custom) {
Event.Custom ce = (Event.Custom)event;
startEvent(event, "custom", ce.getKey(), jw);
writeUserOrKey(ce, false, jw);
writeLDValue("data", ce.getData(), jw);
if (!ce.getContextKind().equals("user")) {
jw.name("contextKind").value(ce.getContextKind());
}
if (ce.getMetricValue() != null) {
jw.name("metricValue");
jw.value(ce.getMetricValue());
}
jw.endObject();
} else if (event instanceof Event.Index) {
startEvent(event, "index", null, jw);
writeUser(event.getUser(), jw);
jw.endObject();
} else if (event instanceof Event.AliasEvent) {
Event.AliasEvent ae = (Event.AliasEvent)event;
startEvent(event, "alias", ae.getKey(), jw);
jw.name("contextKind").value(ae.getContextKind());
jw.name("previousKey").value(ae.getPreviousKey());
jw.name("previousContextKind").value(ae.getPreviousContextKind());
} else {
return;
}

jw.endObject();
}

private final void writeSummaryEvent(EventSummarizer.EventSummary summary, JsonWriter jw) throws IOException {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/launchdarkly/sdk/server/LDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@ public String secureModeHash(LDUser user) {
return null;
}

@Override
public void alias(LDUser user, LDUser previousUser) {
this.eventProcessor.sendEvent(eventFactoryDefault.newAliasEvent(user, previousUser));
}

/**
* Returns the current version string of the client library.
* @return a version string conforming to Semantic Versioning (http://semver.org)
Expand Down
88 changes: 87 additions & 1 deletion src/main/java/com/launchdarkly/sdk/server/interfaces/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ public long getCreationDate() {
public LDUser getUser() {
return user;
}

/**
* Convert a user into a context kind string
* @param user the user to get the context kind from
* @return the context kind string
*/
private static final String computeContextKind(LDUser user) {
return user != null && user.isAnonymous() ? "anonymousUser" : "user";
}

/**
* A custom event created with {@link LDClientInterface#track(String, LDUser)} or one of its overloads.
Expand All @@ -48,6 +57,7 @@ public static final class Custom extends Event {
private final String key;
private final LDValue data;
private final Double metricValue;
private final String contextKind;

/**
* Constructs a custom event.
Expand All @@ -61,8 +71,9 @@ public static final class Custom extends Event {
public Custom(long timestamp, String key, LDUser user, LDValue data, Double metricValue) {
super(timestamp, user);
this.key = key;
this.data = data == null ? LDValue.ofNull() : data;
this.data = LDValue.normalize(data);
this.metricValue = metricValue;
this.contextKind = computeContextKind(user);
}

/**
Expand All @@ -88,6 +99,14 @@ public LDValue getData() {
public Double getMetricValue() {
return metricValue;
}

/**
* The context kind of the user that generated this event
* @return the context kind
*/
public String getContextKind() {
return contextKind;
}
}

/**
Expand Down Expand Up @@ -132,6 +151,7 @@ public static final class FeatureRequest extends Event {
private final long debugEventsUntilDate;
private final EvaluationReason reason;
private final boolean debug;
private final String contextKind;

/**
* Constructs a feature request event.
Expand Down Expand Up @@ -162,6 +182,7 @@ public FeatureRequest(long timestamp, String key, LDUser user, int version, int
this.debugEventsUntilDate = debugEventsUntilDate;
this.reason = reason;
this.debug = debug;
this.contextKind = computeContextKind(user);
}

/**
Expand Down Expand Up @@ -243,5 +264,70 @@ public EvaluationReason getReason() {
public boolean isDebug() {
return debug;
}

/**
* The context kind of the user that generated this event
* @return the context kind
*/
public String getContextKind() {
return contextKind;
}
}

/**
* An event generated by aliasing users
* @since 5.4.0
*/
public static final class AliasEvent extends Event {
private final String key;
private final String contextKind;
private final String previousKey;
private final String previousContextKind;

/**
* Constructs an alias event.
* @param timestamp when the event was created
* @param user the user being aliased to
* @param previousUser the user being aliased from
*/
public AliasEvent(long timestamp, LDUser user, LDUser previousUser) {
super(timestamp, user);
this.key = user.getKey();
this.contextKind = computeContextKind(user);
this.previousKey = previousUser.getKey();
this.previousContextKind = computeContextKind(previousUser);
}

/**
* Get the key of the user being aliased to
* @return the user key
*/
public String getKey() {
return key;
}

/**
* Get the kind of the user being aliased to
* @return the context kind
*/
public String getContextKind() {
return contextKind;
}

/**
* Get the key of the user being aliased from
* @return the previous user key
*/
public String getPreviousKey() {
return previousKey;
}

/**
* Get the kind of the user being aliased from
* @return the previous context kind
*/
public String getPreviousContextKind() {
return previousContextKind;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,23 @@ public interface LDClientInterface extends Closeable {
* For more info: <a href="https://github.com/launchdarkly/js-client#secure-mode">https://github.com/launchdarkly/js-client#secure-mode</a>
* @param user the user to be hashed along with the SDK key
* @return the hash, or null if the hash could not be calculated
*/
*/
String secureModeHash(LDUser user);

/**
* Associates two users for analytics purposes.
*
* This can be helpful in the situation where a person is represented by multiple
* LaunchDarkly users. This may happen, for example, when a person initially logs into
* an application-- the person might be represented by an anonymous user prior to logging
* in and a different user after logging in, as denoted by a different user key.
*
* @param user the newly identified user.
* @param previousUser the previously identified user.
* @since 5.4.0
*/
void alias(LDUser user, LDUser previousUser);

/**
* The current version string of the SDK.
* @return a string in Semantic Versioning 2.0.0 format
Expand Down
94 changes: 92 additions & 2 deletions src/test/java/com/launchdarkly/sdk/server/EventOutputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.launchdarkly.sdk.UserAttribute;
import com.launchdarkly.sdk.server.EventSummarizer.EventSummary;
import com.launchdarkly.sdk.server.interfaces.Event;
import com.launchdarkly.sdk.server.interfaces.Event.AliasEvent;
import com.launchdarkly.sdk.server.interfaces.Event.FeatureRequest;

import org.junit.Test;
Expand Down Expand Up @@ -166,12 +167,16 @@ private void testPrivateAttributes(EventsConfiguration config, LDUser user, Stri
assertEquals(o.build(), userJson);
}

private ObjectBuilder buildFeatureEventProps(String key) {
private ObjectBuilder buildFeatureEventProps(String key, String userKey) {
return LDValue.buildObject()
.put("kind", "feature")
.put("key", key)
.put("creationDate", 100000)
.put("userKey", "userkey");
.put("userKey", userKey);
}

private ObjectBuilder buildFeatureEventProps(String key) {
return buildFeatureEventProps(key, "userkey");
}

@Test
Expand All @@ -180,6 +185,7 @@ public void featureEventIsSerialized() throws Exception {
EventFactory factoryWithReason = eventFactoryWithTimestamp(100000, true);
DataModel.FeatureFlag flag = flagBuilder("flag").version(11).build();
LDUser user = new LDUser.Builder("userkey").name("me").build();
LDUser anon = new LDUser.Builder("anonymouskey").anonymous(true).build();
EventOutputFormatter f = new EventOutputFormatter(defaultEventsConfig());

FeatureRequest feWithVariation = factory.newFeatureRequestEvent(flag, user,
Expand Down Expand Up @@ -266,6 +272,18 @@ public void featureEventIsSerialized() throws Exception {
.put("prereqOf", "parent")
.build();
assertEquals(feJson8, getSingleOutputEvent(f, prereqWithoutResult));

FeatureRequest anonFeWithVariation = factory.newFeatureRequestEvent(flag, anon,
new Evaluator.EvalResult(LDValue.of("flagvalue"), 1, EvaluationReason.off()),
LDValue.of("defaultvalue"));
LDValue anonFeJson1 = buildFeatureEventProps("flag", "anonymouskey")
.put("version", 11)
.put("variation", 1)
.put("value", "flagvalue")
.put("default", "defaultvalue")
.put("contextKind", "anonymousUser")
.build();
assertEquals(anonFeJson1, getSingleOutputEvent(f, anonFeWithVariation));
}

@Test
Expand All @@ -288,6 +306,7 @@ public void identifyEventIsSerialized() throws IOException {
public void customEventIsSerialized() throws IOException {
EventFactory factory = eventFactoryWithTimestamp(100000, false);
LDUser user = new LDUser.Builder("userkey").name("me").build();
LDUser anon = new LDUser.Builder("userkey").name("me").anonymous(true).build();
EventOutputFormatter f = new EventOutputFormatter(defaultEventsConfig());

Event.Custom ceWithoutData = factory.newCustomEvent("customkey", user, LDValue.ofNull(), null);
Expand Down Expand Up @@ -329,6 +348,18 @@ public void customEventIsSerialized() throws IOException {
"\"metricValue\":2.5" +
"}");
assertEquals(ceJson4, getSingleOutputEvent(f, ceWithDataAndMetric));

Event.Custom ceWithDataAndMetricAnon = factory.newCustomEvent("customkey", anon, LDValue.of("thing"), 2.5);
LDValue ceJson5 = parseValue("{" +
"\"kind\":\"custom\"," +
"\"creationDate\":100000," +
"\"key\":\"customkey\"," +
"\"userKey\":\"userkey\"," +
"\"data\":\"thing\"," +
"\"metricValue\":2.5," +
"\"contextKind\":\"anonymousUser\"" +
"}");
assertEquals(ceJson5, getSingleOutputEvent(f, ceWithDataAndMetricAnon));
}

@Test
Expand Down Expand Up @@ -401,6 +432,65 @@ public void unknownEventClassIsNotSerialized() throws Exception {
assertEquals("[]", w.toString());
}

@Test
public void aliasEventIsSerialized() throws IOException {
EventFactory factory = eventFactoryWithTimestamp(1000, false);
LDUser user1 = new LDUser.Builder("bob-key").build();
LDUser user2 = new LDUser.Builder("jeff-key").build();
LDUser anon1 = new LDUser.Builder("bob-key-anon").anonymous(true).build();
LDUser anon2 = new LDUser.Builder("jeff-key-anon").anonymous(true).build();
AliasEvent userToUser = factory.newAliasEvent(user1, user2);
AliasEvent userToAnon = factory.newAliasEvent(anon1, user1);
AliasEvent anonToUser = factory.newAliasEvent(user1, anon1);
AliasEvent anonToAnon = factory.newAliasEvent(anon1, anon2);

EventOutputFormatter fmt = new EventOutputFormatter(defaultEventsConfig());

LDValue userToUserExpected = parseValue("{" +
"\"kind\":\"alias\"," +
"\"creationDate\":1000," +
"\"key\":\"bob-key\"," +
"\"contextKind\":\"user\"," +
"\"previousKey\":\"jeff-key\"," +
"\"previousContextKind\":\"user\"" +
"}");

assertEquals(userToUserExpected, getSingleOutputEvent(fmt, userToUser));

LDValue userToAnonExpected = parseValue("{" +
"\"kind\":\"alias\"," +
"\"creationDate\":1000," +
"\"key\":\"bob-key-anon\"," +
"\"contextKind\":\"anonymousUser\"," +
"\"previousKey\":\"bob-key\"," +
"\"previousContextKind\":\"user\"" +
"}");

assertEquals(userToAnonExpected, getSingleOutputEvent(fmt, userToAnon));

LDValue anonToUserExpected = parseValue("{" +
"\"kind\":\"alias\"," +
"\"creationDate\":1000," +
"\"key\":\"bob-key\"," +
"\"contextKind\":\"user\"," +
"\"previousKey\":\"bob-key-anon\"," +
"\"previousContextKind\":\"anonymousUser\"" +
"}");

assertEquals(anonToUserExpected, getSingleOutputEvent(fmt, anonToUser));

LDValue anonToAnonExpected = parseValue("{" +
"\"kind\":\"alias\"," +
"\"creationDate\":1000," +
"\"key\":\"bob-key-anon\"," +
"\"contextKind\":\"anonymousUser\"," +
"\"previousKey\":\"jeff-key-anon\"," +
"\"previousContextKind\":\"anonymousUser\"" +
"}");

assertEquals(anonToAnonExpected, getSingleOutputEvent(fmt, anonToAnon));
}

private static class FakeEventClass extends Event {
public FakeEventClass(long creationDate, LDUser user) {
super(creationDate, user);
Expand Down
Loading