Python Release Notes

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.

Monday, March 25, 2019 - 14:00 Download

Notes

This release of the Python agent adds support for native coroutines and generators with a new web_transaction API, as well as bugfixes.

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

Bug Fixes

  • The presence of unicode values in a SQL query on Python 2 may cause an application crash

    The agent was not properly handling unicode values when recording SQL queries in Python 2. As a result, the presence of unicode values in SQL queries in Python 2 applications may have resulted in an application crash. Unicode values in Python 2 SQL queries are now properly handled.

  • The Python Agent may have improperly biased the random sampling of distributed traces

    Distributed traces are randomly sampled across services. The agent is responsible for propagating the state of its sampling decision to other services. In propagating that decision, an improper sampling bias may have been introduced in downstream services.

  • The agent will no longer report the command arguments used to start newrelic-admin

    The agent previously reported the startup command and arguments when using newrelic-admin run-program and newrelic-admin run-python. The command and arguments are no longer sent to New Relic. This data may continue to be logged to the agent log files when debug level logs are enabled.

Wednesday, February 13, 2019 - 10:00 Download

Notes

This release of the Python agent adds support for native coroutines and generators with the background task API and adds support for Kubernetes detection.

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

  • @background_task can now be used with coroutines

    The background_task decorator API can now be used with native coroutines and generators.

    @background_task(name='my_coroutine')
     async def my_coroutine():
       await asyncio.sleep(0.1)
    
  • Add support for collection of Kubernetes metadata

    The agent will now collect environment variables prefixed by NEW_RELIC_METADATA_ as additional metadata. Some of this metadata may be added to Transaction events to provide context between your Kubernetes cluster and your services. For details on the benefits (currently in beta) see this blog post.

    The agent now also collects the KUBERNETES_SERVICE_HOST environment variable to detect when the application is running on Kubernetes. The data is used to link the application to the host machine when using the New Relic infrastructure product.

Bug Fixes

  • Using time trace decorators allowed coroutines to become Iterables and generators to become awaitables

    When using time trace decorators native coroutines were converted to iterables. Additionally generators were converted to awaitables. The behavior of generators, native coroutines, and awaitable generators is now unchanged when using time trace decorators.

Tuesday, January 22, 2019 - 15:00 Download

Notes

This release of the Python agent extends support of Amazon's boto3 library 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

  • AWS operation and request ID will now be reported in transaction traces and spans when using boto3 and botocore.

    The agent will now report aws.requestId and aws.operation for all calls to AWS made using botocore and boto3.

  • DynamoDB calls are now reported under the Databases tab.

    The agent will now record DynamoDB query performance in the Databases tab in APM in addition to table name for the following calls:

    • put_item
    • get_item
    • update_item
    • delete_item
    • create_table
    • delete_table
    • query
    • scan
  • Certain SQS calls will now report additional data for spans and transaction traces.

    The agent will now record the queue name in spans and transaction traces for the following SQS calls:

    • send_message
    • send_message_batch
    • receive_message
  • SNS publish will now report additional data for spans and transaction traces.

    The SNS topic, target, or the string literal PhoneNumber will be reported to New Relic inside of spans and transaction traces.

  • The full URL path will now be recorded on span events and transaction traces when using boto3 or botocore.

    The agent will now record the full URL path for API calls made to AWS through the boto3 / botocore libraries. The path will be available through span events and transaction traces.

Bug Fixes

  • Using newrelic-admin to start a GunicornWebWorker with an aiohttp application factory resulted in an application crash.

    The agent would fail to start if using the newrelic-admin command to start an aiohttp application factory with GunicornWebWorker. This issue has now been fixed.

Thursday, January 10, 2019 - 10:30 Download

Notes

This release of the Python agent adds support for excluding attributes from span events and transaction trace segments, adds a new api called add_custom_parameters, and includes 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.

Features

  • Add ability to exclude attributes from span events and transaction trace segments

    This release adds support to exclude attributes (such as http.url) from span events (via the span_events.include/span_events.exclude options) and from transaction segments (via the transaction_segments.include/transaction_segments.exclude option).

    As with other attribute destinations, these new options will inherit values from the top-level attributes.include/attributes.exclude settings. See the documentation for more information.

  • Add public add_custom_parameters API

    The method add_custom_parameters on Transaction is now exposed through newrelic.agent.add_custom_parameters

Bug Fixes

  • Transaction counts were not reported for aiohttp's built-in error pages

    When a built-in error route was reached in aiohttp (such as a 404 due to a missing route), transactions were not recorded. As a result, the transaction counts may have been artificially low. aiohttp system route traffic will now be reported.

  • aiohttp cross application tracing linking to non-Python applications may have been omitted if using multidict<3.0

    For aiohttp users using multidict versions less than 3.0, cross application tracing HTTP headers may have been generated in a way that was incompatible with non-Python applications. Headers are now generated in a format compatible with all New Relic agents.

  • aiohttp 3.5.x versions generated agent instrumentation errors

    The agent previously failed to instrument aiohttp applications running versions 3.5.0 and greater. The agent now supports aiohttp versions up to 3.5.1.

Monday, December 3, 2018 - 13:30 Download

Notes

This release of the Python agent adds support for Falcon framework, and includes 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.

Features

  • Add support for Falcon web framework

    This release adds support for the Falcon web framework. Data will now be automatically collected for applications using Falcon framework. The data will appear in both APM and Insights and will include performance details as well as information on application errors.

Bug Fixes

  • "newrelic-admin record_deploy" now functions with proxies.

    The newrelic-admin record_deploy command previously did not function when a proxy was defined by the newrelic.ini configuration file or the NEW_RELIC_PROXY_* environment variables. This bug has now been fixed.

  • Cross Application Tracing HTTP response headers were inserted on a 304 response

    When cross application tracing is enabled and the agent received a HTTP request from an application utilizing cross application tracing, the agent may have inserted additional response headers on a 304 HTTP response. The agent will no longer insert headers on a 304 response.

Monday, November 12, 2018 - 14:00 Download

Notes

This release of the Python agent includes changes to the agent to enable monitoring of Lambda functions, improves the built-in Sanic instrumentation, and includes 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.

Features

  • Monitoring of Lambda functions

    This release includes changes to the agent to enable monitoring of Lambda functions. If you are interested in learning more or previewing New Relic Lambda monitoring please email lambda_preview@newrelic.com.

  • Improve naming of Sanic HTTPMethodView view handlers

    Sanic views that were defined using the HTTPMethodView class were previously all named HTTPMethodView.as_view.<locals>.view regardless of the actual class in use. The agent will now name transactions after the actual view handler class.

Bug Fixes

  • Fix ignored error reporting in CherryPy instrumention

    When missing query parameters, unexpected query parameters, unexpected positional arguments, or duplicate arguments were present in the CherryPy framework, a TypeError exception was recorded even when an ignored response status code (such as a 404) was generated. An error is no longer recorded when it results in the generation of an ignored status code.

  • Excluding request.uri from transaction trace attributes hides it in the UI

    When request.uri is added to either attributes.exclude or transaction_tracer.attributes.exclude, the value will now no longer be sent to New Relic.

  • Ability to disable sending request.uri as part of error traces

    When request.uri is added to either attributes.exclude or error_collector.attributes.exclude, the value will now no longer be sent to New Relic.

  • Fix tracing of functions returning generators

    When tracing generators whose parent traces have ended an error was seen in the logs "Transaction ended but current_node is not Sentinel." This has now been fixed.

Monday, September 24, 2018 - 15:00 Download

Notes

This release of the Python agent contains 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

  • The creation of sampled events sometimes raised an exception in Python 3

    When more events (Transaction, Transaction Error, Custom, or Span) were created than allowed per harvest period in Python 3, sometimes a TypeError: '<' not supported between instances of 'dict' and 'dict' was raised. This issue has now been fixed.

Tuesday, September 11, 2018 - 10:00 Download

Notes

This release of the Python agent introduces instrumentation for Sanic, and contains 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

  • Add instrumentation for Sanic framework

    Data is now automatically collected for applications using the Sanic framework. Data for Sanic applications will appear in both APM and Insights. Additionally, cross application tracing and distributed tracing is supported for incoming requests for Sanic applications. In addition to service maps, Sanic applications will now show the calling application in transaction traces. See the instrumented packages page for more details.

Bug Fixes

  • Explain plans were not generated when using psycopg2 named cursors

    When using named cursors in psycopg2, the agent attempted to generate an explain plan using the same named cursor. This resulted in a syntax error when the query was issued to the database. When using the default connection and cursor factories, the agent will now execute the explain query using only unnamed cursors.

  • Convert bytes-like SQL statements to strings before obfuscating

    If a bytes-like object is used instead of a string when making a SQL call, a traceback was seen in the logs with TypeError: cannot use a string pattern on a bytes-like object. This issue has now been fixed.

  • Save settings to MessageTrace objects

    If an external call using an instrumented http external library (for example requests) was used within a MessageTrace, a traceback was seen in the logs with AttributeError: 'MessageTrace' object has no attribute 'settings'. This issue has now been fixed.

Tuesday, July 31, 2018 - 09:30 Download

Notes

This release of the Python agent introduces distributed tracing, adds improvement to our Pyramid instrumentation, adds support for custom CA bundles, and contains 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

  • Distributed tracing support

    Distributed tracing lets you see the path that a request takes as it travels through your distributed system. By showing the distributed activity through a unified view, you can troubleshoot and understand a complex system better than ever before.

    Distributed tracing is available with an APM Pro or equivalent subscription. To see a complete distributed trace, you need to enable the feature on a set of neighboring services. Enabling distributed tracing changes the behavior of some New Relic features, so carefully consult the transition guide before you enable this feature.

    To enable distributed tracing, add distributed_tracing.enabled = true to your newrelic.ini file or use the environment variable NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=true.

  • Add support for tracing Pyramid tweens

    Pyramid tweens are now automatically timed and added to the transaction detail view. The time spent in a Pyramid tween will be displayed in the transaction breakdown table and in the trace details of a transaction trace.

  • Provide configuration option for custom CA bundle

    Customers can now use the ca_bundle_path configuration option or set the NEW_RELIC_CA_BUNDLE_PATH environment variable to set the path to a local CA bundle. This CA bundle will be used to validate the SSL certificate presented by New Relic's data collection service.

Bug Fixes

  • Custom Insights event data attached to transactions in excess of 100 events were omitted

    The agent may have failed to send custom event data (record_custom_event) to insights when recorded as part of a Transaction containing over 100 custom events. This issue has now been corrected.

Monday, July 23, 2018 - 15:30 Download

Notes

This release of the Python agent removes previously deprecated APIs, and removes support for Python 2.6 and Python 3.3.

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.

Deprecations

  • Removed previously deprecated APIs

    The following APIs have been removed:

    • Transaction.add_user_attribute (use Transaction.add_custom_parameter)
    • Transaction.add_user_attributes (use Transaction.add_custom_parameters)
    • wrap_callable (use FunctionWrapper)
  • Removed support for Python 2.6 and Python 3.3

    Python 2.6 and Python 3.3 are no longer supported. Please consider upgrading your application to a supported version of Python in order to continue to receive updates to the Python Agent.

Thursday, July 12, 2018 - 10:00 Download

Notes

This release of the Python agent adds support for Python 3.7 and contains 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

  • Support Python 3.7

    The New Relic Python Agent now supports Python 3.7.

Bug Fixes

  • Agent raises a KeyError: 'NEW_RELIC_ADMIN_COMMAND' exception causing a crash

    Under certain conditions, using the newrelic-admin wrapper script could cause an application to crash shortly after startup with a KeyError exception. The cause of the crash has been addressed.

  • Agent raises an AttributeError on Python 3 when using WSGI overrides with multiple app names

    When using WSGI environ overrides to specify multiple app names as described in the docs https://docs.newrelic.com/docs/agents/manage-apm-agents/app-naming/use-m... the agent will raise an AttributeError. This error has been corrected.

  • Agent raises an AttributeError exception under rare conditions when halting a trace

    Under certain rare conditions, the agent might raise an exception when trying to trace an external call in a transaction that has been forcibly halted. The cause of the exception has been addressed.

  • Agent raises a RuntimeError exception under particular conditions when using the Tornado r3 instrumentation

    When attempting to yield many times from a wrapped tornado.gen.coroutine when using Tornado's r3 instrumentation, a RuntimeError due to hitting the maximum recursion limit can occur. The cause of this exception has been patched.

Monday, June 11, 2018 - 14:00 Download

Notes

This release of the Python agent contains 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.

Bug Fixes

  • Improved handling of celery max-tasks-per-child

    Data recorded by the Python Agent may not have been reported when celery was operated with the max-tasks-per-child setting. All data is now reported independent of the max tasks per child setting.

  • Improve support for PyMongo v3.x

    PyMongo v3 added many new methods on the pymongo.Collection object that did not exist in v2. These methods have now been instrumented. Calls to these methods will now appear in APM.

  • Scheduling tasks that run after a transaction ends causes an error

    Coroutines scheduled to execute after a transaction ends using create_task or ensure_future may have caused the runtime instrumentation error and subsequent crash:

    The transaction already completed meaning a child called complete trace after the trace had been finalized.

    Coroutines that execute beyond the end of a transaction will no longer cause an error.

Wednesday, May 16, 2018 - 15:30 Download

Notes

This release of the Python agent contains 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.

Bug Fixes

  • Do not run explain plans for psycopg2 connections using the async_ kwarg

    As "async" is now a keyword in Python 3.7, psycopg2 now allows "async_" as an alias for its "async" kwarg for psycopg2.connect as of psycopg2 v2.7.4. Previously, explain plans were attempted for these connections and a traceback would be seen in the logs. This has now been fixed.

  • Fix traceback when using callbacks as partials in pika consumers

    When passing a callback that is a functools partial to pika channel consumers, a traceback occurred in some instances. This issue has now been fixed.

  • cx_Oracle database calls that use SessionPool objects were not recorded

    When using the cx_Oracle SessionPool interace, database transactions made through the acquired pool connection may not have been reported. Database transactions that using connections generated by SessionPool are now reported as expected.

  • SQL targets for call statements may contain a period

    For a SQL command like CALL foo.bar(:baz), APM would show metrics under the target name foo instead of the full name foo.bar. This has been fixed.

Wednesday, April 4, 2018 - 12:00 Download

Notes

This release of the Python agent adds the request.uri attribute on transaction events in insights, adds built-in cheroot instrumentation, adds support for recording flask-restful/flask-restplus exceptions, and contains 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

  • Add request.uri attribute to transaction and error events

    The Python agent will now report request.uri as an attribute on transaction events and error events. To disable this feature, add request.uri to the attributes.exclude list in the newrelic.ini configuration file.

  • Record Flask RESTful and Flask RestPlus exceptions

    Since Flask RESTful and Flask RestPlus handle all errors that are raised in their handlers, these errors were not being captured by the normal Flask instrumentation in the Python agent. Exception handling has now been added for these two components.

  • Add instrumentation hooks for the Cheroot WSGI server

    Any customers using Cheroot with an unsupported application framework will now see data reported in New Relic APM.

Bug Fixes

  • Fix CherryPy ignore by status code for exceptions using reason phrases

    CherryPy accepts string values for HTTPError status (reason phrases). When creating HTTPError exceptions in this way, responses were not properly ignored by status code. Responses generated by HTTPError exceptions using reason phrases are now properly ignored.

  • Using send_file with Flask Compress middleware may have caused an application crash

    When using browser monitoring auto instrumentation on an application using Flask Compress, the use of the Flask send_file helper to send html files resulted in an application crash. This issue has now been resolved.

  • Fix incorrect parenting for traces of coroutines scheduled with asyncio gather/ensure_future

    Coroutines scheduled with asyncio gather/ensure_future may have been reported as being a child of the wrong function. This issue has now been corrected.

Wednesday, March 14, 2018 - 13:30 Download

Notes

This release of the Python agent removes previously deprecated APIs, makes SSL communication with New Relic mandatory, and updates support for aiohttp middleware.

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.

Deprecations

  • Removed previously deprecated APIs

    The following APIs have been removed:

    • transaction (use current_transaction)
    • name_transaction (use set_transaction_name)
    • Application.record_metric (use Application.record_custom_metric)
    • Application.record_metrics (use Application.record_custom_metrics)
    • Transaction.notice_error (use Transaction.record_exception)
    • Transaction.record_metric (use Transaction.record_custom_metric)
    • Transaction.name_transaction (use Transaction.set_transaction_name)
  • Deprecate Transaction.add_user_attribute

    Transaction.add_user_attribute has been deprecated in favor of Transaction.add_custom_parameter. Transaction.add_user_attribute will be removed in a future release.

  • Deprecate Transaction.add_user_attributes

    Transaction.add_user_attributes has been deprecated in favor of Transaction.add_custom_parameters. Transaction.add_user_attributes will be removed in a future release.

  • Deprecate wrap_callable

    wrap_callable has been deprecated in favor of FunctionWrapper. wrap_callable will be removed in a future release.

  • Remove data-source admin command

    The platform API (used by newrelic-admin data-source) has been removed. Please use data sources in place of the platform API.

SSL

SSL connections to New Relic are now mandatory

Prior to this version, using an SSL connection to New Relic was the default behavior. SSL connections are now enforced (not overrideable).

AIOHTTP Updates

  • Add automatic tracing of AIOHTTP 3 middleware

    In addition to the old-style middleware previously supported, the AIOHTTP 3 style middleware is now automatically traced as part of the AIOHTTP instrumentation package.

Wednesday, March 7, 2018 - 15:00 Download

Notes

This release of the Python agent includes a fix for security bulletin nr18-07.

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.

Wednesday, February 28, 2018 - 12:00 Download

Notes

This release of the Python agent adds support for AIOHTTP version 3.

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 AIOHTTP Support

  • Support for AIOHTTP 3

    AIOHTTP major version 3 is now supported by the New Relic Python agent.

Pages