Python release notes

Python agent release notes

Monday, December 14, 2015 - 11:00 Download

Notes

This release of the Python agent enables the ability to add Custom Insights Events through a new record_custom_event() API.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Feature

  • Custom Insights Events

Prior to this release, the Python agent had the capability to record two types of Insights events automatically: Transaction and TransactionError events. In addition, custom attributes could be added to those events. Now, with the addition of the record_custom_event() API, it is possible to define your own custom event types, enabling greater flexibility about what types of events you can view and query in Insights.

For details, see the Insights documentation on Inserting Custom Events.

Changed Feature

  • Attributes renamed

Two attributes have been renamed, in order to be consistent with the naming convention of other New Relic agents. The affected attributes are:

  • response.headers.contentLength (was response.contentLength)
  • response.headers.contentType (was response.contentType)
Wednesday, November 25, 2015 - 13:00 Download

Notes

This release of the Python agent is a hotfix release to address a problem where the agent could fail to validate the SSL certificate of the New Relic collector in some environments.

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

For a list of known issues with the Python agent, see Status of the Python agent.

Bug Fix

If the Python agent was used in an environment where the certifi package was installed, the Python agent would use the certifi CA certificates bundle to validate the certificate of the New Relic collector. However, the latest release of certifi (November 20, 2015) removed some older CA certificates with 1024-bit keys.

The SSL certificate for the New Relic collector is cross-signed with both a 1024-bit certificate and a 2048-bit certificate, but in some circumstances, the stronger root certificate was not used for validation. When the 1024-bit certificate was no longer included in the certifi bundle, SSL validation would fail. Affected customers would see warnings in their agent log stating "Data collector is not contactable" due to an SSLError.

To address this issue, the agent no longer uses the certifi CA certificates bundle, nor the certificates bundled with requests. Instead, it only uses the CA bundle included with the agent to validate the New Relic collector certificate.

Tuesday, November 17, 2015 - 17:00 Download

Notes

This release of the Python agent is a hotfix release to address a problem where the package failed to install under certain circumstances.

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

For a list of known issues with the Python agent, see Status of the Python agent.

Bug Fix

The README.rst file contained non-ASCII characters, which could result in a UnicodeDecodeError during installation. Those characters have been removed.

Monday, November 16, 2015 - 12:00 Download

Notes

This release of the Python agent reports error events to Insights and captures enhanced error data to support the new Advanced Error Analytics feature in APM.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Feature

  • Error Events

The Python agent now sends TransactionError events for Advanced Error Analytics, which power the new APM Errors functionality (currently in Beta). This allows users to create charts that facet and filter their error data by attributes, as well as explore their error events in Insights. For details, see the APM Errors documentation.

Changed Feature

  • Additional Attributes collected

The agent now collects additional attributes for web transactions:

  • HTTP request headers: Host and Accept
  • HTTP response header :Content-Length

Bug Fix

  • Improved unicode support for exception messages

Unicode exception messages will still be preserved, even if sys.setdefaultencoding() has been called to change the default encoding.

Wednesday, September 30, 2015 - 11:00 Download

Notes

This release of the Python agent adds much more flexibility around what attributes are sent to New Relic, and where they are displayed.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Feature

  • Flexible capturing of attributes

Attributes are key-value pairs that contain additional information to be added to an event or transaction. These key-value pairs can be viewed within transaction traces in New Relic APM, traced errors in New Relic APM, transaction events in Insights, and page views in Insights.

A number of new configuration settings have been introduced to allow you to customize exactly which attributes will be sent to each of these destinations.

For details, see Python agent attributes.

Deprecated Settings

Several configuration settings have been deprecated. The most commonly used of the deprecated settings are capture_params and ignored_params. It is still possible to achieve the same functionality as the old settings by using the new attributes.include and attributes.exclude settings. For examples, see Python agent attribute examples.

A complete list of deprecated settings can be found in deprecated configuration settings.

While the usage of deprecated settings is still supported, we recommend upgrading your configuration to use the new settings as soon as possible.

Changed Feature

Previously, it was possible to save a list, dict, or tuple as an attribute value that could be displayed in transaction and error traces. However, these same attributes could not be displayed in Insights events. Now, all attributes are handled in a consistent manner, which means that all attribute values must be one of the following types:

Python 2: str, unicode, int, long, float, bool
Python 3: str, bytes, int, float, bool

All values which are not one of these types are automatically converted by calling str(value).

Wednesday, July 29, 2015 - 11:30 Download

Notes

This release of the Python agent adds the ability to strip exception messages from error traces, in order to prevent the inadvertent capture of sensitive information.

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

New Features

  • Allowing Exception Messages

Because an exception message can contain sensitive information, the agent now provides the ability to strip exception messages before sending error traces to APM. Exception messages will be stripped automatically in high security mode.

For exception messages you know to be safe, you can add them to an allow list so that those messages are passed unaltered to APM. Two new configuration settings control this feature: strip_exception_messages.enabled and strip_exception_messages.whitelist.

Bug Fixes

  • capture_request_params API disabled for high security mode

When operating in high security mode, the agent should not capture query string parameters. However, prior to this release, it was possible to call newrelic.agent.capture_request_params(flag=True), even if the agent was in high security mode, and the agent would capture and report query string parameters. Now, the capture_request_params API call does not override the capture_params setting when the agent is in high security mode, so query parameters are not captured.

Thursday, June 11, 2015 - 11:30 Download

Notes

This release of the Python agent adds the ability to customize the hostname displayed in the APM UI, as well as updating the solrpy and pysolr instrumentation so that Solr metrics will now appear in the Databases tab in the UI.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Features

  • Customize hostname displayed in APM

A new configuration setting has been added: process_host.display_name. When set in the newrelic.ini configuration file, the display name will be used in the APM UI, in place of the hostname that the agent automatically captures. In addition, the display name can be set using the NEW_RELIC_PROCESS_HOST_DISPLAY_NAME environment variable.

Features Changed

  • Update solrpy and pysolr instrumention

Previously, solrpy and pysolr instrumentation reported metrics in the Solr namespace. Now, to align them with our recent changes to SQL and NoSQL instrumentation, solrpy and pysolr have been updated to report metrics in the Datastore namespace, which means that time spent in calls to Solr will be listed in both the main overview chart, as well as in the Databases tab in the UI.

Monday, April 6, 2015 - 15:00 Download

Notes

This release of the Python agent adds support for Django 1.8.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Features

  • Support for Django 1.8.

Features Changed

  • The list of modules loaded by the application will no longer include version numbers. In certain cases, attempting to determine the version numbers of packages can potentially generate excessive CPU overhead, so it has been preemptively disabled to prevent any such occurrence.

Bugs Fixed

  • When using the psycopg2 Postgres database adapter, if the pscyopg2.extras.register_json() function was used, then instrumentation for the psycopg2 module would fail. Now, register_json() is instrumented correctly.

  • If a Django class based view was registered as the view handler in urls.py, the transaction was named after the class name, and not the method of the class based view which handled the request. Now, the transaction is named after the method.

Wednesday, March 25, 2015 - 15:00 Download

Notes

This release of the Python agent adds instrumentation for Elasticsearch as a new datastore product and a more granular breakdown of various SQL operations in the “Databases” tab in the APM UI. In addition, the stack traces captured by the agent are now being trimmed to remove any code snippets.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Features

  • Improved SQL Breakdown

    This agent release adds the ability to see the breakdown of time spent in SQL statements such as CREATE, DROP, ALTER, SET, CALL, EXEC, EXECUTE, COMMIT and ROLLBACK. Execution of stored procedures through the callproc() or CALL statements will provide further breakdown based on the name of the stored procedure.

  • Elasticsearch Support

    Instrumentation support for the official Elasticsearch client module and the separate pyelasticsearch module have been added. Time spent in calls made to Elasticsearch will be listed in both the main overview chart, as well as in the Databases tab in the UI. Previously, calls to Elasticsearch would have been shown as time spent in external web service calls.

Features Changed

  • Remove code snippets in stack traces

    Stack traces captured for errors and slow SQL queries will no longer include code snippets. This change is to prevent the possibility of capturing sensitive data embedded within the code. It reduces the overhead in capturing stack trace information, and also avoids a potential problem caused when the code on disk has changed in the time since the process was started.

Bugs Fixed

  • Ensure that messages sent to the data collector containing parts which were already compressed and encoded, were not being compressed a second time at the HTTP request level causing additional overhead.

  • Guard against a potential agent error where an invalid URL was being passed to an instrumented external web service client.

  • Motor (an asynchronous MongoDB library) incorrectly returns a non string object when the agent tries to access the __name__ attribute on Motor objects. This caused the agent to fail when calculating the name for an object, since we rely on this value being a string as specified by the Python object model definition. The agent now overrides the incorrect behavior of Motor to ensure that we can still generate names of objects correctly.

  • When using Python 3 and audit logging was enabled, if messages being sent to our data collector were large enough that they were being compressed at the HTTP request level, the audit logging code would fail due to a bytes/Unicode mismatch.

  • Instrumentation for the decr() method of umemcache client for Memcached was incorrectly calling the stats() method.

Wednesday, March 4, 2015 - 10:00 Download

Notes

This release of the Python agent is a minor bug fix release, including changes which may help to reduce the incidence of spurious warnings about being able to communicate with our service.

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

For a list of known issues with the Python agent, see Status of the Python agent.

Bugs Fixed

  • Improved management of the network connection to our service

    • When the agent registered itself with our data collector, it wasn't closing the socket connection immediately and instead it was holding it open for up to a minute when the first batch of data would be reported. If the socket connection was being closed remotely during that time, a BadStatusLine exception would be seen in the logs when the attempt was made to upload data.

    • When the agent received an internal restart request from our data collector as the result of a server side configuration change, the socket connection wasn't being closed explicitly. In the case of CPython it would still be cleaned up and closed immediately due to reference counting, but under PyPy when it was closed was dependent on when PyPy garbage collection occurred. This could mean that the socket descriptor could stay in use for a while.

  • Compatibility modules for transitioning from Python 2 to Python 3

    When compatibility modules for Python 2/3 migration such as pies2overrides and future were installed in a Python 2 installation, they were installing modules which mimic modules which would normally only ever exist in a Python 3 installation. The presence of these modules were confusing the agent's instrumentation mechanisms. The result of this was that use of http.client from Python 3 in a Python 2 application would fail.

  • Failures when making calls to external web services

    • If a HTTP client module was supplied None as the value for the URL being requested, this would cause an exception when the agent was recording the data for that transaction.

    • Use of the ExternalTrace context manager class directly, for recording external web services calls, would fail if there was no active transaction. This could occur in the time before the agent has successfully been able to register with our data collector.

  • Setting of response content length when using Django

    The Django middleware installed by the agent to perform insertion of RUM monitoring code into responses, would always set the Content-Length even if it was not previously set. This could cause issues where a front end had been set up with an expectation that Content-Length headers would never exist.

Wednesday, February 11, 2015 - 14:30 Download

Notes

This release of the Python agent includes a major update to how we capture and represent metrics for both SQL databases and NoSQL datastores. Metrics for both types of products will now be displayed in a unified "Databases" tab in the APM UI, and these metrics will also be associated with the specific product being used. In addition, we have enabled support for having key transactions on other transactions, such as background tasks.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Features

  • Unified view for SQL database and NoSQL datastore products.

    The response time charts in the application overview page will now include NoSQL datastores such as Memcached, Redis and MongoDB and also the product name of existing SQL databases such as MySQL, Postgres, Oracle etc.

    We also introduced a new unified view within the APM UI for visualizing time spent in queries made against SQL databases and NoSQL datastore products.

    For existing SQL databases, in addition to the existing breakdown of SQL statements and operations, the queries are now also associated with the database product being used.

    For NoSQL datastores such as Memcached, Redis and MongoDB, we have now added information about operations performed against those products, similar to what is being done for SQL databases.

    Because this introduces a notable change to how SQL database metrics are collected, it is important that you upgrade the Python agent version on all hosts. If you are unable to transition to the latest agent version on all hosts at the same time, you can still access old and new metric data for SQL databases, but the information will be split across two separate views.

  • Key transactions for other transactions.

    In addition to being able to create key transactions for web transactions, it is now possible to create key transactions for other transactions, such as background tasks executed by Celery.

    Key transactions enable the setting of a per transaction Apdex and alerts, as well as the ability to run X-Ray sessions, including transaction specific thread profiling.

  • No SQL datastore instrumentation.

    To complement our new unified view for SQL database and NoSQL datastore products in the APM UI, we have upgraded our existing instrumentation for Redis and MongoDB. Previously, these only provided a function breakdown in transaction summaries and sample transaction traces, but now they will report into the unified view for database and datastore products under their respective product categories.

    Existing instrumentation for Memcached clients have similarly been updated, as well as new support for the pymemcache module being added.

Sunday, January 18, 2015 - 07:25 Download

Notes

This release of the Python agent includes bug fixes for issues with agent registration and use of proxies which could result in no data being reported.

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

For a list of known issues with the Python agent, see Status of the Python agent.

Bug Fixes

  • Agent not recovering when errors occur during registration

    If the agent initially registered with our data collector successfully, but subsequently failed to upload agent setting information due to a transient back end or network issue, the agent was not recovering from the error properly. The consequence of this was that the agent would not completely start up and no data would be collected or reported by that process. The operation of the web application as a whole would not have been affected. This issue, which was introduced in version 2.36.0.30 of the agent, is now fixed.

  • Agent not able to connect via some proxy servers

    The Python agent was not able to connect to our data collector to register when certain proxy server installations or configurations were being used. We have updated the version of the internal HTTP client library used to resolve the issue.

  • Identification of Python web server being used

    The Python agent was incorrectly reporting the Python web server being used as Tornado when both the 'gunicorn' and 'tornado' Python modules were being imported, even if the Tornado web server module wasn't actually being used. This did not affect the operation of the agent but could lead to confusion when trying to debug deployment issues.

Wednesday, December 3, 2014 - 09:45
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent enables the collection of transaction traces for Synthetics requests by default, and adds the individual trip trace visualization for Cross Application Tracing.

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

For a list of known issues with the Python agent, see Status of the Python agent.

New Features

  • Cross Application Tracing for individual transactions

    Version 2.38.0.31 of the Python agent introduced aggregated transaction maps. In this release, we have built on that feature to add the ability to view an end-to-end visualization of an individual transaction, in order to better understand what backend applications and external services were called during the course of a single transaction.

Features Changed

  • Synthetics support enabled by default

    When the Python agent added support for the collection of transaction traces for Synthetics requests in version 2.32.0.28, the feature had to be explicitly enabled in the agent configuration file. With this release, support for Synthetics is enabled by default.

Bug Fixes

  • Non ASCII characters in transaction names

    If a transaction name contained a Unicode character outside of the ASCII range, the generation of the cross application tracing attributes would result in a UnicodeEncodeError. This bug affected versions 2.38.0.31 through 2.38.2.33. The issue is fixed in the current release.

  • Parsing SQL statements referencing the database schema

    Previously, SQL statements that referenced a table from a database schema namespace, such as “schema.table_name”, would not always be parsed correctly, resulting in the table being identified as just “schema”. The agent now handles this case correctly, and the table is reported as “schema.table_name”.

  • Additional support for Tornado 1.X

    If Tornado 1.X was being used, the instrumentation would fail at run time causing all web requests to fail. Monitoring of Tornado 1.X applications should now work correctly.

Tuesday, November 25, 2014 - 13:30
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent fixes a memory leak which affects our Tornado instrumentation, and which was a factor in the recent issues we had with the Django template instrumentation.

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

For a list of known issues with the Python agent see Status of the Python agent.

Bug Fixes

  • Due to an issue with the low level function wrappers we use to instrument third party Python modules, memory was being leaked and process memory usage could increase over time. This issue affects version 2.32.0 through 2.38.0 of the Python agent and has been impacting on our Tornado instrumentation.

    The memory leak has also been identified as the root cause for memory leaks in our Django template instrumentation, affecting versions 2.32.0.28 through 2.36.0.30. The Django template instrumentation was disabled in the prior 2.38.0.31 release while we investigated the cause. It remains disabled by default.

Wednesday, November 12, 2014 - 11:30
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent adds support for the mapping features of Cross Application Tracing, which provide a visualization of how requests flow through multiple applications within a distributed system.

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

For a list of known issues with the Python agent see Status of the Python agent.

New Features

  • Cross Application Tracing

    The Cross Application Tracing feature is now enhanced with the aggregate transaction map visualizations. This new visualization will help users spot bottlenecks in external services and give them an end-to-end understanding of what other applications and services are called within a transaction. All agents involved in the cross application communication must be upgraded to see the complete graph.

Improvements

  • Tornado 3.x Instrumentation

    The newly refactored Tornado instrumentation is turned on by default. This was introduced in the python agent version 2.32.0.28 under an optional feature flag. This change improves upon the stability of our Tornado instrumentation and accounts for the incremental changes introduced to the Tornado 3.x source tree. It also provides a more granular view of where the time is spent in a WebTransaction, by distinguishing the time spent doing work vs time spent waiting on a asynchronous call.

    Please be advised that we currently do not have instrumentation for Tornado 4.x, but we are working to add support for it.

  • Capacity Analysis for mod_wsgi

    The capacity analysis report shows how many instances of your web application is running and how busy they are. For a web application, the measure of how busy the application is, is calculated by looking at how much of the time the total available set of request handler threads are busy.

    For the case of using Apache/mod_wsgi in daemon mode, the measure of how busy your application is, has been getting over reported due to the nature of how threads are managed by mod_wsgi. If you are using mod_wsgi version 4.1.0 or higher, this measure will now be more accurately reported as it will use information provided by mod_wsgi about the total number of request handler threads which are available, rather than trying to calculate it based on what threads have been seen to be handling requests.

Bug Fixes

  • In version 2.28.0.26 and 2.32.0.28 of the agent, we added new features to track template includes and inclusion tags when using the Django template rendering system. We have had a few reports that indicate that for some users, but not everyone, that the instrumentation implementing these features may be causing an ongoing growth in memory usage for the web application processes over time. Right now, we don't understand the root cause for why this might be occurring in some instances, so to be on the safe side we have disabled these two features while we investigate further.

    The consequence of these features being disabled is that the web transaction performance breakdown and sample transaction traces will no longer show as a separate metric or entry where one template has been included in another. Further, if the tracking of special inclusion tags had been configured, they will also no longer be shown. We anticipate re-enabling the features once we have worked out what is occurring and made changes to ensure it does not occur again.

Wednesday, October 29, 2014 - 17:30
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent provides improvements to how we report agent configuration information. This enables us to better help you debug any issues you may experience with configuring the agent.

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

For a list of known issues with the Python agent see Status of the Python agent.

New Features

  • Configuration Information

    Agent configuration information displayed in the New Relic UI will now reflect the final configuration used by the agent for an application. This includes the result of any server side configuration settings, which are applied on top of the agent defaults, agent configuration file or environment variables. Previously, the result of applying the server side configuration settings was not being displayed.

Bug Fixes

  • If running a system with a Linux 3.X kernel, the agent could fail when attempting to register with our data collector. No data would subsequently be collected or reported. This would occur for versions of Python 2 prior to Python 2.7.3 and versions of Python 3 prior to Python 3.3, if they were built on a system with a Linux 3.X kernel.

Wednesday, October 15, 2014 - 12:00
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent provides support for Labels and Rollups, making it possible to organize your applications in the APM UI into meaningful categories.

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

For a list of known issues with the Python agent see Status of the Python agent.

New Features

  • Labels and Rollups

    The Python agent now supports the ability to apply labels to applications, so that you can easily sort, filter, and page through all of the applications on your account's Applications list.

    Configuration can be done in the newrelic.ini file:

    labels = Server:One;Data Center:Primary

    Labels can also be configured by setting a NEW_RELIC_LABELS environment variable:

    NEW_RELIC_LABELS=Server:One;Data Center:Primary
    More information on using labels to categorize your applications can be found in the New Relic APM documentation.

  • New CPU Reporting in Environment Snapshot

    Previously, the Python agent captured two CPU-related values to report to the Environment Snapshot: Logical Processors and Physical Processors. Now, it captures the following three values:

    • Logical Processors: The total number of hyper-threaded execution contexts available, including execution contexts that may exist on the same core. This value remains unchanged from previous agents.
    • Physical Cores: The total number of physical CPU cores available, counting hyper-threaded siblings as a single core. This value was previously reported as "Physical Processors."
    • Physical Processor Packages: The total number of processor packages or dies (each of which may contain multiple physical cores). This value is new with this agent release.

Bug Fixes

  • A "Runtime Error: transaction already active" will no longer be seen in the case where the agent created nested transaction wrappers and newrelic.agent.ignore_transaction() was called within the outer wrapper but outside the inner wrapper. Previously, this error could have also been triggered when using the WSGI environment setting for newrelic.ignore_transaction set by SetEnv in mod_wsgi.

  • Prior to this version, the HTTP_REFERER URL reported for a transaction contained query parameters, even if the capture_params setting was set to False. Now, the capture_params setting is respected when reporting the HTTP_REFERER URL.

Monday, September 29, 2014 - 13:15
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent provides a preview of a significant overhaul of our instrumentation for Tornado version 3.2 and earlier. Further improvements to our Django instrumentation are also included, allowing time spent in rendering Django sub templates to be viewed separately.

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

For a list of known issues with the Python agent see Status of the Python agent.

New Features

  • Breakout of Django template rendering

    Previously when using Django templates, if the Django include tag was being used, the time spent rendering that sub template was shown under the generic Template/Render category. When the include tag is now used, a distinct metric is instead created corresponding to the rendering time for that sub template. This will appear in the transaction performance breakdown and also in sample transaction traces. In the case of sample transaction traces, as the name of the template will be included in the metric name, it now also provides additional context for understanding where any time is being spent when rendering that template.

Features Changed

  • Preview of improved Tornado instrumentation

    Our instrumentation for Tornado version 3.2 and earlier has been experiencing a number of issues which could result in recording of data stopping and in some cases cause runtime exceptions which would affect the outcome of the executing web request. Upon investigation we found this has come about due to incremental changes in the internals of Tornado which were performed after we originally implemented the instrumentation for Tornado and which we didn't pick up as having being made. The Tornado developers have also recently released version 4.0 of Tornado. This version of Tornado has much more significant internal changes that result in our instrumentation failing completely.

    Before we could embark on trying to support version 4.0 of Tornado, we deemed it necessary to completely overhaul our existing instrumentation for older versions first in order to gives us good foundation on which to then implement support for version 4.0 of Tornado. This release of the agent provides a preview of the improved instrumentation for older versions of Tornado prior to version 4.0. The new instrumentation is not enabled by default and you will need to explicitly enable it. We have provided it as an opt in change at this point to allow you to properly test with the update first and provide us with any feedback on it and any remaining issues you may find.

    To enable the preview of the new Tornado instrumentation, you will need to add to the [newrelic]section of the agent configuration file the setting:

    feature_flag = tornado.instrumentation.r2
    
    If you are running on Heroku and are not using an agent configuration file, you can instead set the NEW_RELIC_FEATURE_FLAG environment variable. You can do this by running the Heroku command:
    heroku config:set NEW_RELIC_FEATURE_FLAG=tornado.instrumentation.r2
    

Bug Fixes

  • When an exception was raised by a WSGI application during the yielding of response content via a generator, the recording of that web request by the agent may not be closed off properly. This would result in no further web requests handled by that thread being recorded and reported. If this occurred for all request handler threads, then no data would then be reported for the whole web process. This issue relates to behaviour of the Python garbage collector and when Python objects are destroyed. At this point in time we believe this only affects users of pypy and does not affect users of CPython as the reference counting model of CPython usually gives more deterministic behaviour around when Python objects are destroyed. We don't however rule out that it could affect CPython and may explain a situation matching this problem we have seen in a couple of cases where users were using uWSGI.

  • When attempting to use Tornado as a worker for gunicorn, an exception could occur on startup which would result in gunicorn failing immediately and exiting. In order to use this combination it was previously necessary to disable the gunicorn specific instrumentation related to WSGI applications by adding to your agent configuration file:

    [import-hook:gunicorn.app.base] 
    enabled = false
    
    If you were using the Tornado worker with gunicorn and using this workaround, the underlying problem has now been addressed and you should be able to remove that section from your agent configuration file.

  • The mechanism we used for applying function wrappers for instrumentation was not being performed in the most optimal way for methods of classes. This could result in problems, including unexpected runtime exceptions, especially when trying to apply instrumentation to class methods, or methods of an existing instance of a type.

Tuesday, September 16, 2014 - 09:45
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent improves instrumentation for the Flask web framework and adds database monitoring support when using the pymssql client with a Microsoft SQL Server database.

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

For a list of known issues with the Python agent see Status of the Python agent.

New Features

  • Improved instrumentation for Flask

    The Python agent now provides better web transaction naming and performance breakdown metrics when Flask style middleware are being used. This means that time spent in Flask @before_request and @after_request functions will now be broken out as their own metrics. If a @before_request function actually returns a response, the web transaction will be correctly named after that function rather than the Flask WSGI application entry point. These changes, in addition to being applied on middleware functions registered directly against the Flask application, will also work when Flask blueprints are used to encapsulate behavior.

  • Browser monitoring auto-instrumentation when using Flask-Compress

    When the Flask-Compress package is used to perform response compression with Flask, insertion of browser monitoring tracking code into HTML responses is now automatically performed. Previously, if Flask-Compress was being used, manual instrumentation of HTML responses would have been required.

  • Monitoring of MSSQL database

    Instrumentation is now provided for the pymssql database client module to monitor database calls made against a Microsoft SQL Server database.

Bug Fixes

  • When using high security mode, the use of newrelic.capture_request_params in the per request WSGI environ to enable capture of request parameters, possibly by setting it using the SetEnv directive when using Apache/mod_wsgi, was not being overridden and disabled as required.

  • When using the DatabaseTrace context manager or associated wrappers explicitly to implement a custom monitoring mechanism for database calls, the instrumentation wrappers could fail with a TypeError exception when trying to internally derive the name of the database product being used.

Tuesday, August 26, 2014 - 15:30
End of Life

The end-of-life date for this agent version is July 29, 2019. To update to the latest agent version, see Update the agent. For more information, see End-of-life policy.

Notes

This release of the Python agent improves data collection with the Django web framework. These improvements include better-targeted web transaction naming with the Django REST framework, better coverage of Django template inclusion tags, and better background task monitoring for Django management commands.

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

For a list of known issues with the Python agent see Status of the Python agent.

New Features

  • Improved Django REST Framework naming

    Previously, when using the Django REST framework, web transactions were being named after the class based view that implemented the Django REST framework resources. Now, where such a view provides custom handler methods for different HTTP request method types or actions, the web transaction will be named after that custom handler method rather than the class as a whole. A new function breakdown metric will also be added for the custom handler method. This change will allow web requests using different HTTP request method types to be viewed separately.

  • Django inclusion tag monitoring

    Usage of inclusion tags in Django templates can now be monitored and will appear in the transaction breakdown table, charts and sample transaction traces.

    Due to the possibility that a large range of custom inclusion tags might be used and that they may be invoked a large number of times in tight loops, tracking of all inclusion tags may not be practical or may not produce worthwhile results in the transaction breakdown or sample transaction traces. As a result, monitoring of inclusion tags is off by default, with the preferred approach being that specific inclusion tags of interest be individually enabled through the agent configuration file.

    To enable monitoring of specific inclusion tags, a new section called import-hook:django should be added to the agent configuration:

    [import-hook:django]
    instrumentation.templates.inclusion_tag = prepopulated_fields_js date_hierarchy

    The instrumentation.templates.inclusion_tag setting within that section should then be set to a space separated list of the names of the inclusion tags to monitor. If there is any confusion over the identity of the inclusion tag, the full name of the inclusion tag function, with module name, can instead be listed. For example, data_hierarchy can also be identified using django.contrib.admin.templatetags.admin_list:date_hierarchy.

    In addition to specifying the names of the specific inclusion tags, it is also possible to specify * for instrumentation.templates.inclusion_tag in order to have usage of all inclusion tags be monitored:

    [import-hook:django]
    instrumentation.templates.inclusion_tag = *

    Enabling monitoring of all inclusion tags in this way is only recommended in development or test environments so as to get an initial idea of what inclusion tags are worth tracking. Once identified, the specific inclusion tags of interest should thereafter be listed individually in a production environment.

  • Better monitoring of Django management commands

    We previously published a blog post about how the agent could be used to monitor Django management commands. This required you to manually set up the instrumentation for each specific Django management command in the agent configuration file. We have now made that easier by integrating the functionality as part of the agent itself.

    Due to the limitations on what Django management commands can be monitored, you will still need to list explicitly the commands you want monitored, but it can now be done in a single location as a space separated list under the setting instrumentation.scripts.django_admin of the import-hook:django section:

    [import-hook:django] 
    instrumentation.scripts.django_admin = syncdb sqlflush
    

    By default, we automatically specify the startup timeout to be 10.0 seconds when monitoring the Django management commands. If you need to override the startup timeout, you can set the instrumentation.background_task.startup_timeout setting within the same import-hook:django configuration section.

Pages