Skip to content

Commit 66348e1

Browse files
authored
Merge pull request #1512 from newrelic/develop-11.0.0
Merge develop-11.0.0 into main
2 parents 4de44ee + 6d0950a commit 66348e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+491
-1813
lines changed

.github/.trivyignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Ignored Vulnerabilities
33
# =======================
44

5-
# Accepting risk due to Python 3.7 and 3.8 support.
5+
# Accepting risk due to Python 3.8 support.
66
CVE-2025-50181
77

88
# Not relevant, only affects Pyodide

.github/containers/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
111111
pyenv update
112112

113113
# Install Python
114-
ARG PYTHON_VERSIONS="3.12 3.11 3.10 3.9 3.8 3.7 3.13 pypy3.10-7.3.17"
114+
ARG PYTHON_VERSIONS="3.13 3.12 3.11 3.10 3.9 3.8 pypy3.10-7.3.17"
115115
COPY --chown=0:0 --chmod=755 ./install-python.sh /tmp/install-python.sh
116116
RUN /tmp/install-python.sh && \
117117
rm /tmp/install-python.sh

.github/workflows/deploy.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,6 @@ permissions:
2323
contents: read
2424

2525
jobs:
26-
build-linux-py3-legacy:
27-
runs-on: ubuntu-24.04
28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
wheel:
32-
- cp37-manylinux
33-
- cp37-musllinux
34-
35-
steps:
36-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
37-
with:
38-
persist-credentials: false
39-
fetch-depth: 0
40-
41-
- name: Setup QEMU
42-
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # 3.6.0
43-
44-
- name: Build Wheels
45-
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # 2.17.0
46-
env:
47-
CIBW_PLATFORM: linux
48-
CIBW_BUILD: "${{ matrix.wheel }}*"
49-
CIBW_ARCHS_LINUX: x86_64 aarch64
50-
CIBW_ENVIRONMENT: "LD_LIBRARY_PATH=/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib"
51-
CIBW_TEST_REQUIRES: pytest
52-
CIBW_TEST_COMMAND: "PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx"
53-
54-
- name: Upload Artifacts
55-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
56-
with:
57-
name: ${{ github.job }}-${{ matrix.wheel }}
58-
path: ./wheelhouse/*.whl
59-
if-no-files-found: error
60-
retention-days: 1
61-
6226
build-linux-py3:
6327
runs-on: ubuntu-24.04
6428
strategy:
@@ -151,7 +115,6 @@ jobs:
151115
attestations: write
152116

153117
needs:
154-
- build-linux-py3-legacy
155118
- build-linux-py3
156119
- build-sdist
157120

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ share/python-wheels/
3232
.installed.cfg
3333
*.egg
3434
MANIFEST
35+
_version.py
3536
version.txt
3637
version.py
3738
_version.py

THIRD_PARTY_NOTICES.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ Distributed under the following license(s):
3535
* [The Apache License, Version 2.0 License](https://opensource.org/license/apache-2-0/)
3636

3737

38-
## [time.monotonic](newrelic/common/_monotonic.c)
39-
40-
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Python Software Foundation; All Rights Reserved
41-
42-
Distributed under the following license(s):
43-
44-
* [Python Software Foundation](https://docs.python.org/3/license.html)
45-
46-
4738
## [urllib3](https://pypi.org/project/urllib3)
4839

4940
Copyright (c) 2008-2019 Andrey Petrov and contributors (see CONTRIBUTORS.txt)

newrelic/__init__.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from pathlib import Path
16-
17-
VERSION_FILE = Path(__file__).parent / "version.txt"
18-
1915
try:
20-
with VERSION_FILE.open() as f:
21-
version = f.read()
22-
except Exception:
23-
version = "0.0.0"
16+
from newrelic._version import __version__, __version_tuple__, version, version_tuple
17+
except ImportError: # pragma: no cover
18+
__version__ = version = "0.0.0" # pragma: no cover
19+
__version_tuple__ = version_tuple = (0, 0, 0) # pragma: no cover
2420

25-
version_info = list(map(int, version.split(".")))
21+
# Older compatibility attribute
22+
version_info = version_tuple

newrelic/agent.py

Lines changed: 40 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -15,62 +15,9 @@
1515
from newrelic.api.application import application_instance as __application
1616
from newrelic.api.application import application_settings as __application_settings
1717
from newrelic.api.application import register_application as __register_application
18-
from newrelic.api.log import NewRelicContextFormatter as __NewRelicContextFormatter
19-
from newrelic.api.time_trace import add_custom_span_attribute as __add_custom_span_attribute
20-
from newrelic.api.time_trace import current_trace as __current_trace
21-
from newrelic.api.time_trace import get_linking_metadata as __get_linking_metadata
22-
from newrelic.api.time_trace import notice_error as __notice_error
23-
from newrelic.api.time_trace import record_exception as __record_exception
24-
from newrelic.api.transaction import accept_distributed_trace_headers as __accept_distributed_trace_headers
25-
from newrelic.api.transaction import accept_distributed_trace_payload as __accept_distributed_trace_payload
26-
from newrelic.api.transaction import add_custom_attribute as __add_custom_attribute
27-
from newrelic.api.transaction import add_custom_attributes as __add_custom_attributes
28-
from newrelic.api.transaction import add_custom_parameter as __add_custom_parameter
29-
from newrelic.api.transaction import add_custom_parameters as __add_custom_parameters
30-
from newrelic.api.transaction import add_framework_info as __add_framework_info
31-
from newrelic.api.transaction import capture_request_params as __capture_request_params
32-
from newrelic.api.transaction import create_distributed_trace_payload as __create_distributed_trace_payload
33-
from newrelic.api.transaction import current_span_id as __current_span_id
34-
from newrelic.api.transaction import current_trace_id as __current_trace_id
35-
from newrelic.api.transaction import current_transaction as __current_transaction
36-
from newrelic.api.transaction import disable_browser_autorum as __disable_browser_autorum
37-
from newrelic.api.transaction import end_of_transaction as __end_of_transaction
38-
from newrelic.api.transaction import get_browser_timing_footer as __get_browser_timing_footer
39-
from newrelic.api.transaction import get_browser_timing_header as __get_browser_timing_header
40-
from newrelic.api.transaction import ignore_transaction as __ignore_transaction
41-
from newrelic.api.transaction import insert_distributed_trace_headers as __insert_distributed_trace_headers
42-
from newrelic.api.transaction import record_custom_event as __record_custom_event
43-
from newrelic.api.transaction import record_custom_metric as __record_custom_metric
44-
from newrelic.api.transaction import record_custom_metrics as __record_custom_metrics
45-
from newrelic.api.transaction import record_log_event as __record_log_event
46-
from newrelic.api.transaction import record_ml_event as __record_ml_event
47-
from newrelic.api.transaction import set_background_task as __set_background_task
48-
from newrelic.api.transaction import set_transaction_name as __set_transaction_name
49-
from newrelic.api.transaction import suppress_apdex_metric as __suppress_apdex_metric
50-
from newrelic.api.transaction import suppress_transaction_trace as __suppress_transaction_trace
51-
from newrelic.api.wsgi_application import WSGIApplicationWrapper as __WSGIApplicationWrapper
52-
from newrelic.api.wsgi_application import wrap_wsgi_application as __wrap_wsgi_application
53-
from newrelic.api.wsgi_application import wsgi_application as __wsgi_application
54-
from newrelic.config import extra_settings as __extra_settings
55-
from newrelic.config import initialize as __initialize
56-
from newrelic.core.agent import register_data_source as __register_data_source
57-
from newrelic.core.agent import shutdown_agent as __shutdown_agent
58-
from newrelic.core.config import global_settings as __global_settings
59-
from newrelic.samplers.decorators import data_source_factory as __data_source_factory
60-
from newrelic.samplers.decorators import data_source_generator as __data_source_generator
61-
62-
try:
63-
from newrelic.api.asgi_application import ASGIApplicationWrapper as __ASGIApplicationWrapper
64-
from newrelic.api.asgi_application import asgi_application as __asgi_application
65-
from newrelic.api.asgi_application import wrap_asgi_application as __wrap_asgi_application
66-
except SyntaxError:
67-
68-
def __asgi_application(*args, **kwargs):
69-
pass
70-
71-
__ASGIApplicationWrapper = __asgi_application
72-
__wrap_asgi_application = __asgi_application
73-
18+
from newrelic.api.asgi_application import ASGIApplicationWrapper as __ASGIApplicationWrapper
19+
from newrelic.api.asgi_application import asgi_application as __asgi_application
20+
from newrelic.api.asgi_application import wrap_asgi_application as __wrap_asgi_application
7421
from newrelic.api.background_task import BackgroundTask as __BackgroundTask
7522
from newrelic.api.background_task import BackgroundTaskWrapper as __BackgroundTaskWrapper
7623
from newrelic.api.background_task import background_task as __background_task
@@ -101,9 +48,8 @@ def __asgi_application(*args, **kwargs):
10148
from newrelic.api.generator_trace import wrap_generator_trace as __wrap_generator_trace
10249
from newrelic.api.html_insertion import insert_html_snippet as __insert_html_snippet
10350
from newrelic.api.html_insertion import verify_body_exists as __verify_body_exists
104-
from newrelic.api.lambda_handler import LambdaHandlerWrapper as __LambdaHandlerWrapper
105-
from newrelic.api.lambda_handler import lambda_handler as __lambda_handler
10651
from newrelic.api.llm_custom_attributes import WithLlmCustomAttributes as __WithLlmCustomAttributes
52+
from newrelic.api.log import NewRelicContextFormatter as __NewRelicContextFormatter
10753
from newrelic.api.message_trace import MessageTrace as __MessageTrace
10854
from newrelic.api.message_trace import MessageTraceWrapper as __MessageTraceWrapper
10955
from newrelic.api.message_trace import message_trace as __message_trace
@@ -120,20 +66,48 @@ def __asgi_application(*args, **kwargs):
12066
from newrelic.api.profile_trace import wrap_profile_trace as __wrap_profile_trace
12167
from newrelic.api.settings import set_error_group_callback as __set_error_group_callback
12268
from newrelic.api.supportability import wrap_api_call as __wrap_api_call
69+
from newrelic.api.time_trace import add_custom_span_attribute as __add_custom_span_attribute
70+
from newrelic.api.time_trace import current_trace as __current_trace
71+
from newrelic.api.time_trace import get_linking_metadata as __get_linking_metadata
72+
from newrelic.api.time_trace import notice_error as __notice_error
73+
from newrelic.api.transaction import accept_distributed_trace_headers as __accept_distributed_trace_headers
74+
from newrelic.api.transaction import add_custom_attribute as __add_custom_attribute
75+
from newrelic.api.transaction import add_custom_attributes as __add_custom_attributes
76+
from newrelic.api.transaction import add_framework_info as __add_framework_info
77+
from newrelic.api.transaction import capture_request_params as __capture_request_params
78+
from newrelic.api.transaction import current_span_id as __current_span_id
79+
from newrelic.api.transaction import current_trace_id as __current_trace_id
80+
from newrelic.api.transaction import current_transaction as __current_transaction
81+
from newrelic.api.transaction import disable_browser_autorum as __disable_browser_autorum
82+
from newrelic.api.transaction import end_of_transaction as __end_of_transaction
83+
from newrelic.api.transaction import get_browser_timing_header as __get_browser_timing_header
84+
from newrelic.api.transaction import ignore_transaction as __ignore_transaction
85+
from newrelic.api.transaction import insert_distributed_trace_headers as __insert_distributed_trace_headers
86+
from newrelic.api.transaction import record_custom_event as __record_custom_event
87+
from newrelic.api.transaction import record_custom_metric as __record_custom_metric
88+
from newrelic.api.transaction import record_custom_metrics as __record_custom_metrics
89+
from newrelic.api.transaction import record_log_event as __record_log_event
90+
from newrelic.api.transaction import record_ml_event as __record_ml_event
91+
from newrelic.api.transaction import set_background_task as __set_background_task
92+
from newrelic.api.transaction import set_transaction_name as __set_transaction_name
12393
from newrelic.api.transaction import set_user_id as __set_user_id
94+
from newrelic.api.transaction import suppress_apdex_metric as __suppress_apdex_metric
95+
from newrelic.api.transaction import suppress_transaction_trace as __suppress_transaction_trace
12496
from newrelic.api.transaction_name import TransactionNameWrapper as __TransactionNameWrapper
12597
from newrelic.api.transaction_name import transaction_name as __transaction_name
12698
from newrelic.api.transaction_name import wrap_transaction_name as __wrap_transaction_name
12799
from newrelic.api.web_transaction import WebTransaction as __WebTransaction
128100
from newrelic.api.web_transaction import WebTransactionWrapper as __WebTransactionWrapper
129101
from newrelic.api.web_transaction import web_transaction as __web_transaction
130102
from newrelic.api.web_transaction import wrap_web_transaction as __wrap_web_transaction
103+
from newrelic.api.wsgi_application import WSGIApplicationWrapper as __WSGIApplicationWrapper
104+
from newrelic.api.wsgi_application import wrap_wsgi_application as __wrap_wsgi_application
105+
from newrelic.api.wsgi_application import wsgi_application as __wsgi_application
131106
from newrelic.common.object_names import callable_name as __callable_name
132107
from newrelic.common.object_wrapper import CallableObjectProxy as __CallableObjectProxy
133108
from newrelic.common.object_wrapper import FunctionWrapper as __FunctionWrapper
134109
from newrelic.common.object_wrapper import InFunctionWrapper as __InFunctionWrapper
135110
from newrelic.common.object_wrapper import ObjectProxy as __ObjectProxy
136-
from newrelic.common.object_wrapper import ObjectWrapper as __ObjectWrapper
137111
from newrelic.common.object_wrapper import OutFunctionWrapper as __OutFunctionWrapper
138112
from newrelic.common.object_wrapper import PostFunctionWrapper as __PostFunctionWrapper
139113
from newrelic.common.object_wrapper import PreFunctionWrapper as __PreFunctionWrapper
@@ -152,6 +126,13 @@ def __asgi_application(*args, **kwargs):
152126
from newrelic.common.object_wrapper import wrap_out_function as __wrap_out_function
153127
from newrelic.common.object_wrapper import wrap_post_function as __wrap_post_function
154128
from newrelic.common.object_wrapper import wrap_pre_function as __wrap_pre_function
129+
from newrelic.config import extra_settings as __extra_settings
130+
from newrelic.config import initialize as __initialize
131+
from newrelic.core.agent import register_data_source as __register_data_source
132+
from newrelic.core.agent import shutdown_agent as __shutdown_agent
133+
from newrelic.core.config import global_settings as __global_settings
134+
from newrelic.samplers.decorators import data_source_factory as __data_source_factory
135+
from newrelic.samplers.decorators import data_source_generator as __data_source_generator
155136

156137
# EXPERIMENTAL - Generator traces are currently experimental and may not
157138
# exist in this form in future versions of the agent.
@@ -178,15 +159,11 @@ def __asgi_application(*args, **kwargs):
178159
ignore_transaction = __wrap_api_call(__ignore_transaction, "ignore_transaction")
179160
suppress_apdex_metric = __wrap_api_call(__suppress_apdex_metric, "suppress_apdex_metric")
180161
capture_request_params = __wrap_api_call(__capture_request_params, "capture_request_params")
181-
add_custom_parameter = __wrap_api_call(__add_custom_parameter, "add_custom_parameter")
182-
add_custom_parameters = __wrap_api_call(__add_custom_parameters, "add_custom_parameters")
183162
add_custom_attribute = __wrap_api_call(__add_custom_attribute, "add_custom_attribute")
184163
add_custom_attributes = __wrap_api_call(__add_custom_attributes, "add_custom_attributes")
185164
add_framework_info = __wrap_api_call(__add_framework_info, "add_framework_info")
186-
record_exception = __wrap_api_call(__record_exception, "record_exception")
187165
notice_error = __wrap_api_call(__notice_error, "notice_error")
188166
get_browser_timing_header = __wrap_api_call(__get_browser_timing_header, "get_browser_timing_header")
189-
get_browser_timing_footer = __wrap_api_call(__get_browser_timing_footer, "get_browser_timing_footer")
190167
disable_browser_autorum = __wrap_api_call(__disable_browser_autorum, "disable_browser_autorum")
191168
suppress_transaction_trace = __wrap_api_call(__suppress_transaction_trace, "suppress_transaction_trace")
192169
record_custom_metric = __wrap_api_call(__record_custom_metric, "record_custom_metric")
@@ -195,12 +172,6 @@ def __asgi_application(*args, **kwargs):
195172
record_log_event = __wrap_api_call(__record_log_event, "record_log_event")
196173
record_ml_event = __wrap_api_call(__record_ml_event, "record_ml_event")
197174
WithLlmCustomAttributes = __wrap_api_call(__WithLlmCustomAttributes, "WithLlmCustomAttributes")
198-
accept_distributed_trace_payload = __wrap_api_call(
199-
__accept_distributed_trace_payload, "accept_distributed_trace_payload"
200-
)
201-
create_distributed_trace_payload = __wrap_api_call(
202-
__create_distributed_trace_payload, "create_distributed_trace_payload"
203-
)
204175
accept_distributed_trace_headers = __wrap_api_call(
205176
__accept_distributed_trace_headers, "accept_distributed_trace_headers"
206177
)
@@ -223,8 +194,6 @@ def __asgi_application(*args, **kwargs):
223194
BackgroundTask = __wrap_api_call(__BackgroundTask, "BackgroundTask")
224195
BackgroundTaskWrapper = __wrap_api_call(__BackgroundTaskWrapper, "BackgroundTaskWrapper")
225196
wrap_background_task = __wrap_api_call(__wrap_background_task, "wrap_background_task")
226-
LambdaHandlerWrapper = __wrap_api_call(__LambdaHandlerWrapper, "LambdaHandlerWrapper")
227-
lambda_handler = __wrap_api_call(__lambda_handler, "lambda_handler")
228197
NewRelicContextFormatter = __wrap_api_call(__NewRelicContextFormatter, "NewRelicContextFormatter")
229198
transaction_name = __wrap_api_call(__transaction_name, "transaction_name")
230199
TransactionNameWrapper = __wrap_api_call(__TransactionNameWrapper, "TransactionNameWrapper")
@@ -275,7 +244,6 @@ def __asgi_application(*args, **kwargs):
275244
function_wrapper = __wrap_api_call(__function_wrapper, "function_wrapper")
276245
wrap_function_wrapper = __wrap_api_call(__wrap_function_wrapper, "wrap_function_wrapper")
277246
patch_function_wrapper = __wrap_api_call(__patch_function_wrapper, "patch_function_wrapper")
278-
ObjectWrapper = __wrap_api_call(__ObjectWrapper, "ObjectWrapper")
279247
pre_function = __wrap_api_call(__pre_function, "pre_function")
280248
PreFunctionWrapper = __wrap_api_call(__PreFunctionWrapper, "PreFunctionWrapper")
281249
wrap_pre_function = __wrap_api_call(__wrap_pre_function, "wrap_pre_function")

newrelic/api/application.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import threading
16-
import warnings
1716

1817
import newrelic.api.import_hook
1918
import newrelic.core.agent
@@ -110,16 +109,6 @@ def linked_applications(self):
110109
def link_to_application(self, name):
111110
self._linked[name] = True
112111

113-
def record_exception(self, exc=None, value=None, tb=None, params=None, ignore_errors=None):
114-
# Deprecation Warning
115-
warnings.warn(
116-
("The record_exception function is deprecated. Please use the new api named notice_error instead."),
117-
DeprecationWarning,
118-
stacklevel=2,
119-
)
120-
121-
self.notice_error(error=(exc, value, tb), attributes=params, ignore=ignore_errors)
122-
123112
def notice_error(self, error=None, attributes=None, expected=None, ignore=None, status_code=None):
124113
if not self.active:
125114
return

0 commit comments

Comments
 (0)