Skip to content

Commit

Permalink
Fix warning message condition for subsegment ending
Browse files Browse the repository at this point in the history
  • Loading branch information
majanjua-amzn committed May 29, 2024
1 parent e65d05b commit e62f0c5
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 e62f0c5

Please sign in to comment.