autodynatrace is a Python library that provides automatic instrumentation for applications using the Dynatrace OneAgent SDK. It enables monitoring and tracing for various popular frameworks and libraries like Flask, Django, FastAPI, SQLAlchemy, and aiohttp, typically requiring only a single import at the start of an application. The current version is 2.1.1, with releases occurring as new framework versions or features are supported, often focusing on stability and broader compatibility.
pip install autodynatraceVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a minimal Flask application instrumented with autodynatrace. Ensure the `oneagent-sdk` is also installed. The `import autodynatrace` statement must be the first line of your main application file to ensure proper patching. For asyncio applications, an environment variable is required.
Ensure `oneagent-sdk` is installed via `pip install oneagent-sdk` and that your OneAgent is running and configured correctly for your Python environment.
Move `import autodynatrace` to the absolute first line of your main application file, before any other imports or code execution.
Set the environment variable `AUTODYNATRACE_INSTRUMENT_CONCURRENT=True` before starting your application process (e.g., `export AUTODYNATRACE_INSTRUMENT_CONCURRENT=True` or `os.environ['AUTODYNATRACE_INSTRUMENT_CONCURRENT'] = 'True'` early in your script).
Refer to the official autodynatrace GitHub README for the list of currently supported frameworks and their versions. Consider upgrading/downgrading dependencies or implementing manual instrumentation if auto-instrumentation is not feasible.
Install the SDK using pip: `pip install oneagent-sdk`.
Ensure `import autodynatrace` is the absolute first line of code in your main application file. Also, verify that the Dynatrace OneAgent is installed and configured correctly for your environment (e.g., by ensuring the `DT_ONEAGENT_PYTHON_SDK_PATH` environment variable is set or by running your application within a OneAgent-monitored process).
Set the environment variable `AUTODYNATRACE_INSTRUMENT_CONCURRENT=True` before starting your application. For example: `export AUTODYNATRACE_INSTRUMENT_CONCURRENT=True`.