Nouvelles annonces sur les technologies sans serveur et réseau ainsi que sur le RUM (Real-User Monitoring) dévoilées à la conférence Dash ! Nouvelles annonces dévoilées à la conférence Dash !

Quickstart Guide - APM

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Overview

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

To install the Datadog Agent on a host, use the one line install command updated with your Datadog API key:

DD_API_KEY=<YOUR_DD_API_KEY> bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"

Validation

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:

apm_config:
  enabled: true
  env: hello_world

Then, restart the Datadog Agent:

sudo service datadog-agent restart

APM application setup

Installation

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

Create

On the Ubuntu VM, create the application hello.py with the following content:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def index():
    return 'hello world'

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5050)

Run

Run hello.py with ddtrace which automatically instruments your application in Datadog:

ddtrace-run python hello.py

You should see a similar output to:

* Serving Flask app "hello" (lazy loading)
  ...
* Running on http://0.0.0.0:5050/ (Press CTRL+C to quit)

Test

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
curl http://0.0.0.0:5050/

This outputs:

hello world

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

Further Reading