Skip to content

Instantly share code, notes, and snippets.

@tatey
Created November 28, 2019 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatey/cb0a94f2bac162538301ea6a19326fb4 to your computer and use it in GitHub Desktop.
Save tatey/cb0a94f2bac162538301ea6a19326fb4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Datadog bills by the number of unique hosts that were used in the month and
# every time we launch a one off dyno it results in a new
# host (e.g. run.4030404). This script is executed when the dyno launches and
# determines whether the agent should be running to reduce the number of
# unique hosts that we are billed for.
# Disable the Datadog Agent for one-off runs (e.g. console, release).
if [ "$DYNOTYPE" == "run" ] || [ "$DYNOTYPE" == "release" ]; then
echo "[Datadog Prerun] Disabling agent because this is a one-off dyno"
DISABLE_DATADOG_AGENT="true"
fi
# Disable APM reporting on non-web dynos.
if [ "$DYNOTYPE" != "web" ]; then
echo "[Datadog Prerun] Disabling APM because this is not a web dyno"
DD_APM_ENABLED="false"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment