Supported Technologiesedit

The Elastic APM Python Agent comes with support for the following frameworks:

For other frameworks and custom Python code, the agent exposes a set of APIs for integration.

Pythonedit

The following Python versions are supported:

  • 2.7
  • 3.4 (Deprecated)
  • 3.5
  • 3.6
  • 3.7

Python 2.7 will reach End of Life on January 1, 2020. The Elastic APM agent will stop supporting Python 2.7 in the first major version after that date.

Djangoedit

We support these Django versions:

  • 1.11
  • 2.0
  • 2.1
  • 2.2
  • 3.0

For upcoming Django versions, we generally aim to ensure compatibility starting with the first Release Candidate.

we currently don’t support Django running in ASGI mode.

Flaskedit

We support these Flask versions:

  • 0.10 (Deprecated)
  • 0.11 (Deprecated)
  • 0.12 (Deprecated)
  • 1.0
  • 1.1

Aiohttp Serveredit

We support these aiohttp versions:

  • 3.0+

Tornadoedit

We support these tornado versions:

  • 6.0+

Starlette/FastAPIedit

We support these Starlette versions:

  • 0.13.0+

Any FastAPI version which uses a supported Starlette version should also be supported.

Automatic Instrumentationedit

The Python APM agent comes with automatic instrumentation of various 3rd party modules and standard library modules.

Databasesedit

Elasticsearchedit

Instrumented methods:

  • elasticsearch.connection.http_urllib3.Urllib3HttpConnection.perform_request
  • elasticsearch.connection.http_requests.RequestsHttpConnection.perform_request
  • elasticsearch_async.connection.AIOHttpConnection.perform_request

Additionally, the instrumentation wraps the following methods of the Elasticsearch client class:

  • elasticsearch.client.Elasticsearch.delete_by_query
  • elasticsearch.client.Elasticsearch.search
  • elasticsearch.client.Elasticsearch.count
  • elasticsearch.client.Elasticsearch.update

Collected trace data:

  • the query string (if available)
  • the query element from the request body (if available)

We recommend using keyword arguments only with elasticsearch-py, as recommended by the elasticsearch-py docs. If you are using positional arguments, we will be unable to gather the query element from the request body.

SQLiteedit

Instrumented methods:

  • sqlite3.connect
  • sqlite3.dbapi2.connect
  • pysqlite2.dbapi2.connect

The instrumented connect method returns a wrapped connection/cursor which instruments the actual Cursor.execute calls.

Collected trace data:

  • parametrized SQL query

MySQLdbedit

Library: MySQLdb

Instrumented methods:

  • MySQLdb.connect

The instrumented connect method returns a wrapped connection/cursor which instruments the actual Cursor.execute calls.

Collected trace data:

  • parametrized SQL query

mysql-connectoredit

Library: mysql-connector-python

Instrumented methods:

  • mysql.connector.connect

The instrumented connect method returns a wrapped connection/cursor which instruments the actual Cursor.execute calls.

Collected trace data:

  • parametrized SQL query

pymysqledit

Library: pymysql

Instrumented methods:

  • pymysql.connect

The instrumented connect method returns a wrapped connection/cursor which instruments the actual Cursor.execute calls.

Collected trace data:

  • parametrized SQL query

PostgreSQLedit

Library: psycopg2, psycopg2-binary (>=2.7)

Instrumented methods:

  • psycopg2.connect

The instrumented connect method returns a wrapped connection/cursor which instruments the actual Cursor.execute calls.

Collected trace data:

  • parametrized SQL query

aiopgedit

Library: aiopg (>=1.0)

Instrumented methods:

  • aiopg.cursor.Cursor.execute
  • aiopg.cursor.Cursor.callproc

Collected trace data:

  • parametrized SQL query

PyODBCedit

Library: pyodbc, (>=4.0)

Instrumented methods:

  • pyodbc.connect

The instrumented connect method returns a wrapped connection/cursor which instruments the actual Cursor.execute calls.

Collected trace data:

  • parametrized SQL query

MS-SQLedit

Library: pymssql, (>=2.1.0)

Instrumented methods:

  • pymssql.connect

The instrumented connect method returns a wrapped connection/cursor which instruments the actual Cursor.execute calls.

Collected trace data:

  • parametrized SQL query

MongoDBedit

Library: pymongo, >=2.9,<3.8

Instrumented methods:

  • pymongo.collection.Collection.aggregate
  • pymongo.collection.Collection.bulk_write
  • pymongo.collection.Collection.count
  • pymongo.collection.Collection.create_index
  • pymongo.collection.Collection.create_indexes
  • pymongo.collection.Collection.delete_many
  • pymongo.collection.Collection.delete_one
  • pymongo.collection.Collection.distinct
  • pymongo.collection.Collection.drop
  • pymongo.collection.Collection.drop_index
  • pymongo.collection.Collection.drop_indexes
  • pymongo.collection.Collection.ensure_index
  • pymongo.collection.Collection.find_and_modify
  • pymongo.collection.Collection.find_one
  • pymongo.collection.Collection.find_one_and_delete
  • pymongo.collection.Collection.find_one_and_replace
  • pymongo.collection.Collection.find_one_and_update
  • pymongo.collection.Collection.group
  • pymongo.collection.Collection.inline_map_reduce
  • pymongo.collection.Collection.insert
  • pymongo.collection.Collection.insert_many
  • pymongo.collection.Collection.insert_one
  • pymongo.collection.Collection.map_reduce
  • pymongo.collection.Collection.reindex
  • pymongo.collection.Collection.remove
  • pymongo.collection.Collection.rename
  • pymongo.collection.Collection.replace_one
  • pymongo.collection.Collection.save
  • pymongo.collection.Collection.update
  • pymongo.collection.Collection.update_many
  • pymongo.collection.Collection.update_one

Collected trace data:

  • database name
  • method name

Redisedit

Library: redis (>=2.8,<3.2.0)

Instrumented methods:

  • redis.client.Redis.execute_command
  • redis.client.Pipeline.execute

Collected trace data:

  • Redis command name

Cassandraedit

Library: cassandra-driver (>=3.4,<4.0)

Instrumented methods:

  • cassandra.cluster.Session.execute
  • cassandra.cluster.Cluster.connect

Collected trace data:

  • CQL query

External HTTP requestsedit

Standard libraryedit

Library: urllib2 (Python 2) / urllib.request (Python 3)

Instrumented methods:

  • urllib2.AbstractHTTPHandler.do_open / urllib.request.AbstractHTTPHandler.do_open

Collected trace data:

  • HTTP method
  • requested URL

urllib3edit

Library: urllib3

Instrumented methods:

  • urllib3.connectionpool.HTTPConnectionPool.urlopen

Additionally, we instrumented vendored instances of urllib3 in the following libraries:

  • requests
  • botocore

Both libraries have "unvendored" urllib3 in more recent versions, we recommend to use the newest versions.

Collected trace data:

  • HTTP method
  • requested URL

requestsedit

Instrumented methods:

  • requests.sessions.Session.send

Collected trace data:

  • HTTP method
  • requested URL

Servicesedit

AWS Boto3 / Botocoreedit

Library: boto3 (>=1.0)

Instrumented methods:

  • botocore.client.BaseClient._make_api_call

Collected trace data:

  • AWS region (e.g. eu-central-1)
  • AWS service name (e.g. s3)
  • operation name (e.g. ListBuckets)

Template Enginesedit

Django Template Languageedit

Library: Django (see Django for supported versions)

Instrumented methods:

  • django.template.Template.render

Collected trace data:

  • template name

Jinja2edit

Library: jinja2

Instrumented methods:

  • jinja2.Template.render

Collected trace data:

  • template name