Deploy OneAgent on Heroku

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.

Installation

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.

API Token

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

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 https://github.com/Dynatrace/heroku-buildpack-dynatrace.git

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

# 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_API_URL (Optional) Replace with your Dynatrace server URL, including the environment ID. For example, https://{your-managed-cluster.com}/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

Note: You can use a different Dynatrace environment for Heroku applications that are enriched with OneAgent.