• /
  • EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

Python agent v5.0.0.124

August 6, 2019Download

Notes

This release of the Python agent introduces:

  • Event loop diagnostics feature
  • Tornado instrumentation for versions 6 or higher
  • Improved context manager API functionality and interfaces

This release also drops support for Python 3.4.

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.

Event loop diagnostics

Introducing event loop diagnostics for asyncio! The Python agent can now surface information about transactions that block the event loop. The agent will be able to generate information about transactions that have waited a significant amount of time to acquire control of the event loop.

Event loop diagnostic information will be available in both APM and via NRQL query.

Event loop metrics will appear in the transaction Breakdown table:

Image of breakdown UI page

Time spent waiting on other transactions will be shown in the transaction Trace details page, as shown here:

Image of breakdown UI page

eventLoopTime and eventLoopWait attributes will be available via NRQL query. An example query might be:
SELECT count(*) as 'count', average(eventLoopTime) as 'loopTime', average(eventLoopWait) as 'loopWait' FROM Transaction facet name

In New Relic Insights, this might show a result like this:

Image of breakdown UI page

Diagnostics will be available by default through our existing aiohttp, sanic, and Tornado instrumentation. Diagnostic information will also be available for coroutines that use our background_task and web_transaction decorator APIs.

Tornado 6 Instrumentation

Instrumentation for Tornado framework version 6.x is supported without any feature flags. Support for versions earlier than Tornado 6.x has been dropped. The Tornado web server, framework, and http client are instrumented and information will show up in both APM and insights.

Important: Using the tornado.gen.coroutine with instrumentation is not supported. Any usage of tornado.gen.coroutine should be replaced with an asyncio coroutine.

Before

class MainHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def get(self):
yield gen.sleep(0.2)

After

class MainHandler(tornado.web.RequestHandler):
@asyncio.coroutine
def get(self):
yield from gen.sleep(0.2)

Improved APIs for time trace context managers

Context managers (such as FunctionTrace, ExternalTrace, DatastoreTrace) may now be used from within asyncio coroutines! Additionally, the transaction argument is no longer used for any context manager API. In order to transition to the new API, the transaction argument must be removed.

Before

transaction = newrelic.agent.current_transaction()
with newrelic.agent.FunctionTrace(transaction, "my_trace"):
pass

After

with newrelic.agent.FunctionTrace("my_trace"):
pass

Updated WebTransaction context manager

The WebTransaction context manager is no longer WSGI dependent. The context manager takes generic HTTP arguments, which you can use to build web transactions that appear in the APM product. For more information, see our API documentation.

Copyright © 2024 New Relic Inc.

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