Conversation
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop-v12.0.0 #1489 +/- ##
==================================================
Coverage ? 81.74%
==================================================
Files ? 210
Lines ? 24361
Branches ? 3824
==================================================
Hits ? 19913
Misses ? 3144
Partials ? 1304 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b718186 to
d5a2458
Compare
Good call--this is still needed for synthetics Co-authored-by: Hannah Stepanek <hstepanek@newrelic.com>
| def _nr_process_response(response, transaction): | ||
| nr_headers = transaction.process_response(response.status, response.headers) | ||
|
|
||
| response._headers.update(nr_headers) |
There was a problem hiding this comment.
A lot of instrumentation removed from this file, but we still need it. We should be calling process_response to capture the status code for web transactions and the headers as agent attributes.
| # limitations under the License. | ||
|
|
||
| import asyncio | ||
|
|
There was a problem hiding this comment.
Could probably rename this file to just test_client.py now.
There was a problem hiding this comment.
Also, we have a test_server_dt.py but no corresponding tests for outbound DT headers in the aiohttp client. We should add tests from this, as we've just removed the test_client_cat.py file that has the only thing remotely resembling tests for this.
| @@ -52,7 +51,8 @@ def task(loop, method, exc_expected, url): | |||
| assert isinstance(text_list[0], _expected_error_class), text_list[0].__class__ | |||
| assert isinstance(text_list[1], _expected_error_class), text_list[1].__class__ | |||
| else: | |||
| assert text_list[0] == text_list[1], text_list | |||
| assert text_list[0] | |||
There was a problem hiding this comment.
Why was this fine? Shouldn't we be keeping the behavior of these assertions? (Context: #1489 (comment))
newrelic/hooks/framework_aiohttp.py
Outdated
| @@ -381,9 +356,6 @@ async def _coro(*_args, **_kwargs): | |||
|
|
|||
| def instrument_aiohttp_web(module): | |||
| global _nr_process_response | |||
There was a problem hiding this comment.
| global _nr_process_response |
newrelic/hooks/framework_aiohttp.py
Outdated
| @@ -279,16 +263,13 @@ async def _coro(): | |||
| response = await wrapped(*args, **kwargs) | |||
|
|
|||
| try: | |||
| trace.process_response_headers(response.headers.items()) | |||
| trace.process_response(status_code=response.status) | |||
| except: | |||
| pass | |||
|
|
|||
| return response | |||
| except Exception as e: | |||
| try: | |||
| trace.process_response_headers(e.headers.items()) | |||
| except: | |||
| pass | |||
| except Exception: | |||
| notice_error() | |||
|
|
|||
| raise | |||
There was a problem hiding this comment.
I don't think we want to call notice_error here necessarily, it's not equivalent to what we had before. I think this outer try/except can be deleted and we end up with just the success case.
response = await wrapped(*args, **kwargs)
try:
trace.process_response(status_code=response.status)
except:
pass
return response
There was a problem hiding this comment.
I don't see any issues with that commit
|
|
||
| flat_event = _flatten(event) | ||
|
|
||
| assert "nr.guid" in flat_event, f"name=nr.guid, event={flat_event!r}" |
There was a problem hiding this comment.
This shouldn't be deleted
|
|
||
| apdex_perf_zone = self.apdex_perf_zone() | ||
| _add_if_not_empty("apdexPerfZone", apdex_perf_zone) | ||
| _add_if_not_empty("nr.apdexPerfZone", apdex_perf_zone) |
There was a problem hiding this comment.
Are we confident this isn't used in the UI anywhere?
| _process_module_definition( | ||
| "aiohttp.web_reqrep", "newrelic.hooks.framework_aiohttp", "instrument_aiohttp_web_response" | ||
| ) | ||
| _process_module_definition( | ||
| "aiohttp.web_response", "newrelic.hooks.framework_aiohttp", "instrument_aiohttp_web_response" | ||
| ) |
There was a problem hiding this comment.
Don't we still need these?
| assert intrinsics["error.class"] == required_attrs["error.class"] | ||
| assert intrinsics["error.message"].startswith(required_attrs["error.message"]) | ||
| assert intrinsics["error.expected"] == required_attrs["error.expected"] | ||
| assert intrinsics["nr.transactionGuid"] is not None |
There was a problem hiding this comment.
As far as I can tell this still exists and we need this line
There was a problem hiding this comment.
You're right. Even though this was initially a CAT attribute, it is also used for error events.
| # Test default settings. | ||
|
|
||
| _expected_attributes = {"agent": TRACE_ERROR_AGENT_KEYS, "user": ERROR_USER_ATTRS, "intrinsic": ["trip_id"]} | ||
| _expected_attributes = {"agent": TRACE_ERROR_AGENT_KEYS, "user": ERROR_USER_ATTRS, "intrinsic": ["guid"]} |
There was a problem hiding this comment.
All of these changes where we deleted trip_id are breaking this file, it's supposed to test for the behavior of intrinsics. I replaced them all with guid and that should solve all those issues.

This PR removes Cross Application Tracing (CAT) from the agent