Skip to content

Commit

Permalink
update tests to reflect opentelemetry error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsben committed May 27, 2021
1 parent 37ccc12 commit df186c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ def close(self):
def __exit__(self, exc_type, exc_val, exc_tb):
"""
Override the __exit__ method of `opentracing.scope.Scope` so we can report
exceptions correctly in opentelemetry specification format. """
exceptions correctly in opentelemetry specification format.
"""
self._end_span_scope(exc_type, exc_val, exc_tb)

def _end_span_scope(
Expand Down
6 changes: 4 additions & 2 deletions shim/opentelemetry-opentracing-shim/tests/test_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,12 @@ def test_span_on_error(self):
# Raise an exception while a span is active.
with self.assertRaises(Exception):
with self.shim.start_active_span("TestName") as scope:
raise Exception
raise Exception("bad thing")

# Verify exception details have been added to span.
self.assertEqual(scope.span.unwrap().attributes["error"], True)
exc_event = scope.span.unwrap().events[0]
self.assertEqual(exc_event.name, "exception")
self.assertEqual(exc_event.attributes["exception.message"], "bad thing")

def test_inject_http_headers(self):
"""Test `inject()` method for Format.HTTP_HEADERS."""
Expand Down

0 comments on commit df186c4

Please sign in to comment.