heroku-buildpack-datadog

by Whitespace

GitHub Readme.md

heroku-buildpack-datadog

This is a fork of @miketheman's heroku-buildpack-datadog and adds support for the Datadog APM agent.

Usage

In order to use the Datadog APM, you will first need to request Beta access.

This buildpack is typically used in conjunction with other languages, so is most useful with language-specific buildpacks - see Heroku Language Buildpacks for more.

Here are some setup commands to add this buildpack to your project, as well as setting the required environment variables:

cd <root of my project>

heroku create # only if this is a new heroku project
heroku buildpacks:add heroku/ruby # or other language-specific build page needed
heroku buildpacks:add --index 1 https://github.com/DataDog/heroku-buildpack-datadog.git
heroku config:set DD_API_KEY=<your API key> # note: older releases called this DATADOG_API_KEY
heroku config:set DD_SERVICE_NAME=<your service name>
heroku config:set DD_SERVICE_ENV=<your service env>
heroku config:set DD_HOSTNAME=<your service name> # optional, defaults to dyno hostname

git push heroku master

You can create/retrieve the DD_API_KEY from your account on this page. API Key, not application key.

Once complete, the Agent's dogstatsd binary and Trace Agent binary will be started automatically with the Dyno startup.

Once started, provides a listening port on 8125 for statsd/dogstatsd metrics and events. Traces are collected on port 7777 by the Trace Agent, then information is forwarded on to the Datadog Agent.

An example using Ruby is here.

Tags

Host tags can be passed via the DD_TAGS environment variable

heroku config:set DD_TAGS=simple-tag-0,tag-key-1:tag-value-1 # to use [simple-tag-0, tag-key-1:tag-value-1] as host tags.

Rails Config

For proper aggregation, you'll want to configure config/initializers/datadog-tracer.rb like so:

Rails.configuration.datadog_trace = {
  default_service: ENV['DD_SERVICE_NAME'] || 'my-app',
}

Todo

Things that have not been tested, tried, figured out.

Contributing

  • Fork this repo
  • Check out the code, create your own branch
  • Make modifications, test heavily. Add tests if you can.
  • Keep commits simple and clear. Show what, but also explain why.
  • Submit a Pull Request from your feature branch to master

Credits

This buildpack was heavily inspired by the heroku-buildpack-apt code, as well as many others from Heroku and @ddollar. We leverage the same type of process runner that the Datadog Docker container uses, with a couple of modifications.

Author: @miketheman

License

MIT License, see LICENSE file for full text.