Importante
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 includes fixes related to tracking of external web service calls and minor improvements to automatic real user monitoring HTML insertion for Django. An offline developer mode has also be added to verify the operation of the agent with your application in a development or test environment.
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 our online help article on the status of the Python agent.
New Features
An offline developer mode for the agent now exists to allow for verification that the operation of the agent will not affect the monitored web application in a development or test environment, without sending any actual data to New Relic. As it is an offline mode, no additional hosts will be recorded against your New Relic account for billing purposes.
The offline mode does not allow for any viewing of collected metric information and other data for the purposes of monitoring your application, so it is not a solution for running New Relic locally. Being able to run it however, will allow you determine if a newer version of the agent, or an upgrade of any third party package in conjunction with the agent, will still function correctly before you jump to upgrading the packages in your production environment.
The offline developer mode can be enabled by setting the
developer_mode
setting in the agent configuration file, or theNEW_RELIC_DEVELOPER_MODE
environment variable, totrue
.Audit logging can also be enabled in conjunction with the offline developer mode so as to allow for the investigation of what data would be set to New Relic, resulting from the monitoring of your application, without actually sending any data to New Relic.
Audit logging itself can be enabled by setting the the
audit_log_file
setting in the agent configuration file, or theNEW_RELIC_AUDIT_LOG
environment variable. It is not recommended that audit logging be enabled for any extended period as the resulting log file will be quite large.
Bug fixes/Improvements
- When using the Bottle web framework, the setting
error_collector.ignore_status_codes
, for ignoring exceptions linked to specific HTTP response status codes, was being ignored in the case of using Bottle plugins and a plugin raised aHTTPError
exception. This only affected Bottle versions 0.11 or higher. - The New Relic feature for cross application tracing between two monitored web applications was not working when a Python web application was using recent versions of the
urllib3
andrequests
modules for initiating the call to the backend web application service. This affected version 1.8 or higher ofurllib3
and version 2.3.0 of therequests
module. - External web service calls were not being monitored when using the prepared requests feature of the
requests
module directly. - When using the
urllib
orurllib2
modules, if a URI of the formfile://...
, corresponding to a local file on the file system, was passed to any function monitored by our instrumentation, a metric and transaction trace node were being generated corresponding to an external web service with host name of 'unknown'. The instrumentation now correctly filters out URIs which do not correspond to an actual remote web service. - The automatic means for inserting page load timing tracking code for real user monitoring (RUM) into HTML page responses returned from a Django application now works no matter the case used for HTML elements. Previously automatic insertion would only be performed where HTML elements were lower case.
- RUM tracking code inserted automatically into HTML page responses from Django is now more optimally placed when a
X-UA-Compatible
meta tag appeared in thehead
element of the HTML page. Previously the RUM code was placed at the end of thehead
element when such a meta tag existed. This would have meant that page loading times would not have accurately reflected time spent in loading assets from anyscript
elements appear after the meta tag. The RUM code is now placed immediately after the meta tag. Placement is not done before the meta tag as some browsers require that the meta tag appear prior to anyscript
elements. - RUM tracking code inserted automatucally into HTML page responses from Django is now placed after any
Content-Type
meta tag which also contains acharset
attribute. This is necessary as some browsers will not recognise such a meta tag if it does not occur early in the page content. If ascript
tag was therefore placed before this meta tag it could have resulted in the meta tag being pushed down sufficiently far enough in the page content so as not to be recognised. - Data corresponding to a long running transaction monitored by the agent, which spanned the time when a server side configuration change was made in the New Relic UI, will now be discarded. This is to avoid a problem where the response time average for web requests on the overview chart would be skewed so as to appear greater at the time a server side configuration change was made. This problem would result as when such a server side configuration change is made, the agent will momentarily disconnect and reregister. In that time, any short lived transactions would not be monitored, but the long running transaction which only completed after registration occurred was incorrecly being recorded, with an undue effect on average response times.
Importante
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 is a hot fix release to address an issue introduced in version 2.22.0.19 when applying additional function traces from the agent configuration.
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 our online help article on the status of the Python agent.
Bug fixes:
- When using the
transaction_tracer.function_trace
setting in the agent configuration file to apply additional function traces, the trace was not being applied and a message indicating an instrumentation error would appear in the Python agent log file. The error in itself would not have prevented the agent from starting and running, but no data would be collected for the designated functions as intended.
Importante
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 introduces a means to enforce High-security mode from the agent configuration, as well as enabling capture of Insights events for 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 our online help article on the status of the Python agent.
New Features:
- Insights events are now also recorded for background tasks, in addition to the existing events already captured for web transactions.
- The application to record an exception against can now be explicitly provided using the keyword argument
application
when callingnewrelic.agent.record_exception()
. This enables the ability to record exceptions outside of the context of a monitored web transaction or background task. A suitable application object can be retrieved usingnewrelic.agent.application()
.
Features Changed:
Enforcing High-security mode from the agent configuration is now supported.
High-security mode is a feature to prevent any sensitive data from being sent to New Relic. The local setting for the agent must match the server setting in the New Relic APM UI. If there is a mismatch, the agent will log a message and act as if it is disabled. A link to the docs for High-security mode can be found here
Attributes of high-security mode (when enabled):
- Requires an SSL connection to be used.
- Prevents capture of request parameters.
- Suppresses capture of custom parameters.
The default setting for High-security mode is
false
.If you already have high-security mode enabled within the New Relic APM UI, you will need to add:
high_security = trueto your local agent configuration file.
Or if using Heroku, set the
NEW_RELIC_HIGH_SECURITY
environment variable by running:heroku config:set NEW_RELIC_HIGH_SECURITY=trueWhen using the gunicorn WSGI server, the request URL which appears in transaction trace samples and error details will now be sourced from the
RAW_URI
variable passed by gunicorn in the WSGIenviron
dictionary. This will ensure that what is displayed is the raw URL before%
escape sequences have been decoded. This avoids the problem of the URL being shown as a raw byte sequence.When audit logging is enabled, the responses returned from our data collector service will now also be logged.
Bug fixes/Improvements:
- An incorrect module name was being derived for methods of classes, when used in web transaction and function trace naming, where the method was from a base class defined in a different module, but invoked via a derived class.
- When using Django class based views, if a class based view was used explicitly from within a view handler, the name of the class based view method was overriding the web transaction name, which at that point would have been set to the view handler. The class based view method name will now only be used for the web transaction name when it is actually registered as the view handler.
- Explain plans for SQL queries were not working when the SQL database cursor had been configured to return a dictionary rather than a tuple for each row set when the original query was made.
Importante
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 addresses a bug which in some cases caused database connection parameters, which could include login credentials, to be logged to the local system by the monitored application if Python agent debug logging is being captured.
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 our online help article on the status of the Python agent.
Bugs Fixed
When Python agent debug logging was enabled by setting
log_level
todebug
in the Python agent configuration, database connection details, including login credentials could be logged in the local Python agent log file.The details may also have been logged even if
log_level
had not been set todebug
, but the Python logging module had been configured to collect and log messages logged at the log level oflogging.DEBUG
.This issue was introduced in version 2.20.0.17 of the Python agent.
Importante
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 various improvements to database client module instrumentation and execution of explain plans.
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 our online help article on the status of the Python agent.
New Features
- Added a 'license-info' command to the 'newrelic-admin' script for displaying the LICENSE file for the 'newrelic' package.
Bug fixes/Improvements:
- The bottle instrumentation was causing a secondary exception when a web request was not actually being monitored and an un-handled exception occurred in the web request.
- Added support for accepting additional arguments to the execute() method of database cursors implemented by the oursql and cx_Oracle modules which are not covered by the Python DBAPI 2 (PEP 249) specification.
- The time taken for connect() calls of database client modules will now be counted in Database time (on the APM Overview page).
- The automatic rollback or commit performed on exit of the context manager for a database connection was not being monitored and reported when using the psycopg2, psycopg2cffi and postgresql database client modules for the PostgreSQL database.
- Improved how database connections are managed when performing explain plans and also applied caps to the number of process wide explain plans that are done in each reporting period. This should have the result of reducing overhead in situations where there was a large number of candidate SQL statements on which to perform explain plans. Any additional overhead from the agent in the past would have been most notable when performing an X-Ray session against a key transaction.
Importante
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 improved audit logging functionality and an admin script sub command for recording deployments.
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 our online help article on the status of the Python agent.
New Features
- Record Deployments: A new 'record-deploy' sub command has been added to the 'newrelic-admin' script installed with the Python agent. This is a wrapper around the HTTP API provided by New Relic for recording deployments against your application. To use the sub command, add your API-KEY in the agent configuration file under the 'api_key' setting. The path to the config file, description for the deploy and optional revision, change log and user information can then be supplied as arguments to the sub command.
- Audit Logging: An improved audit logging feature has been added to the agent for capturing details of what is being sent up to our data collectors. Information is now captured into a separate log file in a more human-readable format to aid any review process carried out to determine what the agent is sending. The audit logging feature can be enabled by setting the the 'audit_log_file' setting in the agent configuration file, or the 'NEW_RELIC_AUDIT_LOG' environment variable. It is not recommended that audit logging be enabled for any extended period as the resulting log file will be quite large.
Bug fixes/Improvements:
- The agent now ensures that the certificate bundle packaged with the agent is always used when certifying SSL connections back to our data collector. Previously the location of the certificate bundle could be overridden by a number of environment variables. This could cause SSL connection failures when the referenced certificate bundle didn't exist or had incorrect permissions and could not be accessed.
Importante
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 obfuscation of explain plans as the default when using PostgreSQL, as well as including bug fixes related to the instrumentation for some MySQL database client modules.
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 our online help article on the status of the Python agent.
Bug fixes/Improvements:
- Fixes an agent bug with PostgreSQL where parameters from the original query could appear in explain plans sent to New Relic servers, even when SQL obfuscation was enabled. Parameters from the query are now masked in explain plans prior to transmission when transaction_tracer.record_sql is set to 'obfuscated' (the default setting).
- The automatic rollback or commit performed on exit of the context manager for a database connection was not being monitored and reported when using the MySQLdb, pymysql and oursql database client modules for the MySQL database.
Importante
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 Cornice REST component library for the Pyramid web framework, as well as a number of minor feature improvements and bug fixes.
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 our online help article on the status of the Python agent.
New Features:
- Instrumentation added for the Cornice REST component library for the Pyramid web framework.
Bug fixes/Improvements:
- Enhance the instrumentation for the Bottle web framework to work around the problem that the Bottle framework was not using 'functools.wraps()' correctly in the implementation of its 'auth_basic()' decorator. This was resulting in the web transaction being named after the 'wrapper' function closure used in the implementation of the decorator rather than the wrapped request handler the decorator was applied to. A pull request was made against the Bottle framework and the change will be included in a future version of Bottle. Our change ensures that the correct result is also obtained with older Bottle versions.
- When using the database connection object created by the sqlite3 database client module as a context manager, the automatic rollback or commit performed by the context manager when the scope of the context manager is exited, will now be tracked.
- If a function trace was applied to the bound method of a class implemented in a C extension module, the name of the module shown in the name of the function was being wrongly designated as the Python 'builtins' module.
- Updated memcache instrumentation wrappers to use our latest function wrapper implementation. Our latest function wrappers better preserve the ability to introspect wrapped functions/methods and so return the same result as one would expect if no wrapper had been applied.
Importante
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 includes improved instrumentation for the Bottle framework and new instrumentation support for gevent WSGI servers. It also allows reporting of data to multiple applications in New Relic to be specified via an environment variable, in addition to the existing 'app_name' setting in the agent configuration file.
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 our online help article on the status of the Python agent.
New Features:
- Provide automatic instrumentation of the WSGI application entry point when using the 'gevent.wsgi' and 'gevent.pywsgi' servers. This means that if you are not using a web framework we already support and instrument, are using a WSGI component library, or implementing your WSGI application from scratch, it is no longer necessary to wrap the WSGI application entry point with our special decorator or wrappers when using the gevent WSGI servers.
Features Changed:
- Previously it was only possible to list multiple applications in New Relic to report data to via the 'app_name' setting in the agent configuration file. Attempting to list multiple application names (separated by the requisite semi colon), in the 'NEW_RELIC_APP_NAME' environment variable was ignored with the complete value (including semi colons), being used as the application name. This limitation has now been lifted and a list of applications to report to can now be specified using the 'NEW_RELIC_APP_NAME' environment variable.
Bug fixes/Improvements:
- The instrumentation for the Bottle web framework has been improved. The changes include the request handler now being broken out properly as a separate item in the transaction breakdown, the web transaction being named after an error handler when appropriate and requests which could not be mapped to a request handler being named as being a 404 if no error handler was provided. Handling of exceptions for HTTP errors has also been improved and are now being correctly matched against our internal list of HTTP status codes to be ignored as exceptions. Previously the instrumentation was too liberally ignoring all HTTP error exceptions.
- When using the Flask web framework, a NotFound exception raised within the underlying Werkzeug library was not being ignored. It is now no longer necessary to explicitly ignore the exception type 'werkzeug.exceptions:NotFound' in the agent configuration.
- When an unhanded exception was raised by a Pylons application, a bug in the implementation of the agent's error trace wrappers would cause a subsequent exception to be raised from the agent itself, masking the details of the original exception.
- When trying to determine how much memory was available on a system, the agent would fallback to trying to the use the 'psutil' module, if installed, if our standard ways of checking failed. This would cause the agent to fail on a PaaS such as PythonAnyWhere, which prohibits access to the /proc filesystem. Use of 'psutil' as a fallback has now been removed to avoid any potential for a failure.
- The version of the bundled 'requests' module the agent used to perform HTTP requests to our data collector did not work with Python 2.6.2 or older. A fix to 'urllib3' used by the 'requests' module has been back ported to address the issue.
- Our updated database instrumentation wrappers released in the last agent version, would incorrectly return that a database connection or cursor object were callable. This could confuse code which was trying to introspect those objects to perform traversal in order to get access to inner details of the implementation of the database modules.
Importante
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 is a hot fix version to address an issue related to cross process application traces introduced in 2.10.0.8.
The agent can be installed using easy_install/pip/distribute via the Python Package Index or can be downloaded directory from our download site.
For a list of known issues with the Python agent see our online help article on the status of the Python agent.
Bug fixes/Improvements:
- The value of headers inserted into the HTTP response returned from the WSGI application to support cross process application tracing were being incorrectly passed as Unicode strings on Python 2. This would cause a strictly compliant WSGI server such as Apache/mod_wsgi or uWSGI to raise an error when the headers were being set. In general, pure Python WSGI servers are not as strict in their WSGI compliance and would have silently accepted the value anyway, converting it to a byte string using the Python system default encoding.