Skip to content

Commit b4878a9

Browse files
committed
Megalinter and merge fixes
1 parent b10204a commit b4878a9

File tree

3 files changed

+4
-47
lines changed

3 files changed

+4
-47
lines changed

newrelic/api/opentelemetry.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -356,49 +356,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):
356356

357357
super().__exit__(exc_type, exc_val, exc_tb)
358358

359-
def __exit__(self, exc_type, exc_val, exc_tb):
360-
"""
361-
Ends context manager and calls `end` on the `Span`.
362-
This is used when span is called as a context manager
363-
i.e. `with tracer.start_span() as span:`
364-
"""
365-
if exc_val and self.is_recording():
366-
if self._record_exception:
367-
self.record_exception(exception=exc_val, escaped=True)
368-
if self.set_status_on_exception:
369-
self.set_status(Status(status_code=StatusCode.ERROR, description=f"{exc_type.__name__}: {exc_val}"))
370-
371-
super().__exit__(exc_type, exc_val, exc_tb)
372-
373-
def __exit__(self, exc_type, exc_val, exc_tb):
374-
"""
375-
Ends context manager and calls `end` on the `Span`.
376-
This is used when span is called as a context manager
377-
i.e. `with tracer.start_span() as span:`
378-
"""
379-
if exc_val and self.is_recording():
380-
if self._record_exception:
381-
self.record_exception(exception=exc_val, escaped=True)
382-
if self.set_status_on_exception:
383-
self.set_status(Status(status_code=StatusCode.ERROR, description=f"{exc_type.__name__}: {exc_val}"))
384-
385-
super().__exit__(exc_type, exc_val, exc_tb)
386-
387-
def __exit__(self, exc_type, exc_val, exc_tb):
388-
"""
389-
Ends context manager and calls `end` on the `Span`.
390-
This is used when span is called as a context manager
391-
i.e. `with tracer.start_span() as span:`
392-
"""
393-
if exc_val and self.is_recording():
394-
if self._record_exception:
395-
self.record_exception(exception=exc_val, escaped=True)
396-
if self.set_status_on_exception:
397-
self.set_status(Status(status_code=StatusCode.ERROR, description=f"{exc_type.__name__}: {exc_val}"))
398-
399-
super().__exit__(exc_type, exc_val, exc_tb)
400-
401-
402359
class Tracer(otel_api_trace.Tracer):
403360
def __init__(self, resource=None, instrumentation_library=None, *args, **kwargs):
404361
self.resource = resource

tests/hybridagent_flask/test_otel_application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def target_application():
5959
_exact_intrinsics = {"type": "Span"}
6060
_exact_root_intrinsics = _exact_intrinsics.copy().update({"nr.entryPoint": True})
6161
_expected_intrinsics = ["traceId", "transactionId", "sampled", "priority", "timestamp", "duration", "name", "category", "guid"]
62-
_expected_root_intrinsics = _expected_intrinsics.copy() + ["transaction.name"]
63-
_expected_child_intrinsics = _expected_intrinsics.copy() + ["parentId"]
62+
_expected_root_intrinsics = [*_expected_intrinsics.copy(), "transaction.name"]
63+
_expected_child_intrinsics = [*_expected_intrinsics.copy(), "parentId"]
6464
_unexpected_root_intrinsics = ["parentId"]
6565
_unexpected_child_intrinsics = ["nr.entryPoint", "transaction.name"]
6666

tests/hybridagent_opentelemetry/test_status.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ def _test():
182182
with tracer.start_as_current_span(name="TestSpan") as span:
183183
# Set the new status
184184
span.set_status(status_to_set, description)
185-
185+
186186
# If status code is OK, do not have description
187187
# if expected_status_code == StatusCode.OK:
188188
if span.status.status_code == StatusCode.OK:
189189
assert span.status.description is None
190-
190+
191191
# If status code is ERROR, make sure description
192192
# is set correctly (if provided):
193193
if span.status.status_code == StatusCode.ERROR:

0 commit comments

Comments
 (0)