Python release notes

Python agent release notes

Thursday, June 18, 2020 - 10:30 Download

Notes

This release of the Python agent includes a bug fix.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug fixes

  • When using newrelic-admin run-program on Python 2.7 applications failed to start

    Using the newrelic-admin run-program on Python 2.7 with the 5.14.0 agent resulted in an application crash. Applications now start as expected on Python 2.7.

Tuesday, June 2, 2020 - 08:30 Download

Notes

This release of the Python agent includes improvements to distributed tracing, and bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

New Features

  • Add new span attribute transaction.name

    A new attribute, transaction.name, has been added to the root span.

Improved features

  • Transaction attributes are added to the root span

    Transaction attributes, including response attributes, are now added to the root span.

  • Custom attributes are added to the root span

    The public API methods newrelic.agent.add_custom_param and newrelic.agent.add_custom_params now add the specified custom attribute to the root span in addition to the transaction. If the maximum number of custom attributes is reached, span-level custom attributes take precedence over transaction-level custom attributes.

  • Error attributes added to each span/segment

    Error attributes error.class and error.message to all spans that exit without handling an exception.

Bug fixes

  • asyncio: application crash when a transaction that started on a completed parent task exits

    When a transaction that started on a completed parent task exited, an exception was raised. This error has been fixed.

  • Error attributes are no longer added if the error collector is disabled

    If the error collector is disabled via error_collector.enabled, error attributes error.class and error.message are not added to the currently executing span.

Security Updates

Note that changes were made that add attributes to the root span. Transaction-level attribute filtering via the transaction.attribute.exclude configuration setting will not filter the attribute(s) for the root span. Those attributes may unexpectedly start to appear on the root span.

Monday, May 4, 2020 - 15:00 Download

Notes

This release of the Python agent includes bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug fixes

  • AIOHTTP http client urls displayed as unknown.url when using YARL URLs

    When passing a YARL url object to the aiohttp client, the agent did not properly parse this URL, resulting in unknown.url being displayed in the UI. The URL is now parsed correctly in both the YARL url case and the string url case.

  • Data may not be recorded when tornado's RequestHandler.finish

    Using RequestHandler.finish in tornado caused the transaction to exit before all traces (inserted by automatic instrumentation) were complete, resulting in missing data. All traces now exit when RequestHandler.finish is called.

  • asyncio.ensure_future / asyncio.create_task is unable to spawn new transactions

    Calling asyncio.create_task / asyncio.ensure_future was unable to spawn a new transaction if these methods were called from within an existing transaction. New transactions can now be created when ensure_future/create_task is called from within an existing transaction and no traces have been started on the spawned task.

  • py3: A runtime instrumentation error may have occurred when transactions were finalized

    When transactions became garbage (if the reference to the transaction was lost as part of a circular reference for example), a runtime instrumentation error may have been logged. The error conditions have been relaxed to allow for certain states within the agent when a transaction becomes garbage.

  • Application crash when starting a transaction when one is already active

    Starting a transaction via the context manager APIs when a transaction is already active no longer causes an application crash. An error is logged when this case is detected.

  • Creating a message transaction with distributed tracing enabled may have resulted in a crash

    The agent crashed with an AttributeError when using message transactions with distributed tracing enabled when headers were not provided. This error has been fixed.

Monday, April 13, 2020 - 15:00 Download

Notes

This release of the Python agent includes support for a new product called Infinite Tracing, and it also has some bug fixes

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

New Feature

This release adds support for Infinite Tracing. Infinite Tracing observes 100% of your distributed traces and provides visualizations for the most actionable data. With Infinite Tracing, you get examples of errors and long-running traces so you can better diagnose and troubleshoot your systems.

Configure your agent to send traces to a trace observer in New Relic Edge. View distributed traces through New Relic’s UI. There is no need to install a collector on your network.

Infinite Tracing is currently available on a sign-up basis. If you would like to participate, please contact your sales representative.

Bug fixes

  • Fix record transaction failure in async applications

    When the agent attempted to record information as part of event loop diagnostics, an AttributeError may have occurred during the record transaction phase causing data to not be recorded for that transaction. This issue has now been fixed.

Monday, March 9, 2020 - 11:30 Download

Notes

This release of the Python agent includes an update to the API for recording exceptions, default request attributes, optional function trace attributes, and bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Improved features

  • newrelic.agent.record_exception now adds attributes to spans

    The public API method newrelic.agent.record_exception now attaches exception details to the currently executing span. Spans with error details are now highlighted red in the distributed tracing UI. Also, the attributes error.class and error.message are added to the span. If multiple errors are recorded for a single span, only the final error's attributes will be added to the span.

  • Note: Exceptions recorded on spans may be double counted in the distributed tracing UI.

  • New default web request attributes.

    The previously optional attributes request.headers.accept, request.headers.host, and request.headers.userAgent are now included by default on all web transactions. These attributes can be excluded through agent configuration.

  • peer.address and peer.hostname can now be excluded from spans through configuration

    peer.address and peer.hostname may be excluded from span events through attribute.exclude options in the agent configuration.

Bug fixes

  • Fix issue which could potentially lead to missing event data

    When the agent was shutting down, event harvest may have been skipped causing any events captured in the final 5 seconds of application execution to be discarded. This has now been fixed.

  • Runtime instrumentation error messages for calling __exit__ before __enter__ were erroneously logged

    Under certain conditions, the agent may have logged an error message for trace __exit__ being called before __enter__. This error message is now printed only if that condition is true.

Known issues and workarounds

  • If a .NET agent is initiating distributed traces as the root service, you must update that .NET agent to version 8.24 or later before upgrading your downstream New Relic Python agents to this agent release.
Monday, February 24, 2020 - 15:30 Download

Notes

This release of the Python agent includes a new API for adding custom attributes on span events, improvements to external type spans, deprecations, and bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

New features

  • Add new api newrelic.agent.add_custom_span_attribute

    There is now a public API method allowing users to add custom attributes directly to spans.

Improved features

  • External spans now contain HTTP response code

    External HTTP spans will now contain a new attribute http.statusCode with the http response code for each external call made. This attribute will be added when using any supported HTTP client.

Deprecations

  • LambdaHandlerWrapper and lambda_handler APIs are deprecated

    The Lambda API functionality has been moved to a separate package called newrelic-lambda. All future lambda implementations should use the new package for lambda monitoring.

Bug fixes

  • Fix application crash when using a non-WSGI framework with the Synthetics product

    When the Synthetics product was used with an application utilizing a non-WSGI web framework (such as aiohttp), a crash could have occurred if an outbound HTTP request was attempted from within the transaction. This crash has now been fixed.

  • The Python agent generates an invalid nr tracestate entry

    Under certain random conditions, the agent may have generated an invalid New Relic w3c tracestate entry, resulting in potentially missing parts of traces. This invalid tracestate entry would not impact propagation of tracestate values from other vendors.

Known issues and workarounds

  • If a .NET agent is initiating distributed traces as the root service, you must update that .NET agent to version 8.24 or later before upgrading your downstream New Relic Python agents to this agent release.
Monday, February 3, 2020 - 14:30 Download

Notes

This release of the Python agent includes an implementation for w3c trace context, support for uvloop, and various bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

New Features

  • New APIs for creating / accepting distributed trace headers

    This version of the agent deprecates newrelic.agent.create_distributed_trace_payload and newrelic.agent.accept_distributed_trace_payload in favor of newrelic.agent.insert_distributed_trace_headers and newrelic.agent.accept_distributed_trace_headers. See the Python agent API documentation for details.

  • Support for W3C Trace Context, with easy upgrade from New Relic Trace Context

    Distributed Tracing now supports W3C Trace Context headers for HTTP and gRPC protocols when distributed tracing is enabled. Our implementation can accept and emit both W3C trace header format and New Relic trace header format. This simplifies agent upgrades, allowing trace context to be propagated between services with older and newer releases of New Relic agents. W3C trace header format will always be accepted and emitted. New Relic trace header format will be accepted, and you can optionally disable emission of the New Relic trace header format.

    When distributed tracing is enabled with distributed_tracing.enabled = true, the Python agent will now accept W3C's traceparent and tracestate headers when calling accept_distributed_trace_headers. When calling insert_distributed_trace_headers, the Python agent will include the W3C headers along with the New Relic distributed tracing header, unless the New Relic trace header format is disabled using distributed_tracing.exclude_newrelic_header = true

    Also, see the "Known Issues and Workarounds" section of these Release notes.

Improved Features

  • Add support for uvloop

    Transaction context may not have been propagated when using uvloop. This could have resulted in incomplete traces or instrumentation failures when using uvloop. uvloop is now supported.

Bug Fixes

  • Fix crash when using aiohttp_cors

    Customers using the agent with aiohttp_cors may have experienced a crash when the aiohttp_cors framework was used in conjunction with aiohttp class based views. This crash has now been fixed.

  • Fix grpc v1.26 instrumentation errors

    Customers using grpc v1.26 and above may have experienced an error message in the New Relic logs indicating there was an instrumentation error. Additionally, some data may have been missing when this error was encountered. This issue has now been fixed.

Known Issues and Workarounds

  • If a .NET agent is initiating distributed traces as the root service, you must update that .NET agent to version 8.24 or later before upgrading your downstream New Relic Python agents to this agent release.
Thursday, December 19, 2019 - 13:30 Download

Notes

This release of the Python agent includes a bug fix for reporting inaccurate metric values.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug Fixes

  • Metrics may be reported with an incorrect throughput after communication failure with New Relic

    For agent versions 5.2.0 through 5.4.0, metric throughput may have been reported inaccurately after experiencing network / communication failures with New Relic. The throughput reported for all metrics after this failure may have been abnormally high.

Tuesday, November 26, 2019 - 11:00 Download

Notes

This release of the Python agent includes the logs in context feature and bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Features

  • Logs In Context

    The logs in context feature is now supported by the PythonaAgent. For more information, see the Python logs-in-context page.

Bug Fixes

  • The plugin list in the environment page may have been inaccurately reported

    When using absolute imports in Python 2, the agent may have reported relative imports that were attempted but unsuccessful. Python 3 is not impacted. Modules are now reported correctly in Python 2.

Wednesday, November 13, 2019 - 11:30 Download

Notes

This release of the Python agent includes support for Python 3.8 and restores the original record-deploy command interface.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Updates

  • Added Support for Python 3.8

    Python 3.8 support has been added in this release.

  • Restore newrelic-admin record-deploy command interface

    The newrelic-admin command was previously updated to require an application id via the command line. The requirement has been removed, restoring the original record-deploy CLI arguments.

Wednesday, November 6, 2019 - 10:30 Download

Notes

This release of the Python agent includes bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug Fixes

  • Fix thread utilization data on agent versions v5.x.x

    Thread utilization data was not reported for agents v5.x.x, resulting in missing data on the capacity analysis page. The agent will now report thread utilization data.

  • Fix untraced database calls when using pymysql context manager assignments

    When using context managers to create and assign a cursor in pymysql, database calls on that cursor object were not traced. Database calls in pymysql are now properly traced.

Wednesday, October 9, 2019 - 10:30 Download

Notes

This release of the Python agent includes bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug Fixes

  • Fix a crash when using future-based interfaces on Tornado's http client

    Tornado's http client returns a future when fetch is called. Prior to this release, the agent caused a coroutine object to be returned rather than a future, causing a potential crash when application code assumed a future would be returned. A future will now be returned from http client fetch as expected.

  • Fix a crash when running a coroutine created in another transaction

    When running a coroutine outside of the transaction that created it, the agent may have crashed if a separate transaction was active.

Tuesday, October 1, 2019 - 13:05 Download

Notes

This release of the Python agent includes a bug fix for tornado and support for recording deployment markers in the EU region as well as specifying a deploy timestamp.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Features

  • Support for Real Time Streaming

    • Event data is now sent to New Relic every five seconds, instead of every minute. As a result, transaction, error, and custom events will now be available in New Relic One and Insights dashboards in near real time. For more information on how to view your events with a five-second refresh, see the real time streaming documentation.

    • Note that the overall limits on how many events can be sent per minute have not changed. Also, span events, metrics, and trace data is unaffected, and will still be sent every minute.

  • Added timestamp and EU region support for recording deployment markers

    When using the newrelic-admin record-deploy script an optional timestamp can be provided to specify when the deployment marker should be created. Furthermore support for accounts in the EU region have been added in this release.

Bug Fixes

  • Fixed a crash in tornado versions >= 6.1

    Tornado 6.1 internals changed in a way that may have caused the agent's built-in instrumentation to fail. The instrumentation has been updated to alleviate this issue.

Monday, August 12, 2019 - 13:00 Download

Notes

This release of the Python agent includes bug fixes for feedparser and django-piston.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug Fixes

  • Fixed a crash when using feedparser

    When running with the feedparser library the agent would crash on attempting to parse an RSS feed. This issue has now been corrected.

  • Fixed a crash when using django-piston

    When running with the django-piston library the agent would crash on attempting to service a request. This issue has now been corrected.

Friday, August 9, 2019 - 10:00 Download

Notes

This release of the Python agent includes a bug fix for the mako library instrumentation.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug Fixes

  • Fixed a crash when using the Mako template library

    When running with the Mako template library the agent would crash on attempting to render a template. This issue has now been corrected.

Tuesday, August 6, 2019 - 10:00 Download

Notes

This release of the Python agent introduces:

  • Event loop diagnostics feature
  • Tornado instrumentation for versions 6 or higher
  • Improved context manager API functionality and interfaces

This release also drops support for Python 3.4.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Event loop diagnostics

Introducing event loop diagnostics for asyncio! The Python agent can now surface information about transactions that block the event loop. The agent will be able to generate information about transactions that have waited a significant amount of time to acquire control of the event loop.

Event loop diagnostic information will be available in both APM and via NRQL query.

Event loop metrics will appear in the transaction Breakdown table:

Image of breakdown UI page

Time spent waiting on other transactions will be shown in the transaction Trace details page, as shown here:

Image of breakdown UI page

eventLoopTime and eventLoopWait attributes will be available via NRQL query. An example query might be:
SELECT count(*) as 'count', average(eventLoopTime) as 'loopTime', average(eventLoopWait) as 'loopWait' FROM Transaction facet name

In New Relic Insights, this might show a result like this:

Image of breakdown UI page

Diagnostics will be available by default through our existing aiohttp, sanic, and Tornado instrumentation. Diagnostic information will also be available for coroutines that use our background_task and web_transaction decorator APIs.

Tornado 6 Instrumentation

Instrumentation for Tornado framework version 6.x is supported without any feature flags. Support for versions earlier than Tornado 6.x has been dropped. The Tornado web server, framework, and http client are instrumented and information will show up in both APM and insights.

Important: Using the tornado.gen.coroutine with instrumentation is not supported. Any usage of tornado.gen.coroutine should be replaced with an asyncio coroutine.

Before

class MainHandler(tornado.web.RequestHandler):
    @tornado.gen.coroutine
    def get(self):

        yield gen.sleep(0.2)

After

class MainHandler(tornado.web.RequestHandler):
    @asyncio.coroutine
    def get(self):

        yield from gen.sleep(0.2)

Improved APIs for time trace context managers

Context managers (such as FunctionTrace, ExternalTrace, DatastoreTrace) may now be used from within asyncio coroutines! Additionally, the transaction argument is no longer used for any context manager API. In order to transition to the new API, the transaction argument must be removed.

Before

transaction = newrelic.agent.current_transaction()
with newrelic.agent.FunctionTrace(transaction, "my_trace"):
  pass

After

with newrelic.agent.FunctionTrace("my_trace"):
  pass

Updated WebTransaction context manager

The WebTransaction context manager is no longer WSGI dependent. The context manager takes generic HTTP arguments, which you can use to build web transactions that appear in the APM product. For more information, see our API documentation.

Monday, June 24, 2019 - 09:00 Download

Notes

This release of the Python agent includes bug fixes, deprecations, and improved naming behavior for gRPC.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Feature Enhancements

  • Improved gRPC support

    The external and transaction pages now show the gRPC method being called in addition to the host and port.

  • Ability to disable sending db.statement as part of traces

    When db.statement is added to either attributes.exclude or transaction_segments.attributes.exclude, the value will now no longer be sent to New Relic as part of transaction traces or spans.

Deprecations

  • TransactionContext API is now deprecated

    The TransactionContext API will be removed in a future release.

  • Tornado instrumentation + feature flag deprecation

    The existing introductory support for Tornado and feature flags will be removed from a future release. Versions 6.x and newer will be the only versions of Tornado supported in future releases. See this discussion on the New Relic forums for more details.

Bug Fixes

  • Fixed a crash when using uvicorn workers with gunicorn

    When running ASGI applications with gunicorn, the agent would attempt to instrument the application as a WSGI application, resulting in a crash. The agent will no longer attempt to instrument gunicorn applications that are coroutines.

  • Remove logging of license keys

    The agent logged license keys when data failed to send to New Relic. The agent will no longer log license keys to the agent logs under any circumstance.

  • Fix operation of distributed tracing and cross application tracing when httplib connections are reused

    When making multiple requests via a single connection with httplib, httplib2, or urllib3, the proper headers will be added to each outgoing request. As a result, cross application tracing and distributed tracing will now operate as expected when reusing connection objects.

Wednesday, May 22, 2019 - 14:30 Download

Notes

This release of the Python agent includes bug fixes and adds new API methods to retrieve the current trace ID and current span ID.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Features

  • Added a new API to retrieve the current trace ID

    Retrieving the current trace ID can now be accomplished with a call to newrelic.agent.current_trace_id(). This method will return the id of the current trace, or None if no transaction is in progress.

  • Added a new API to retrieve the current span ID

    Retrieving the current span ID can now be accomplished with a call to newrelic.agent.current_span_id(). This method will return the id of the current span, or None if no span is in progress.

Bug Fixes

  • Exclusive time incorrectly displayed when using concurrent asyncio

    The New Relic UI may have shown times equaling greater than 100 percent of the total time when executing concurrent tasks in asyncio. The exclusive times reported by the agent will now be correctly displayed in APM and insights.

Wednesday, April 17, 2019 - 16:00 Download

Notes

This release of the Python agent adds improvements to the gRPC instrumentation package and includes bug fixes.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Features

  • Improved gRPC support

    Support for measuring inbound gRPC requests has now been added. Inbound gRPC requests will now show as web transactions in APM. Additionally, distributed tracing is now supported as part of the gRPC instrumentation package.

Bug Fixes

  • Update pika instrumentation to support the 1.x releases

    When using the agent with pika versions 1.x and up, the agent may have caused an application crash. The agent now correctly collects data on newer versions of pika.

  • The startup_timeout setting may not have been honored in a multithreaded application

    When startup_timeout is set to a number greater than 0, the servicing of transactions is blocked until the agent has fully activated. In multithreaded applications, only the first thread would block due to improper locking. The agent will now block on all threads.

Friday, March 29, 2019 - 18:00 Download

Notes

This release of the Python agent fixes a memory leak that occurs on Python 2 when monitoring WSGI applications.

The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directly from the New Relic download site.

Bug Fixes

  • Fix memory leak on Python 2 WSGI applications

    When using the 4.16.0 agent on Python 2 to monitor WSGI applications, the agent would cause memory to be allocated on each request. On Python 2, this memory was never deallocated due to a reference cycle. This has now been corrected.

Pages