Using Datadog's APM

IT WORKS!

Really, in hindsight, the setup was easy: all it requires is a TCP endpoint, and voilà, it finds the Datadog agent in its separate container and sends along the data.

Basic instructions (if you want more detail, just ask):

  1. Create an app for the agent. I set up mine in a separate environment.

  2. Set these ENV variables (your situation may differ):

DD_API_KEY=your-key-here
DD_APM_ENABLED=true
  1. Deploy the datadog agent docker container directly, i.e:
aptible deploy --app <name-of-your-app> --docker-image datadog/agent
  1. Create a tcp endpoint for the dd agent App (no need to specify port):
aptible endpoints:tcp:create  --app <your-app-name> cmd

5a) Add the tracer to your application. For Ruby, I added the ddtrace gem.

5b) Configure the tracer. Our Ruby config is:

# config/initializers/datadog-tracer.rb

options = { 
  service_name: 'up-to-you', 
  env: Rails.env
}

Datadog.configure do |c| 
  c.tracer hostname: 'elb-welld-00000.aptible.in'  #replace with your hostname
  c.use :rails, options 
end 

The first time you run it, it’s helpful to have debug-level logs, so change that c.tracer line to:

c.tracer hostname: 'elb-welld-00000.aptible.in', debug: true

NOTE: Datadog does not offer BAAs right now; I set this up on our qa server.

2 Likes