Skip to content

Conversation

@adinauer
Copy link
Member

📜 Description

Implement LaunchDarkly Integrations for Android (sentry-launchdarkly-android) and JVM (sentry-launchdarkly-server)

💡 Motivation and Context

Closes #4867

💚 How did you test it?

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@adinauer
Copy link
Member Author

adinauer commented Nov 19, 2025

Android snippet used for testing in our Sample Android App:

    LDConfig config =
      new LDConfig.Builder(LDConfig.Builder.AutoEnvAttributes.Disabled)
        .mobileKey("mobile-key")
        .hooks(Components.hooks()
          .setHooks(Arrays.asList(new SentryLaunchDarklyAndroidHook())))
        .build();
    LDContext context = LDContext.create("context-key-123abc");
    ldClient = LDClient.init(this.getApplication(), config, context, 0);
    ldClient.track("691af61abada7a09f600e4d8");
ldClient.boolVariation("my-ld-flag1", false);

@adinauer
Copy link
Member Author

adinauer commented Nov 19, 2025

Server snippet used for testing on our Spring Boot 3 sample:

  @Bean
  public LDClient launchDarkly() {
    LDConfig config =
        new LDConfig.Builder()
          .hooks(Components.hooks()
            .setHooks(Arrays.asList(new SentryLaunchDarklyServerHook())))
            .build();
    LDClient ldClient = new LDClient("sdk-key", config);

    return ldClient;
  }

    boolean flagValue =
      client.boolVariation("my-ld-flag1", LDContext.create("example-context-key"), false);

@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 0874d7a

@adinauer adinauer changed the title Implement LaunchDarkly Integrations feat(flags): Implement LaunchDarkly Integrations Nov 19, 2025
@adinauer
Copy link
Member Author

Not sure how we would test this e2e on our samples since a LaunchDarkly account is needed to successfully retrieve flag values.

@adinauer adinauer marked this pull request as ready for review November 19, 2025 15:06
@adinauer
Copy link
Member Author

Maybe we could utilize https://demo.app.launchdarkly.com/projects/default/flags?env=production&selected-env=production but I assume since this is public we can't really rely on it producing any predictable results for testing. Also not sure if / how we can get SDK and mobile keys for it.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 351.65 ms 426.18 ms 74.54 ms
Size 1.58 MiB 2.13 MiB 557.32 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
604a261 380.65 ms 451.27 ms 70.62 ms
ee747ae 382.73 ms 435.41 ms 52.68 ms
b77456b 393.26 ms 441.10 ms 47.84 ms
9fbb112 401.87 ms 515.87 ms 114.00 ms
806307f 357.85 ms 424.64 ms 66.79 ms
27d7cf8 309.43 ms 364.27 ms 54.85 ms
7314dbe 437.83 ms 505.64 ms 67.81 ms
d217708 375.27 ms 415.68 ms 40.41 ms
96449e8 361.30 ms 423.39 ms 62.09 ms
1df7eb6 397.04 ms 429.64 ms 32.60 ms

App size

Revision Plain With Sentry Diff
604a261 1.58 MiB 2.10 MiB 533.42 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
b77456b 1.58 MiB 2.12 MiB 548.11 KiB
9fbb112 1.58 MiB 2.11 MiB 539.18 KiB
806307f 1.58 MiB 2.10 MiB 533.42 KiB
27d7cf8 1.58 MiB 2.12 MiB 549.42 KiB
7314dbe 1.58 MiB 2.10 MiB 533.45 KiB
d217708 1.58 MiB 2.10 MiB 532.97 KiB
96449e8 1.58 MiB 2.11 MiB 539.35 KiB
1df7eb6 1.58 MiB 2.10 MiB 532.97 KiB

Previous results on branch: feat/launchdarkly

Startup times

Revision Plain With Sentry Diff
43b9a96 294.94 ms 352.54 ms 57.60 ms
06ca16e 297.48 ms 345.96 ms 48.48 ms

App size

Revision Plain With Sentry Diff
43b9a96 1.58 MiB 2.13 MiB 557.31 KiB
06ca16e 1.58 MiB 2.13 MiB 557.31 KiB

}

@Override
public Map<String, Object> afterEvaluation(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a public method anyway, we could write a test which mimics the afterEvaluation call, and verifies a mocked scope .addFeatureFlag() call is being made. WDYT?

@adinauer adinauer merged commit 301c2da into main Nov 21, 2025
60 checks passed
@adinauer adinauer deleted the feat/launchdarkly branch November 21, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report LaunchDarkly feature flag evaluations

4 participants