How do I monitor Heroku applications?

Heroku is a cloud Platform as a Service (PaaS) that enables you to build and run applications in the cloud. Applications deployed to Heroku are usually run through one or more buildpacks that provide framework and runtime support.

The following guidelines explain how to enable Dynatrace monitoring for your Heroku applications by adding a Dynatrace Heroku buildpack to your application's Heroku configuration. Note: The Dynatrace Heroku buildpack enables you to monitor all supported languages on Linux systems

What you need

  • Dynatrace environment credentials
  • Heroku CLI

Also, be sure to review the list of supported applications and versions.


These guidelines explain how to integrate Dynatrace OneAgent into your Heroku dynos and begin monitoring your Heroku applications.

Generate a PaaS token

The first step is to get your environment ID and generate a PaaS token for your Dynatrace environment.

Environment ID

  1. Login with your Dynatrace account.

  2. Select Deploy Dynatrace from the navigation menu.

  3. Click the Set up PaaS integration button. Your environment ID appears in the Environment ID text box.

  4. Click Copy to copy the ID to the clipboard. You can do this at any time by revisiting this page.

PaaS Token

The PaaS token is used in combination with your environment ID to download the OneAgent installer. Go to Deploy Dynatrace > Set up PaaS integration to access the InstallerDownload token. For security reasons, it's recommended that you create discrete tokens for different environments.

To generate a new token

  1. Click the Generate new token button.

  2. Type in a meaningful name for your token. A meaningful token name might be the name of the platform you want to monitor (for example, azure, cloud-foundry, or openshift). To view and manage your existing tokens, go to Settings -> Integration -> Platform as a Service.

  3. Click Generate to create the token. The newly created token will appear in the list below.

  4. Click Copy to copy the generated token to the clipboard. You can do this at any time by revisiting this page and clicking Show token next to the relevant PaaS token.

Get the Heroku CLI

To configure Heroku applications to use the Dynatrace Heroku buildpack, you can either use the Heroku CLI or you can configure your applications using the Heroku dashboard.

Add the Dynatrace Heroku buildpack

To integrate Dynatrace OneAgent into your existing application, you need to add the Dynatrace Heroku buildpack to your application's buildpacks and set your Dynatrace environment ID and PaaS token using the commands below.

# Add the Dynatrace buildpack
heroku buildpacks:add

# Set required credentials to your Dynatrace environment
heroku config:set DT_TENANT=<environmentID>
heroku config:set DT_API_TOKEN=<token>

# Set hostname in Dynatrace
heroku config:set DT_HOST_ID=$(heroku apps:info|grep ===|cut -d' ' -f2)

# Deploy to Heroku
git push heroku master

Once you push these changes, the buildpack installs Dynatrace OneAgent to automatically monitor your application.

Additional configuration

The Dynatrace Heroku buildpack supports the following configurations:

Environment variable Description
DT_TENANT Your Dynatrace environment ID
DT_API_TOKEN The PaaS token for integrating your Dynatrace environment with Heroku
DT_HOST_ID The name to be used for the dyno entity in Dynatrace
DT_API_URL (Optional) Replace with your Dynatrace server URL, including the environment ID. For example, https://{}/e/{environmentid}/api
DT_DOWNLOAD_URL (Optional) A direct download URL for Dynatrace OneAgent. If this environment variable is set, the buildpack will download OneAgent from this location
SSL_MODE (Optional) Set to all if you want to accept all self-signed SSL certificates
DT_TAGS (Optional) The tags you want to add to the monitored applications
SKIP_ERRORS (Optional) If set to 1, application deployment won't fail on OneAgent installer download errors

Update OneAgent for Heroku

When a new version of OneAgent becomes available, you need to trigger a re-run of the buildpack in Heroku. The Dynatrace buildpack will automatically fetch the latest version of OneAgent.

If you've specified a default OneAgent install version for new hosts and applications in your OneAgent updates settings, the Heroku buildpack will automatically fetch the defined default version of OneAgent.