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

Python agent v2.28.0.26

August 26, 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 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

    Previously, the Python agent 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.

Copyright © 2024 New Relic Inc.

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