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.
For a list of known issues with the Python agent see Status of the Python agent.
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
@after_requestfunctions will now be broken out as their own metrics. If a
@before_requestfunction 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
pymssqldatabase client module to monitor database calls made against a Microsoft SQL Server database.
- When using high security mode, the use of
newrelic.capture_request_paramsin the per request WSGI environ to enable capture of request parameters, possibly by setting it using the
SetEnvdirective when using Apache/mod_wsgi, was not being overridden and disabled as required.
- When using the
DatabaseTracecontext manager or associated wrappers explicitly to implement a custom monitoring mechanism for database calls, the instrumentation wrappers could fail with a
TypeErrorexception when trying to internally derive the name of the database product being used.