Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LaunchDarkly and OpenFeature integration #3648

Merged
merged 38 commits into from
Nov 4, 2024

Conversation

cmanallen
Copy link
Member

@cmanallen cmanallen commented Oct 11, 2024

Adds LaunchDarkly and OpenFeature integration and extends the Scope with a flags property.

As flags are evaluated by an application they are stored within the Sentry SDK (lru cache). When an error occurs we fetch the flags stored in the SDK and serialize them on the event.

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 89.52381% with 11 lines in your changes missing coverage. Please review.

Project coverage is 84.33%. Comparing base (d06a189) to head (200917f).
Report is 4 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/flag_utils.py 82.60% 4 Missing ⚠️
sentry_sdk/integrations/openfeature.py 84.00% 2 Missing and 2 partials ⚠️
sentry_sdk/integrations/launchdarkly.py 91.17% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3648      +/-   ##
==========================================
+ Coverage   84.29%   84.33%   +0.04%     
==========================================
  Files         133      136       +3     
  Lines       14262    14367     +105     
  Branches     2405     2417      +12     
==========================================
+ Hits        12022    12117      +95     
- Misses       1489     1497       +8     
- Partials      751      753       +2     
Files with missing lines Coverage Δ
sentry_sdk/_lru_cache.py 100.00% <100.00%> (ø)
sentry_sdk/consts.py 99.51% <ø> (ø)
sentry_sdk/scope.py 88.51% <100.00%> (+0.30%) ⬆️
sentry_sdk/integrations/launchdarkly.py 91.17% <91.17%> (ø)
sentry_sdk/flag_utils.py 82.60% <82.60%> (ø)
sentry_sdk/integrations/openfeature.py 84.00% <84.00%> (ø)

@cmanallen cmanallen marked this pull request as ready for review October 21, 2024 14:37
sentry_sdk/scope.py Outdated Show resolved Hide resolved
@cmanallen cmanallen requested a review from a team October 22, 2024 13:32
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

Will have a proper look soon -- just two comments regarding tox for now

tox.ini Outdated Show resolved Hide resolved
tox.ini Show resolved Hide resolved
@antonpirker antonpirker self-assigned this Oct 24, 2024
@antonpirker antonpirker added the New Integration Integrating with a new framework or library label Oct 24, 2024
@antonpirker
Copy link
Member

Hey @cmanallen ! This is the best PR I have received ever! Great work.

The integrations should not change the Scope.

I have created an commit on your branch to illustrate how the flags could live on the integration rather than the scope (I hope you don't mind):
430387f

This way all the functionality is contained in the integration.
I also added some tests to show how you can now set the capacity of the buffer when initializing the Integration.

wdyt?

Feel free to make changes to my commit if you want to do things differently.

@cmanallen
Copy link
Member Author

@antonpirker Reverted your commit per our conversation on Slack. Tl;dr the commit didn't work because we need to be tied to the scope to maintain flag isolation. After @sl0thentr0py's comment about it being fine to keep the flags on the scope if this change is permanent I think its appropriate to revert that change.

@cmanallen cmanallen changed the title Add OpenFeature integration Add LaunchDarkly and OpenFeature integration Oct 30, 2024
Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

After discussion with the team updating the scope is fine. This is ready to be merged!

@antonpirker antonpirker merged commit dd1117d into master Nov 4, 2024
136 checks passed
@antonpirker antonpirker deleted the cmanallen/flags-open-feature-integration branch November 4, 2024 12:00
@cmanallen
Copy link
Member Author

Thanks @antonpirker and welcome back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Integration Integrating with a new framework or library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants