Python ASGI Monitoring

The Instana Python package bundles an Asynchronous Server Gateway Interface (ASGI) compliant middleware that provides request visibility into your asynchronous applications.

The ASGI middleware is applied automatically for FastAPI and Starlette based applications. See the related pages for more details.

For more information about ASGI, see the ASGI documentation.

Middleware

The Instana ASGI middleware is available at instana.middleware.InstanaASGIMiddleware and can be used with any ASGI compliant application.

See the open-source code that implements the Instana ASGI middleware on GitHub in the instana/python-sensor repository.

Example

import uvicorn
from instana.middleware import InstanaASGIMiddleware

# ...application definition code...

# Wrap the ASGI application with the Instana ASGI middleware
application = InstanaASGIMiddleware(application)

uvicorn.run(application, host='127.0.0.1', port=80)

Additional information