Description

wsgi_application is a Python decorator used to monitor web transactions by instrumenting the WSGI application entry point. New Relic for Python automatically supports most frameworks and servers that use WSGI. If your framework or web server is not supported, you may need to use this API as part of the advanced integration process.

If you cannot use the wsgi_application decorator, you can use one of these other call formats:

The wrapper: The wrapper call is WSGIApplicationWrapper. You can use the wrapper in more than one place for distinct WSGI application components that may be stacked. In that case, the first wrapper encountered marks the start of the transaction and the agent determines the target app based on that first wrapper (and ignores subsequent ones).

The path-based wrapper: The path-based wrapper call is wrap_wsgi_application. Use this if you could not reference the WSGI object as a variable in the instrumentation scope. This takes the same parameters as the decorator with additional module and object_path parameters.

If a string is provided, it must be the exact application name and cannot be a list of application names. For more on generating an application object, see the application method.

The application, even if specified, can still be overridden if newrelic.app_name is defined within the WSGI application per request environ dictionary.

name

string

Optional, rarely used. Sets a transaction name for all requests captured via the WSGI entry point. Generally not used, because you usually would not want all transactions to have the same name (see also Metric grouping issue).

group

string

Optional, rarely used. The group represents the naming structure for the name parameter. Setting this creates a transaction type subcategory. Similar to name, this should be rarely used because you usually do not want the entire application to report as one transaction name or category.

framework

tuple

Optional. A tuple with two strings representing the name of the framework and the version number. For example: ('Flask', '0.12.2')