Dynatrace provides a powerful SDK that can be used to achieve code level visibility and transaction tracing for applications written in multiple languages, including python. This project provides a library called autodynatrace, which is a wrapper around the OneAgent SDK for Python and allows you to instrument python applications with minimal code changes.
pip install autodynatrace
Add the environment variable AUTOWRAPT_BOOTSTRAP=autodynatrace
to your python processes
For most technologies, just import it in your code.
import autodynatrace
- aiohttp (client)
- celery
- concurrent.futures
- confluent_kafka
- cx_Oracle
- django
- fastapi
- flask
- grpc
- paramiko
- pika (RabbitMQ)
- psycopg2
- pymongo
- pysnmp
- redis
- ruxit (Dynatrace plugin framework)
- sqlalchemy
- subprocess
- suds
- starlette
- tornado
- urllib
- urllib3
- custom annotations
For Django, add "autodynatrace.wrappers.django"
to INSTALLED_APPS
AUTODYNATRACE_CAPTURE_HEADERS
: Default:False
, set toTrue
to capture request headersAUTODYNATRACE_LOG_LEVEL
: DefaultWARNING
AUTODYNATRACE_FORKABLE
: DefaultFalse
, set toTrue
to instrument forked processes. Use this for gunicorn/uwsgiAUTODYNATRACE_VIRTUAL_HOST
: Overwrite the default Virtual Host for web frameworksAUTODYNATRACE_APPLICATION_ID
: Overwrite the default Application Name for web frameworksAUTODYNATRACE_CONTEXT_ROOT
: Overwrite the default Context Root for web frameworksAUTODYNATRACE_CUSTOM_SERVICE_NAME
: Overwrite the custom service name (used by@autodynatrace.trace
)AUTODYNATRACE_CUSTOM_SERVICE_USE_FQN
: DefaultFalse
, set toTrue
to use fully qualified names for service and method names in custom traced servicesAUTODYNATRACE_INSTRUMENT_<LIB_NAME>
: If set toFalse
, Disables the instrumentation for a specific lib, example:AUTODYNATRACE_INSTRUMENT_CONCURRENT=False
, default isTrue