Skip to content

Commit

Permalink
Only add flags when there are some
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Jan 10, 2025
1 parent a153e19 commit ea9d136
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,9 @@ def _apply_contexts_to_event(self, event, hint, options):
contexts["trace"] = self.get_trace_context()

# Add "flags" context
contexts.setdefault("flags", {}).update({"values": self.flags.get()})
flags = self.flags.get()
if len(flags) > 0:
contexts.setdefault("flags", {}).update({"values": flags})

def _drop(self, cause, ty):
# type: (Any, str) -> Optional[Any]
Expand Down

0 comments on commit ea9d136

Please sign in to comment.