Skip to content

Commit

Permalink
Merge pull request #434 from majanjua-amzn/master
Browse files Browse the repository at this point in the history
Fix warning message condition for subsegment ending
  • Loading branch information
wangzlei committed May 29, 2024
2 parents e65d05b + e62f0c5 commit 1ea7768
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions aws_xray_sdk/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ def end_subsegment(self, end_time=None):
:param float end_time: epoch in seconds. If not specified the current
system time will be used.
"""
subsegment = self.get_trace_entity()
if self._is_subsegment(subsegment):
subsegment.close(end_time)
entity = self.get_trace_entity()
if self._is_subsegment(entity):
entity.close(end_time)
self._local.entities.pop()
return True
elif isinstance(entity, DummySegment):
return False
else:
log.warning("No subsegment to end.")
return False
Expand Down

0 comments on commit 1ea7768

Please sign in to comment.