From bb75e160d79596edf172b81ad6168e0c0d947dc4 Mon Sep 17 00:00:00 2001 From: Lalleh Rafeei Date: Tue, 14 May 2024 15:17:09 -0700 Subject: [PATCH] Disable browser monitoring with aiobotocore --- newrelic/hooks/external_aiobotocore.py | 6 ++++++ tests/external_aiobotocore/conftest.py | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/newrelic/hooks/external_aiobotocore.py b/newrelic/hooks/external_aiobotocore.py index 7c8be883b0..6103dab94d 100644 --- a/newrelic/hooks/external_aiobotocore.py +++ b/newrelic/hooks/external_aiobotocore.py @@ -31,6 +31,12 @@ async def wrap_endpoint_make_request(wrapped, instance, args, kwargs): with ExternalTrace(library="aiobotocore", url=url, method=method, source=wrapped) as trace: try: + # Because AIOBotocore's proxy functionality uses aiohttp + # and urllib3 under the hood, New Relic has portions that + # are classified as Web Transactions. This means that + # browser monitoring will now be true. However, this will + # inject unwanted JS Agent Header Fragments into SQS responses. + trace.settings.browser_monitoring.enabled = False trace._add_agent_attribute("aws.operation", operation_model.name) except: pass diff --git a/tests/external_aiobotocore/conftest.py b/tests/external_aiobotocore/conftest.py index 69a477c81a..53548dfda6 100644 --- a/tests/external_aiobotocore/conftest.py +++ b/tests/external_aiobotocore/conftest.py @@ -39,7 +39,6 @@ "transaction_tracer.stack_trace_threshold": 0.0, "debug.log_data_collector_payloads": True, "debug.record_transaction_failure": True, - "browser_monitoring.enabled": False, } collector_agent_registration = collector_agent_registration_fixture( app_name="Python Agent Test (external_aiobotocore)",