File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -21,23 +21,19 @@ class OpenFeatureIntegration(Integration):
2121 thread-local state to be serialized and sent off in the error payload.
2222 """
2323
24- def __init__ (self ):
25- # type: (int) -> None
26- # Store the error processor on the current scope. If its forked
27- # (i.e. threads are spawned) the callback will be copied to the
28- # new Scope.
24+ @staticmethod
25+ def setup_once ():
26+ def error_processor (event , exc_info ):
27+ scope = sentry_sdk .get_current_scope ()
28+ event ["contexts" ]["flags" ] = {"values" : scope .flags .get ()}
29+ return event
30+
2931 scope = sentry_sdk .get_current_scope ()
30- scope .add_error_processor (self . error_processor )
32+ scope .add_error_processor (error_processor )
3133
3234 # Register the hook within the global openfeature hooks list.
3335 api .add_hooks (hooks = [OpenFeatureHook ()])
3436
35- def error_processor (self , event , exc_info ):
36- event ["contexts" ]["flags" ] = {
37- "values" : sentry_sdk .get_current_scope ().flags .get ()
38- }
39- return event
40-
4137
4238class OpenFeatureHook (Hook ):
4339
You can’t perform that action at this time.
0 commit comments