Network Performance Monitoring is now generally available! Network Monitoring is now available!


Library Library


The Python integration allows you to monitor custom metrics by adding a few lines of code to your Python application. For example, a metric that returns the number of page views or the time of any function call.


Datadog offers a library to assist you with the implementation of Python application metrics. Learn more about the library on GitHub.


To install the Datadog Python library from pip:

pip install datadog

Metric Collection

For the Python integration, all metrics are custom metrics. For information on collecting custom metrics see the:

Below is an example of instrumenting your code using the Datadog API:

from datadog import initialize

options = {


# Use Datadog REST API client
from datadog import api

title = "Something big happened!"
text = 'And let me tell you all about it here!'
tags = ['version:1', 'application:web']

api.Event.create(title=title, text=text, tags=tags)

Below is an example of instrumenting your code using the DogStatsD client:

# Use Statsd, a Python client for DogStatsd
from datadog import statsd

statsd.gauge('foo', 42)

Below is an example of instrumenting your code using ThreadStats:

# ThreadStats is an alternative tool to collect and flush metrics,using Datadog REST API
from datadog import ThreadStats
stats = ThreadStats()

Trace collection

See Datadog’s dedicated documentation for Tracing Python Applications.

Log collection

Available for Agent v6.0+

See Datadog’s dedicated documentation for Python log collection.


Need help? Contact Datadog support.

Further Reading

Additional helpful documentation, links, and articles: