Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
61e2b9a
Remove cross_application_tracer.enabled setting
lrafeei Sep 9, 2025
e9bab52
Remove cat_enabled fixture
lrafeei Sep 9, 2025
fb1b85e
Remove validate_outbound_headers, make_cross_agent_headers
lrafeei Sep 9, 2025
4df07f3
Remove path_hash
lrafeei Sep 9, 2025
e5a0d4e
Fix tornado tests
lrafeei Sep 9, 2025
d145940
Fix aiohttp tests
lrafeei Sep 10, 2025
01da681
Fix httpx tests
lrafeei Sep 10, 2025
e3389f3
Fix pika tests
lrafeei Sep 10, 2025
a32ca51
Fix sanic tests
lrafeei Sep 10, 2025
5b52a78
Remove more CAT tests
lrafeei Sep 10, 2025
931b1c6
Remove nr.guid
lrafeei Sep 10, 2025
c9e7278
Rename synthetics in CatHeaderMixin
lrafeei Sep 10, 2025
3df9e14
Remove process_response_headers
lrafeei Sep 11, 2025
89c9fb5
Remove validate_external_node_params
lrafeei Sep 11, 2025
23ff187
Rename CatHeaderMixin to HeaderMixin
lrafeei Sep 11, 2025
566d250
Remove _generate_response_headers
lrafeei Sep 11, 2025
521496c
Remove insert_incoming_headers
lrafeei Sep 11, 2025
f7bd2ee
Remove create_incoming_headers
lrafeei Sep 11, 2025
5ed7055
Remove X-NewRelic-App-Data
lrafeei Sep 11, 2025
af451d6
Remove cross_process_id
lrafeei Sep 11, 2025
1adb307
Remove external_txn_name
lrafeei Sep 11, 2025
46436eb
Remove referring_transaction_guid
lrafeei Sep 11, 2025
855d65e
Remove trip_id
lrafeei Sep 11, 2025
954177d
Remove convert_to_cat_metadata_value
lrafeei Sep 11, 2025
0f29d92
Change names from cat_ to dt_
lrafeei Sep 11, 2025
e550a5c
Tweak test
lrafeei Sep 11, 2025
c120b3f
Remove skip all test file
lrafeei Sep 12, 2025
8d0db2c
Fix syntax from rebase
lrafeei Sep 12, 2025
a315e5d
Fix httplib test
lrafeei Sep 12, 2025
ea18200
Fix Megalinter errors
lrafeei Sep 12, 2025
bcb5dba
Remove commented out code
lrafeei Sep 13, 2025
9d16587
Fix requests test
lrafeei Sep 13, 2025
a12b023
Merge branch 'develop-11.0.0' into remove_CAT
mergify[bot] Sep 19, 2025
91cd056
Merge branch 'develop-11.0.0' into remove_CAT
mergify[bot] Sep 19, 2025
b91866b
Merge branch 'develop-11.0.0' into remove_CAT
lrafeei Sep 19, 2025
d88c7f5
Merge remote-tracking branch 'origin/main' into remove_CAT
TimPansino Sep 22, 2025
f53c517
Rename cross_process_headers to distributed_tracing_headers
TimPansino Sep 22, 2025
e4c8f8a
Merge branch 'main' into remove_CAT
mergify[bot] Sep 22, 2025
5f57d60
Merge branch 'main' into remove_CAT
mergify[bot] Sep 23, 2025
5a2523a
Remove cross agent cat fixtures
hmstepanek Sep 24, 2025
6d0688f
Add back tenr.apdexPerfZone as not CAT specific
hmstepanek Sep 24, 2025
7b3623f
Remove distributed_trace_key from header mixin
hmstepanek Sep 24, 2025
102249c
Remove config instead of commenting out
hmstepanek Sep 24, 2025
d674907
Put back transactionGuid
hmstepanek Sep 24, 2025
0fa69ec
Return None in process_response
hmstepanek Sep 24, 2025
7f3fbd5
Still pass settings into finalize application settings call
hmstepanek Sep 24, 2025
14d514b
DT_RESPONSE_CODE->RESPONSE_CODE
hmstepanek Sep 24, 2025
9282bb3
Merge branch 'main' into remove_CAT
mergify[bot] Sep 24, 2025
a68e823
respond_with_dt_header->response_handler
hmstepanek Sep 24, 2025
efe1dd8
Merge branch 'remove_CAT' of github.com:newrelic/newrelic-python-agen…
hmstepanek Sep 24, 2025
693de17
Fixup: syntax error
hmstepanek Sep 24, 2025
6510cc1
Put back nr.guid if synthetics resource id
hmstepanek Sep 24, 2025
ddd584e
Remove cross_application_tracer.enabled setting
lrafeei Sep 9, 2025
d177cb7
Remove cat_enabled fixture
lrafeei Sep 9, 2025
74f922a
Remove validate_outbound_headers, make_cross_agent_headers
lrafeei Sep 9, 2025
695d2b9
Remove path_hash
lrafeei Sep 9, 2025
c4b6037
Fix tornado tests
lrafeei Sep 9, 2025
aaac4cb
Fix aiohttp tests
lrafeei Sep 10, 2025
1d36f99
Fix httpx tests
lrafeei Sep 10, 2025
71099fa
Fix pika tests
lrafeei Sep 10, 2025
49c59cb
Fix sanic tests
lrafeei Sep 10, 2025
af418d7
Remove more CAT tests
lrafeei Sep 10, 2025
0b945ad
Remove nr.guid
lrafeei Sep 10, 2025
72f5cf1
Rename synthetics in CatHeaderMixin
lrafeei Sep 10, 2025
bb5215e
Remove process_response_headers
lrafeei Sep 11, 2025
4658a32
Remove validate_external_node_params
lrafeei Sep 11, 2025
80ab24a
Rename CatHeaderMixin to HeaderMixin
lrafeei Sep 11, 2025
ddcee7e
Remove _generate_response_headers
lrafeei Sep 11, 2025
84a22e5
Remove insert_incoming_headers
lrafeei Sep 11, 2025
840ec5a
Remove create_incoming_headers
lrafeei Sep 11, 2025
c2bb71a
Remove X-NewRelic-App-Data
lrafeei Sep 11, 2025
f4d1182
Remove cross_process_id
lrafeei Sep 11, 2025
c19488c
Remove external_txn_name
lrafeei Sep 11, 2025
17e4359
Remove referring_transaction_guid
lrafeei Sep 11, 2025
217063b
Remove trip_id
lrafeei Sep 11, 2025
4907b13
Remove convert_to_cat_metadata_value
lrafeei Sep 11, 2025
c7b0584
Change names from cat_ to dt_
lrafeei Sep 11, 2025
624c8f2
Tweak test
lrafeei Sep 11, 2025
d4ebb13
Remove skip all test file
lrafeei Sep 12, 2025
693c8c6
Fix syntax from rebase
lrafeei Sep 12, 2025
b7c8aae
Fix httplib test
lrafeei Sep 12, 2025
0f17453
Fix Megalinter errors
lrafeei Sep 12, 2025
36c4fa9
Remove commented out code
lrafeei Sep 13, 2025
6fbfac4
Fix requests test
lrafeei Sep 13, 2025
125cf1c
Rename cross_process_headers to distributed_tracing_headers
TimPansino Sep 22, 2025
b0a5032
Remove cross agent cat fixtures
hmstepanek Sep 24, 2025
1a42b17
Add back tenr.apdexPerfZone as not CAT specific
hmstepanek Sep 24, 2025
58b748b
Remove distributed_trace_key from header mixin
hmstepanek Sep 24, 2025
4618058
Remove config instead of commenting out
hmstepanek Sep 24, 2025
0175faa
Put back transactionGuid
hmstepanek Sep 24, 2025
dd197f1
Return None in process_response
hmstepanek Sep 24, 2025
088a9ff
Still pass settings into finalize application settings call
hmstepanek Sep 24, 2025
05fc6ea
DT_RESPONSE_CODE->RESPONSE_CODE
hmstepanek Sep 24, 2025
2821057
respond_with_dt_header->response_handler
hmstepanek Sep 24, 2025
500e2d0
Move codecov.yml file to .github folder (#1516)
TimPansino Sep 24, 2025
58b1f12
Fixup: syntax error
hmstepanek Sep 24, 2025
6e5cb42
Put back nr.guid if synthetics resource id
hmstepanek Sep 24, 2025
ab46644
Merge branch 'remove_CAT' of github.com:newrelic/newrelic-python-agen…
hmstepanek Sep 24, 2025
f0677f6
Trigger tests
hmstepanek Sep 24, 2025
a0879f5
Remove corresponding config call
hmstepanek Sep 24, 2025
144e52e
Fixup: spacing
hmstepanek Sep 24, 2025
1812a9e
Fixup
hmstepanek Sep 24, 2025
9e94916
Trigger tests
hmstepanek Sep 24, 2025
ad8d6fa
Merge branch 'main' into remove_CAT
mergify[bot] Sep 25, 2025
d51924b
Merge ad8d6fa9d5f827c1229a781d8d3e8702a47ac298 into baecae80c203a991d…
lrafeei Sep 25, 2025
2882b03
[MegaLinter] Apply linters fixes
mergify[bot] Sep 25, 2025
f029733
Merge branch 'main' into remove_CAT
mergify[bot] Sep 25, 2025
950410c
Merge branch 'main' into remove_CAT
mergify[bot] Sep 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 0 additions & 129 deletions newrelic/api/cat_header_mixin.py

This file was deleted.

7 changes: 3 additions & 4 deletions newrelic/api/external_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

import functools

from newrelic.api.cat_header_mixin import CatHeaderMixin
from newrelic.api.header_mixin import HeaderMixin
from newrelic.api.time_trace import TimeTrace, current_trace
from newrelic.common.async_wrapper import async_wrapper as get_async_wrapper
from newrelic.common.object_wrapper import FunctionWrapper, wrap_object
from newrelic.core.external_node import ExternalNode


class ExternalTrace(CatHeaderMixin, TimeTrace):
class ExternalTrace(HeaderMixin, TimeTrace):
def __init__(self, library, url, method=None, **kwargs):
parent = kwargs.pop("parent", None)
source = kwargs.pop("source", None)
Expand All @@ -38,9 +38,8 @@ def __init__(self, library, url, method=None, **kwargs):
def __repr__(self):
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'library': self.library, 'url': self.url, 'method': self.method} }>"

def process_response(self, status_code, headers):
def process_response(self, status_code, headers=None):
self._add_agent_attribute("http.statusCode", status_code)
self.process_response_headers(headers)

def terminal_node(self):
return True
Expand Down
51 changes: 51 additions & 0 deletions newrelic/api/header_mixin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2010 New Relic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# HeaderMixin assumes the mixin class also inherits from TimeTrace
class HeaderMixin:
synthetics_key = "X-NewRelic-Synthetics"
synthetics_info_key = "X-NewRelic-Synthetics-Info"
settings = None

def __enter__(self):
result = super().__enter__()
if result is self and self.transaction:
self.settings = self.transaction.settings or None
return result

@classmethod
def generate_request_headers(cls, transaction):
"""
Return a list of NewRelic specific headers as tuples
[(HEADER_NAME0, HEADER_VALUE0), (HEADER_NAME1, HEADER_VALUE1)]

"""

if transaction is None or transaction.settings is None:
return []

settings = transaction.settings

nr_headers = []

if settings.distributed_tracing.enabled:
transaction.insert_distributed_trace_headers(nr_headers)

if transaction.synthetics_header:
nr_headers.append((cls.synthetics_key, transaction.synthetics_header))
if transaction.synthetics_info_header:
nr_headers.append((cls.synthetics_info_key, transaction.synthetics_info_header))

return nr_headers
11 changes: 4 additions & 7 deletions newrelic/api/message_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@

import functools

from newrelic.api.cat_header_mixin import CatHeaderMixin
from newrelic.api.header_mixin import HeaderMixin
from newrelic.api.time_trace import TimeTrace, current_trace
from newrelic.common.async_wrapper import async_wrapper as get_async_wrapper
from newrelic.common.object_wrapper import FunctionWrapper, wrap_object
from newrelic.core.message_node import MessageNode


class MessageTrace(CatHeaderMixin, TimeTrace):
cat_id_key = "NewRelicID"
cat_transaction_key = "NewRelicTransaction"
cat_appdata_key = "NewRelicAppData"
cat_synthetics_key = "NewRelicSynthetics"
cat_synthetics_info_key = "NewRelicSyntheticsInfo"
class MessageTrace(HeaderMixin, TimeTrace):
synthetics_key = "NewRelicSynthetics"
synthetics_info_key = "NewRelicSyntheticsInfo"

def __init__(self, library, operation, destination_type, destination_name, params=None, terminal=True, **kwargs):
parent = kwargs.pop("parent", None)
Expand Down
5 changes: 0 additions & 5 deletions newrelic/api/message_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from newrelic.api.application import Application, application_instance
from newrelic.api.background_task import BackgroundTask
from newrelic.api.message_trace import MessageTrace
from newrelic.api.transaction import current_transaction
from newrelic.common.async_proxy import TransactionContext, async_proxy
from newrelic.common.object_wrapper import FunctionWrapper, wrap_object
Expand Down Expand Up @@ -47,10 +46,6 @@ def __init__(
if headers is not None and self.settings is not None:
if self.settings.distributed_tracing.enabled:
self.accept_distributed_trace_headers(headers, transport_type=transport_type)
elif self.settings.cross_application_tracer.enabled:
self._process_incoming_cat_headers(
headers.pop(MessageTrace.cat_id_key, None), headers.pop(MessageTrace.cat_transaction_key, None)
)

self.routing_key = routing_key
self.exchange_type = exchange_type
Expand Down
Loading
Loading