Skip to content

Latest commit

 

History

History
62 lines (34 loc) · 1.93 KB

File metadata and controls

62 lines (34 loc) · 1.93 KB
mapped_pages

ASGI Middleware [asgi-middleware]

::::{warning} This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. ::::

Incorporating Elastic APM into your ASGI-based project only requires a few easy steps.

::::{note} Several ASGI frameworks are supported natively. Please check Supported Technologies for more information ::::

Installation [asgi-installation]

Install the Elastic APM agent using pip:

$ pip install elastic-apm

or add elastic-apm to your project’s requirements.txt file.

Setup [asgi-setup]

To set up the agent, you need to initialize it with appropriate settings.

The settings are configured either via environment variables, or as initialization arguments.

You can find a list of all available settings in the Configuration page.

To set up the APM agent, wrap your ASGI app with the ASGITracingMiddleware:

from elasticapm.contrib.asgi import ASGITracingMiddleware

app = MyGenericASGIApp()  # depending on framework

app = ASGITracingMiddleware(app)

Make sure to call elasticapm.set_transaction_name() with an appropriate transaction name in all your routes.

::::{note} Currently, the agent doesn’t support automatic capturing of exceptions. You can follow progress on this issue on Github. ::::

Supported Python versions [supported-python-versions]

A list of supported Python versions can be found on our Supported Technologies page.