• English日本語한국어
  • Log inStart now

Python agent v2.10.0.8

January 17, 2014

Important

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 various improvements and bug fixes related to instrumentation for database client modules, as well as a notable fix to our 'newrelic-admin' script affecting some users who referenced Python virtual environments via a symbolic link.

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 of the WSGI application entry point will now add a new breakdown metric to web transactions corresponding to the finalization of the WSGI request. Within the workings of the interaction between the WSGI server and the WSGI application, this is the point at which the WSGI server will call any close() method on the iterable returned by the WSGI application. The name of this new breakdown metric is 'WSGI/Finalize'. In the case where there was actually a 'close()' method, a further breakdown metric will also appear corresponding to that method.
  • Added support to instrumentation for MySQL and PostgreSQL database client modules for monitoring database queries when the database connection object is used as a context manager. Such context manager features are outside of the scope of the Python DBAPI2 (PEP 249) specification, not all database client modules support it and nor do they all work the same. Although supported, we would suggest consideration should be given to not using these context manager features if you need your code to be portable between databases.
  • Added support to instrumentation for MySQL database client modules for monitoring database queries when the database connection object was created using the Connect() function. The Connect() function falls outside of the scope of the Python DBAPI2 (PEP 249) specification. Although supported, we would suggest consideration should be given to not using this Connect() function if you need your code to be portable between databases.
  • Added database instrumentation support for the mysql-connector-python database client module.
  • Custom parameters for a transaction which are a string or numeric value will now be added to and reported with analytic events reported to our analytics system code named Rubicon. This can be disabled using the agent configuration setting 'analytics_events.capture_attributes'.
  • The capture of custom parameters against a transaction trace can now be disabled using the agent configuration setting 'transaction_tracer.capture_attributes'.
  • The capture of custom parameters against error details can now be disabled using the agent configuration setting 'error_collector.capture_attributes'.

Features Changed:

  • The agent API function add_user_attribute() is now deprecated and functionality merged with the add_custom_parameter() function. The latter function should now be used instead. The display of such parameters in browser traces is now optionally enabled with the agent configuration setting 'browser_monitoring.capture_attributes'.

Bug fixes/Improvements:

  • If the 'newrelic' package was installed into a Python virtual environment, but the 'newrelic-admin' script was executed via a path that traversed a symlink to the virtual environment, the protections within the agent bootstrapping procedure was detecting that the agent was trying to be used with an application running against a different virtual environment when it was actually the same. This would result in the application not being monitored. This issue was introduced in version 2.8.0 of the agent when additional protections were added against mixing application/modules from different Python virtual environments.
  • Explain plans were not being performed on SQL queries made via the executemany() method of a database cursor object. When explain plans are now done, the data inputs from the first row of input data for the executemany() call will be used.
  • When using Python 2, if strings were supplied for the web transaction name, custom parameters, in error details etc, and that string contained a series of characters which could not be decoded as valid UTF-8, then an exception would occur. In the case of a web transaction name, this could result in the exception affecting the current web transaction and result in an error response being sent back to a user. For the case of a transaction trace or error details, the exception would prevent the sending of the captured data up to our data collector and it would be discarded. This was a regression within the agent behaviour introduced when Python 3 support was added to the agent.
  • Fixed instrumentation for sqlite database modules which could result in instrumentation not being applied correctly, and so no database metrics collected, if the sqlite module had been imported prior to the agent being initialized.
  • Limits being applied to the length of the SQL for a slow SQL query when being sent up to our data collector were being applied at the wrong time, resulting in the truncated SQL being used when performing an explain plan. This didn't affect the operation of the web application, but database logs could contain an error about the malformed SQL query.
  • Explain plans could be attempted for an SQL query even where the SQL query failed. Under most circumstances a SQL query would fail immediately and so the duration would fall below the threshold for collecting an explain plan, but the changes now made will protect against a long running SQL query which failed in the database and ensure that no additional problem is caused by issuing an explain plan for it.
  • If a monitored web application is started up using our newrelic-admin wrapper script, and it executes a separate Python script and that Python script used a Python version older than Python 2.6, the script could output the error message "'import site' failed; use -v for traceback". The execution of the script was not affected, but the message obviously could cause concern.
  • The equivalent functions from the 'urllib2' module from Python 2 were not being instrumented when Python 3 was being used. This was missed when Python 3 support was added to the agent.
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.