coldbox-modules / LaunchDarklySDK

A CFML SDK for Launch Darkly feature flags
8 stars 4 forks source link

Newer version of Java SDK (6.0) - SDK v5 End of Life in Dec 2023 #3

Closed SMSMichael closed 9 months ago

SMSMichael commented 1 year ago

Hi all!

Late in 2022 LaunchDarkly released v6.0 of their Java SDK, which introduced a major significant change to how flag targets are evaluated. Rather than shove everything in the User object as had been done in the past, LaunchDarkly is changing flag target data to use what they call Contexts. Contexts are basically a more flexible way to organize the information you want to use for targeting (e.g. Users are still a "Context", but the following could be as well: Environment, Browser/Device, Geographic Location, Organization/Company, etc.). Details on the differences between Java SDK v5 (currently in use with this module) and v6 can be found here: https://docs.launchdarkly.com/sdk/server-side/java/migration-5-to-6

Based on my understanding of the changes, LaunchDarkly has changed the underlying SDK APIs have changed in v6, which will most likely introduce breaking changes for this module.

LaunchDarkly has reported that their Java v5 SDKs are being deprecated - according to their End of Life Policy (https://launchdarkly.com/policies/end-of-life-policy/) this means that v5 will be supported through December 2023, which is 12 months from the published release date of v6.0.0 (12/7/2022).

Having looked through the code for this module, I am a fair ways from groking what changes are needed to support SDK v6 either as a minimum viable product (e.g. only User context) or to fully build out the Context API in this module. Opening up this issue for anyone with availability & interest in learning more about LD v6.

FYI - for those interested in learning more about how LaunchDarkly's new Context system works, they've updated their material in their https://academy.launchdarkly.com site - their Bronze developer certification track does a great job introducing how the concept works with training material + videos.

SMSMichael commented 1 year ago

Initial investigation: simply swapping out the jar dependency results in MOST unit tests passing (yay!)

"dependencies":{
        "launchdarkly-java-server-sdk":"jar:https://search.maven.org/remotecontent?filepath=com/launchdarkly/launchdarkly-java-server-sdk/6.0.6/launchdarkly-java-server-sdk-6.0.6.jar"
    }

The failures include the following

Note: These are are tested using the test-flags.json test file and are not currently hitting the live LD service. I am expecting that LD has introduced a new version of the flag "dump" JSON file this test file is based on that includes additional elements for the Context system.

bdw429s commented 1 year ago

Hi @SMSMichael , the new Java SDK is something we'd like to support soon. I assume it will be a major bump in the library version, but from the upgrade guide, it doesn't seem like it's a huge change per se. Feel free to submit any work you do as a pull request to help that effort along.

SMSMichael commented 1 year ago

Thanks @bdw429s - I spent some time this week playing around with the module with the new SDK loaded. I was able to resolve an issue related to the default User attributes changing, but the Java proxy pieces are a little beyond my wheelhouse. I've uploaded my changes as a draft PR to give you a sense of the progress made so far (see #4 )

bdw429s commented 1 year ago

@SMSMichael Please see the new 2.0.0-beta build on ForgeBox where I've incorporated the changes in your pull with support for the new context stuff.

SMSMichael commented 1 year ago

@bdw429s just confirming that the updated module w/ the newer SDK is working great for us. I noticed that the version posted to Forgebox is still 1.5.3 - I wasn't sure if I should close this comment or wait until that bumps to 2+. Can you let me know how you'd like to see this GitHub issue handled?

bdw429s commented 11 months ago

@SMSMichael Thanks for reminding me. I've published 2.0.1 as a stable version now