Notes
This release of the Python agent deprecates the old record_exception API, replaces the error_collector.ignore_errors setting, adds a new notice_error API, adds expected errors functionality, improves the NewRelicContextFormatter, and fixes multiple bugs including a few potential crashes.
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
Deprecated
record_exceptionAPIrecord_exceptionhas been superseded by the newnotice_errorAPI. The old API will forward exceptions tonotice_errorwith a deprecation warning.Deprecated
error_collector.ignore_errorssettingerror_collector.ignore_errorshas been replaced witherror_collector.ignore_classesto match other agents. Please update your config files to use the new setting. The old setting will continue to function with a deprecation warning.
New Features
Added new
notice_errorAPIThis new API falls much more in line with other language agents.
It also includes expected errors functionality and a status code parameter.
To see all changes, view the documentation for this API.
Added new expected errors feature
This feature implements expected errors as documented here. To enable them, use the following new settings.
Improved Features
Improved NewRelicContextFormatter
Adds new
log_record_to_dictfunction to separate logic for JSON serialization and converting to a dictionary, enabling custom formatters to access the data more easily.Custom attributes now attempt JSON serialization by default and fallback to strings, meaning dictionaries and other serializable types are now supported.
Thank you to @chrislawlor and @qvik-olli for your contributions!
error_collector.ignore_status_codesis now configurable in server-side configurationPreviously this setting was only available in the config file, but is now available via server-side configuration.
Bug Fixes
Infinite tracing crash fix
Crashes had occurred in infinite tracing following the inclusion of some startup timeout changes in v6.0.0. These changes have been rolled back.
RuntimeInstrumentationError crash removed
Crashes occurred when a
RuntimeInstrumentationErrorwas reached, indicating a potential problem with existing instrumentation. The exception is now caught and replaced with error level log messages to avoid crashing applications.SQLite instrumentation consumes generator objects passed to
executemanyA generator passed to
Connection.executemanywould unexpectedly be consumed by our instrumentation. This has been corrected and generators are now properly supported.
Known Issues
Flask v2.0.0 support
Flask released a new major version recently that we do not yet support, but expect to in the near future.
Sanic support
Sanic has released large changes to the framework recently that have broken some of our instrumentation on certain versions, and can crash the agent on others. We expect to correct these issues in the near future.