Skip to content

Commit 144e064

Browse files
committed
Move hook registration to the init method
1 parent 44aebf3 commit 144e064

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

sentry_sdk/integrations/launchdarkly.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,14 @@ def __init__(self, ld_client=None):
3535
if not client.is_initialized():
3636
raise DidNotEnable("LaunchDarkly client is not initialized.")
3737

38-
self.client = client
38+
# Register the flag collection hook with the LD client.
39+
client.add_hook(LaunchDarklyHook())
3940

4041
@staticmethod
4142
def setup_once():
4243
# type: () -> None
43-
integration = sentry_sdk.get_client().get_integration(LaunchDarklyIntegration)
44-
if integration is None:
45-
raise DidNotEnable("LaunchDarkly client is not initialized.")
46-
4744
scope = sentry_sdk.get_current_scope()
4845
scope.add_error_processor(flag_error_processor)
49-
# Register the flag collection hook with the LD client.
50-
integration.client.add_hook(LaunchDarklyHook())
5146

5247

5348
class LaunchDarklyHook(Hook):

0 commit comments

Comments
 (0)