Skip to content

Conversation

@pranjalv123
Copy link

@pranjalv123 pranjalv123 commented Dec 15, 2025

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Describe the solution you've provided

We'd like to be able to evaluate a flag without sending an evaluation event to LaunchDarkly. This is useful, for example, for internal tooling that helps debug issues by listing the value of a flag for a particular context. We don't want to send an evaluation event to LD because it doesn't constitute a "real" evaluation so we don't want to consider it as evidence that a flag is still being evaluated and shouldn't be cleaned up.

Describe alternatives you've considered

  • we can get this behavior by evaluating all_flags_state, but that's a much more expensive operation, and doesn't allow us to pass custom contexts on a per-flag basis
  • we can do this through the LD API, but that's slower and is rate limited.

Note

Adds a per-call send_events flag to variation/variation_detail to evaluate without emitting events, with internal wiring and a test.

  • Client API:
    • Add send_events optional parameter (default True) to LDClient.variation and LDClient.variation_detail to allow evaluating flags without emitting analytics events.
    • Thread send_events through _evaluate_internal, gating all event emissions (new_unknown_flag_event, evaluation result events, and default events).
    • Update method docstrings accordingly.
  • Tests:
    • Add test_no_event_when_send_events_false verifying no events are produced when send_events=False.

Written by Cursor Bugbot for commit c9d92a7. This will update automatically on new commits. Configure here.

@pranjalv123 pranjalv123 requested a review from a team as a code owner December 15, 2025 22:40
@pranjalv123 pranjalv123 changed the title Allow not sending evaluation event Allow not sending evaluation event when evaluating a flag Dec 15, 2025
@jsonbailey
Copy link
Contributor

@pranjalv123 can you share a little more about your use case? Are you wanting to have this available in your production app where some flag evaluations send events and others do not, or for an internal app where you can evaluate all flags without sending events?

We do support disabling events via the config (send_events) but it is a global option and I'm unsure if that would meet your needs.

@pranjalv123 pranjalv123 changed the title Allow not sending evaluation event when evaluating a flag feat: Allow not sending evaluation event when evaluating a flag Dec 16, 2025
@pranjalv123
Copy link
Author

Are you wanting to have this available in your production app where some flag evaluations send events and others do not?

Yes, it's this. We primarily use this for internal tooling/analytics, but because we want to calculate the launchdarkly context exactly the same way as we do in our production app, it's easiest to do the evaluation from our production app. I can imagine a world where we initialize a separate client to do the non-tracking evaluations, but that would have some overhead in terms of redis connections (for relay proxy in daemon mode), memory usage, complexity, etc.

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.

2 participants