DataDog/heroku-buildpack-datadog

Name: heroku-buildpack-datadog

Owner: Datadog, Inc.

Description: Heroku Buildpack to run the Datadog Agent in a Dyno

Created: 2016-11-16 18:44:37.0

Updated: 2018-05-24 09:58:45.0

Pushed: 2018-05-21 21:15:13.0

Homepage: https://www.datadoghq.com/

Size: 89

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Datadog Heroku Buildpack

A Heroku buildpack to add Datadog to a Heroku Dyno.

Usage

This buildpack installs the Datadog Agent in your Heroku Dyno to collect system metrics, custom application metrics and traces. To collect custom application metrics or traces, include the language appropriate DogStatsD or Datadog APM library in your application.

Installation

To add this buildpack to your project, as well as set the required environment variables:

root of my project>

 this is a new Heroku project
ku create

d the appropriate language-specific buildpack. For example:
ku buildpacks:add heroku/ruby

able Heroku Labs Dyno Metadata
ku labs:enable runtime-dyno-metadata -a $(heroku apps:info|grep ===|cut -d' ' -f2)

d this buildpack and set your Datadog API key
ku buildpacks:add --index 1 https://github.com/DataDog/heroku-buildpack-datadog.git
ku config:add DD_API_KEY=<your API key>

ploy to Heroku
push heroku master

Once complete, the Datadog Agent is started automatically when each Dyno starts.

The Datadog Agent provides a listening port on 8125 for statsd/dogstatsd metrics and events. Traces are collected on port 8126.

Configuration

In addition to the environment variables shown above, there are a number of others you can set:

| Setting | Description| | — | — | | DD_API_KEY | Required. Your API key is available from the Datadog API integrations page. Note that this is the API key, not the application key. | | DD_HOSTNAME | Deprecated. WARNING: Setting the hostname manually may result in metrics continuity errors. It is recommended that you do not set this variable. Because dyno hosts are ephemeral it is recommended that you monitor based on the tags dynoname or appname. | | DD_DYNO_HOST | Optional. Set to true to use the app and dyno name (e.g. appname.web.1 or appname.run.1234) as the hostname. See the hostname section below for more information. You must enable Heroku Labs Dyno Metadata to use this feature. Defaults to false. | | DD_TAGS | Optional. Sets additional tags provided as a comma-delimited string. For example, heroku config:set DD_TAGS=simple-tag-0,tag-key-1:tag-value-1. The buildpack automatically adds the tags dyno (the dyno name, e.g. web.1), dynohost (the host machine ID, e.g. 33f232db-7fa7-461e-b623-18e60944f44f), and dynotype (the type of dyno, e.g run or web). See the “Guide to tagging” for more information. | | DD_HISTOGRAM_PERCENTILES | Optional. Optionally set additional percentiles for your histogram metrics. See the Histogram percentiles article for more information. | | DISABLE_DATADOG_AGENT | Optional. When set, the Datadog Agent will not be run. | | DD_APM_ENABLED | Optional. The Datadog Trace Agent (APM) is run by default. Set this to false to disable the Trace Agent. | | DD_AGENT_VERSION | Optional. By default, the buildpack installs the latest version of the Datadog Agent available in the package repository. Use this variable to install older versions of the Datadog Agent (note that not all versions of the Agent may be available). | | DD_SERVICE_ENV | Optional. The Datadog Agent automatically tries to identify your environment by searching for a tag in the form env:<environment name>. For more information, see the Datadog Tracing environments page. |

For additional documentation, refer to the Datadog Heroku buildpack documentation and the Datadog Agent documentation.

Hostname

Heroku dynos are ephemeral?they can move to different host machines whenever new code is deployed, configuration changes are made, or resouce needs/availability changes. This makes Heroku flexible and responsive, but can potentially lead to a high number of reported hosts in Datadog. Datadog bills on a per-host basis, and the buildpack default is to report actual hosts, which can lead to higher than expected costs.

Depending on your use case, you may want to set your hostname so that hosts are aggregated and report a lower number. To do this, Set DD_DYNO_HOST to true. This will cause the Agent to report the hostname as the app and dyno name (e.g. appname.web.1 or appname.run.1234) and your host count will closely match your dyno usage. One drawback is that you may see some metrics continuity errors whenever a dyno is cycled.

Contributing

This project is open source (Apache 2 License), which means we're happy for you to fork it, but we'd be even more excited to have you contribute back to it.

Submitting issues
Pull requests

Have you fixed a bug or written a new check and want to share it? Many thanks!

In order to ease/speed up our review, here are some items you can check/improve when submitting your PR:

History

Earlier versions of this project were forked from the miketheman heroku-buildpack-datadog project. It was largely rewritten for Datadog's Agent version 6. Changes and more information can be found in the changelog.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.