Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
148 changes: 123 additions & 25 deletions .github/workflows/deploy-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,125 @@ on:
- published

jobs:
deploy-linux:
build-linux-py3:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
wheel:
- cp37-manylinux
- cp37-musllinux
- cp38-manylinux
- cp38-musllinux
- cp39-manylinux
- cp39-musllinux
- cp310-manylinux
- cp310-musllinux
- cp311-manylinux
- cp311-musllinux
- cp312-manylinux
- cp312-musllinux

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Setup QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

- name: Build Wheels
uses: pypa/[email protected]
env:
CIBW_PLATFORM: linux
CIBW_BUILD: "${{ matrix.wheel }}*"
CIBW_ARCHS_LINUX: x86_64 aarch64
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"
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx"

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ github.job }}-${{ matrix.wheel }}
path: ./wheelhouse/*.whl
retention-days: 1

build-linux-py2:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Setup QEMU
uses: docker/setup-qemu-action@v3

- name: Build Wheels
uses: pypa/[email protected]
env:
CIBW_PLATFORM: linux
CIBW_BUILD: cp27-manylinux_x86_64
CIBW_ARCHS_LINUX: x86_64
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"
CIBW_TEST_REQUIRES: pytest==4.6.11
CIBW_TEST_COMMAND: "PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx"

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ github.job }}
path: ./wheelhouse/*.whl
retention-days: 1

build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Install Dependencies
run: |
pip install -U pip
pip install -U setuptools

- name: Build Source Package
run: |
python setup.py sdist

- name: Prepare MD5 Hash File
run: |
tarball="$(python setup.py --fullname).tar.gz"
md5_file=${tarball}.md5
openssl md5 -binary dist/${tarball} | xxd -p | tr -d '\n' > dist/${md5_file}

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ github.job }}-sdist
path: |
./dist/*.tar.gz
./dist/*.tar.gz.md5
retention-days: 1

deploy:
runs-on: ubuntu-latest

needs:
- build-linux-py3
- build-linux-py2
- build-sdist

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- uses: actions/setup-python@v2
with:
Expand All @@ -42,32 +150,22 @@ jobs:
pip install -U pip
pip install -U wheel setuptools twine

- name: Build Source Package
run: python setup.py sdist

- name: Build Manylinux Wheels (Python 2)
uses: pypa/[email protected]
env:
CIBW_PLATFORM: linux
CIBW_BUILD: cp27-manylinux_x86_64
CIBW_ARCHS: x86_64
CIBW_ENVIRONMENT: "LD_LIBRARY_PATH=/opt/rh/=vtoolset-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"
- name: Download Artifacts
uses: actions/[email protected]
with:
path: ./artifacts/

- name: Build Manylinux Wheels (Python 3)
uses: pypa/[email protected]
env:
CIBW_PLATFORM: linux
CIBW_BUILD: cp37-manylinux* cp38-manylinux* cp39-manylinux* cp310-manylinux* cp311-manylinux*
CIBW_ARCHS: x86_64 aarch64
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"
- name: Unpack Artifacts
run: |
mkdir -p dist/
mv artifacts/**/*{.whl,.tar.gz,.tar.gz.md5} dist/

- name: Upload Package to S3
run: |
tarball="$(python setup.py --fullname).tar.gz"
md5_file=$(mktemp)
openssl md5 -binary dist/$tarball | xxd -p | tr -d '\n' > $md5_file
aws s3 cp $md5_file $S3_DST/${tarball}.md5
aws s3 cp dist/$tarball $S3_DST/$tarball
md5_file=${tarball}.md5
aws s3 cp dist/${md5_file} $S3_DST/${md5_file}
aws s3 cp dist/${tarball} $S3_DST/${tarball}
env:
S3_DST: s3://nr-downloads-main/python_agent/release
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -76,7 +174,7 @@ jobs:

- name: Upload Package to PyPI
run: |
twine upload --non-interactive dist/*.tar.gz wheelhouse/*-manylinux*.whl
twine upload --non-interactive dist/*.tar.gz dist/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
11 changes: 0 additions & 11 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,3 @@ entering the directory of the tests you want to run. Then, run the
following command:

``tox -c tox.ini -e [test environment]``

*******
Slack
*******

We host a public Slack with a dedicated channel for contributors and
maintainers of open source projects hosted by New Relic. If you are
contributing to this project, you're welcome to request access to the
#oss-contributors channel in the newrelicusers.slack.com workspace. To
request access, please use this `link
<https://join.slack.com/t/newrelicusers/shared_invite/zt-1ayj69rzm-~go~Eo1whIQGYnu3qi15ng/>`__.
5 changes: 4 additions & 1 deletion newrelic/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from newrelic.api.application import application_instance as __application
from newrelic.api.application import application_settings as __application_settings
from newrelic.api.application import register_application as __register_application
from newrelic.api.log import NewRelicContextFormatter # noqa
from newrelic.api.log import NewRelicContextFormatter as __NewRelicContextFormatter
from newrelic.api.time_trace import (
add_custom_span_attribute as __add_custom_span_attribute,
)
Expand Down Expand Up @@ -177,6 +177,7 @@ def __asgi_application(*args, **kwargs):
from newrelic.common.object_wrapper import FunctionWrapper as __FunctionWrapper
from newrelic.common.object_wrapper import InFunctionWrapper as __InFunctionWrapper
from newrelic.common.object_wrapper import ObjectProxy as __ObjectProxy
from newrelic.common.object_wrapper import CallableObjectProxy as __CallableObjectProxy
from newrelic.common.object_wrapper import ObjectWrapper as __ObjectWrapper
from newrelic.common.object_wrapper import OutFunctionWrapper as __OutFunctionWrapper
from newrelic.common.object_wrapper import PostFunctionWrapper as __PostFunctionWrapper
Expand Down Expand Up @@ -276,6 +277,7 @@ def __asgi_application(*args, **kwargs):
wrap_background_task = __wrap_api_call(__wrap_background_task, "wrap_background_task")
LambdaHandlerWrapper = __wrap_api_call(__LambdaHandlerWrapper, "LambdaHandlerWrapper")
lambda_handler = __wrap_api_call(__lambda_handler, "lambda_handler")
NewRelicContextFormatter = __wrap_api_call(__NewRelicContextFormatter, "NewRelicContextFormatter")
transaction_name = __wrap_api_call(__transaction_name, "transaction_name")
TransactionNameWrapper = __wrap_api_call(__TransactionNameWrapper, "TransactionNameWrapper")
wrap_transaction_name = __wrap_api_call(__wrap_transaction_name, "wrap_transaction_name")
Expand Down Expand Up @@ -316,6 +318,7 @@ def __asgi_application(*args, **kwargs):
wrap_message_transaction = __wrap_api_call(__wrap_message_transaction, "wrap_message_transaction")
callable_name = __wrap_api_call(__callable_name, "callable_name")
ObjectProxy = __wrap_api_call(__ObjectProxy, "ObjectProxy")
CallableObjectProxy = __wrap_api_call(__CallableObjectProxy, "CallableObjectProxy")
wrap_object = __wrap_api_call(__wrap_object, "wrap_object")
wrap_object_attribute = __wrap_api_call(__wrap_object_attribute, "wrap_object_attribute")
resolve_path = __wrap_api_call(__resolve_path, "resolve_path")
Expand Down
13 changes: 3 additions & 10 deletions newrelic/api/asgi_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,9 @@ async def send_inject_browser_agent(self, message):

# if there's a valid body string, attempt to insert the HTML
if verify_body_exists(self.body):
header = self.transaction.browser_timing_header()
if not header:
# If there's no header, abort browser monitoring injection
await self.send_buffered()
return

footer = self.transaction.browser_timing_footer()
browser_agent_data = six.b(header) + six.b(footer)

body = insert_html_snippet(self.body, lambda: browser_agent_data, self.search_maximum)
body = insert_html_snippet(
self.body, lambda: six.b(self.transaction.browser_timing_header()), self.search_maximum
)

# If we have inserted the browser agent
if len(body) != len(self.body):
Expand Down
3 changes: 2 additions & 1 deletion newrelic/api/solr_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import newrelic.api.object_wrapper
import newrelic.api.time_trace
import newrelic.common.object_wrapper
import newrelic.core.solr_node


Expand Down Expand Up @@ -111,4 +112,4 @@ def decorator(wrapped):


def wrap_solr_trace(module, object_path, library, command):
newrelic.api.object_wrapper.wrap_object(module, object_path, SolrTraceWrapper, (library, command))
newrelic.common.object_wrapper.wrap_object(module, object_path, SolrTraceWrapper, (library, command))
7 changes: 4 additions & 3 deletions newrelic/api/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,9 +1957,10 @@ def get_browser_timing_header(nonce=None):


def get_browser_timing_footer(nonce=None):
transaction = current_transaction()
if transaction and hasattr(transaction, "browser_timing_footer"):
return transaction.browser_timing_footer(nonce)
warnings.warn(
"The get_browser_timing_footer function is deprecated. Please migrate to only using the get_browser_timing_header API instead.",
DeprecationWarning,
)
return ""


Expand Down
Loading