Datadog Synthetics is now available!

Quickstart Guide - APM


Datadog Application Performance Monitoring (APM) is used to collect traces from your back-end application code. This quickstart guide shows you how get your first trace into Datadog. Follow the sections below:

Create a Datadog account

If you haven’t already, create a Datadog account.

Install the Agent

Before installing the Agent, set up a Vagrant Ubuntu 16.04 virtual machine using the following commands. For more information about Vagrant, see their Getting Started page.

vagrant init ubuntu/xenial64
vagrant up
vagrant ssh

Install the Datadog host Agent using the one line install command updated with your Datadog API key:

DD_API_KEY=<YOUR_DD_API_KEY> bash -c "$(curl -L"


Verify the Agent is running with the status command:

sudo datadog-agent status

After a few minutes, verify the Agent is connected to your account by checking the Infrastructure List in Datadog.

APM Agent setup

Enable APM

On the latest version of Agent v6, APM is enabled by default. You can see this in the Agent configuration file:

# /etc/datadog-agent/datadog.yaml:
# apm_config:
#   Whether or not the APM Agent should run
#   enabled: true

And in trace-agent.log:

# /var/log/datadog/trace-agent.log:
2019-03-25 20:33:18 INFO (run.go:136) - trace-agent running on host ubuntu-xenial
2019-03-25 20:33:18 INFO (api.go:144) - listening for traces at http://localhost:8126
2019-03-25 20:33:28 INFO (api.go:341) - no data received
2019-03-25 20:34:18 INFO (service.go:63) - total number of tracked services: 0

Environment name

(Optional) - Name your environment by updating datadog.yaml to set env under apm_config, for example:

  enabled: true
  env: hello_world

Then, restart the Datadog Agent:

sudo service datadog-agent restart

APM application setup


Before setting up the application, install pip then flask and ddtrace on your Ubuntu VM:

sudo apt-get install python-pip
pip install flask
pip install ddtrace


On the Ubuntu VM, create the application with the following content:

from flask import Flask
app = Flask(__name__)

def index():
    return 'hello world'

if __name__ == '__main__':'', port=5050)


Run with ddtrace which automatically instruments your application in Datadog:

ddtrace-run python

You should see a similar output to:

* Serving Flask app "hello" (lazy loading)
* Running on (Press CTRL+C to quit)


Test your application and send your traces to Datadog using curl. Your application should be running (as shown above). In a separate command prompt run:

vagrant ssh

This outputs:

hello world

After a few minutes, your trace displays in Datadog under the flask service. Check the services page or trace list.

Tracing Services List

Further Reading