Overview

Datadog APM (Application Performance Monitoring) can be configured with Aptible to monitor and analyze the performance of Aptible apps and services in real-time.

Set up

⚠️ Prerequisites: An Aptible account, the Aptible CLI, Git, and a Datadog account

Step 1: Enable tracing in your application code

Follow Datadog’s instructions for running enabling tracing, and preparing the Datadog agent in containers:

Step 2: Deploy the Datadog Agent as an Aptible app

Create an Aptible app to run your Datadog agent in a container, add the necessary configurations, deploy your app, and expose it with an app endpoint.

Notes:

  • You’ll need to update DD_API_KEY=foo in the commands below to reference your actual Datadog API Key.
  • Datadog requires a value to be set for DD_HOSTNAME. The agent doesn’t have the necessary access to detect the hostname so it can be set to the value of your choice.
  • These commands reference v7 of the Datadog Agent, the latest version tested on Aptible.
aptible apps:create datadog-agent
aptible config:set --app datadog-agent DD_API_KEY=foo DD_HOSTNAME=foo
aptible deploy --app datadog-agent --docker-image=datadog/agent:7
aptible endpoints:https:create --app datadog-agent --default-domain cmd

Step 3: Update ENV Variables

Update the ENV for each of your apps for which you enabled tracing in Step 1, so these apps report their instrumentation data to the Datadog Agent app deployed in Step 2.

Notes:

  • You’ll need to update DD_TRACE_AGENT_URL=https://app-42.on-aptible.com to the actual address of the Datadog Agent app endpoint created in Step 2.
  • You’ll need to update --app yourapp to your actual app’s handle.
  • Note that we’re configuring the agent to connect over port 443 instead of 8126. This is because in Step 2, we created an HTTPS endpoint for the Datadog Agent app. Aptible manages the TLS certificate and encryption for that endpoint, ensuring encrypted communication between each of your apps and the Datadog Agent.
  • The DD_TRACE_AGENT_URL ENV variable works automatically for the Java, Python, Ruby, Node.js, PHP, C++ and .Net tracing libraries, but for other libraries, you may need to update the library’s configuration code to explicitly reference this ENV variable. Follow the instructions for your language/framework’s specific tracing library.
aptible config:set DD_TRACE_AGENT_URL=https://app-42.on-aptible.com --app yourapp