All Projects → apiaryio → heroku-datadog-drain-golang

apiaryio / heroku-datadog-drain-golang

Licence: MIT license
Funnel metrics from multiple Heroku apps into DataDog using statsd.

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to heroku-datadog-drain-golang

Java Dogstatsd Client
a java statsd client library
Stars: ✭ 140 (+311.76%)
Mutual labels:  statsd, datadog
dog-statsd
🐶 DataDog StatsD Client
Stars: ✭ 38 (+11.76%)
Mutual labels:  statsd, datadog
Datadog Go
go dogstatsd client library for datadog
Stars: ✭ 238 (+600%)
Mutual labels:  statsd, datadog
Graylog Plugin Metrics Reporter
Graylog Metrics Reporter Plugins
Stars: ✭ 71 (+108.82%)
Mutual labels:  statsd, datadog
statsd.cr
A statsd client library for Crystal.
Stars: ✭ 32 (-5.88%)
Mutual labels:  statsd, datadog
five-minute-midas
Predicting Profitable Day Trading Positions using Decision Tree Classifiers. scikit-learn | Flask | SQLite3 | pandas | MLflow | Heroku | Streamlit
Stars: ✭ 41 (+20.59%)
Mutual labels:  heroku
keycloak-heroku
Deploy Keycloak to Heroku using a slightly adapted version of the official docker image
Stars: ✭ 47 (+38.24%)
Mutual labels:  heroku
heroku-flask-template
A simple, fast and easy-to-deploy Heroku ready flask web app template written in Python.
Stars: ✭ 26 (-23.53%)
Mutual labels:  heroku
haikunatorjava
Generate Heroku-like random names to use in your Java applications
Stars: ✭ 27 (-20.59%)
Mutual labels:  heroku
link-preview-api
Backed to provide information for link-prevue vue component
Stars: ✭ 31 (-8.82%)
Mutual labels:  heroku
craft-heroku
🍄 Craft 3, ready for continuous deployment to Heroku.
Stars: ✭ 16 (-52.94%)
Mutual labels:  heroku
TgTwitterStreamer
Continous Integration from Twitter to Telegram.
Stars: ✭ 55 (+61.76%)
Mutual labels:  heroku
SPaaS
A Simple-PaaS similar to Heroku
Stars: ✭ 18 (-47.06%)
Mutual labels:  heroku
phoenix example
An example Phoenix app with one-click deployments to different cloud services.
Stars: ✭ 62 (+82.35%)
Mutual labels:  heroku
books-store
A Simple Web application to use flask python web framework.
Stars: ✭ 23 (-32.35%)
Mutual labels:  heroku
PglRobot
No description or website provided.
Stars: ✭ 12 (-64.71%)
Mutual labels:  heroku
heroku-buildpack-tex
A Heroku buildpack to run TeX Live inside a dyno.
Stars: ✭ 18 (-47.06%)
Mutual labels:  heroku
middleman-startae
A starter template ready to run on Netlify or Heroku. Comes with several helpers, partials and a nice basic structure to the HTML, Sass, Webpack and ES2015. Bottom line, a template that uses all the modern tools.
Stars: ✭ 43 (+26.47%)
Mutual labels:  heroku
WordNook
Dynamically updating blogging website to upload articles and blog posts on various topics, developed using ejs template engine and node js in the backend.
Stars: ✭ 80 (+135.29%)
Mutual labels:  heroku
Marketplace-App
Find Spelling errors in files within PRs
Stars: ✭ 47 (+38.24%)
Mutual labels:  heroku

Build Status

Heroku Datadog Drain

Golang version of NodeJS

Funnel metrics from multiple Heroku apps into Datadog using statsd.

Supported Heroku metrics:

  • Heroku Router response times, status codes, etc.
  • Application errors
  • Custom metrics
  • Heroku Dyno runtime metrics
  • Heroku Redis Metrics
  • (beta) Heroku Runtime Language Metrics - we add support for golang used in Heroku, next step add this to send to Datadog too for self monitoring app.

Get Started

Clone the Github repository

git clone [email protected]:apiaryio/heroku-datadog-drain-golang.git
cd heroku-datadog-drain-golang

Setup Heroku, specify the app(s) you'll be monitoring and create a password for each.

heroku create
heroku config:set ALLOWED_APPS=<your-app-slug> <YOUR-APP-SLUG>_PASSWORD=<password>

OPTIONAL: Setup Heroku build packs, including the Datadog buildpack with Agent V6. If you already have a StatsD client running, see the STATSD_URL configuration option below.

heroku buildpacks:add heroku/go
heroku buildpacks:add --index 1 https://github.com/DataDog/heroku-buildpack-datadog.git
heroku config:set HEROKU_APP_NAME=$(heroku apps:info|grep ===|cut -d' ' -f2)

heroku config:add DD_API_KEY=<your-Datadog-API-key>

DANGER: Original miketheman heroku-buildpack-datadog project is deprecated and datadog have own buildpack that isn't backward compatible. You have change DATADOG_API_KEY to DD_API_KEY during upgrade

Don't forget set right golang version.

heroku config:set GOVERSION=go1.12

You can use specific settings for Go modules

Deploy to Heroku.

git push heroku master
heroku ps:scale web=1

Add the Heroku log drain using the app slug and password created above.

heroku drains:add https://<your-app-slug>:<password>@<this-log-drain-app-slug>.herokuapp.com/ --app <your-app-slug>

Configuration

STATSD_URL=..             # Required. Set to: localhost:8125
DD_API_KEY=...            # Required. Datadog API Key - https://app.datadoghq.com/account/settings#api
ALLOWED_APPS=my-app,..    # Required. Comma seperated list of app names
<APP-NAME>_PASSWORD=..    # Required. One per allowed app where <APP-NAME> corresponds to an app name from ALLOWED_APPS
<APP-NAME>_TAGS=mytag,..  # Optional. Comma seperated list of default tags for each app
<APP-NAME>_PREFIX=..      # Optional. String to be prepended to all metrics from a given app
DATADOG_DRAIN_DEBUG=..    # Optional. If DEBUG is set, a lot of stuff will be logged :)
EXCLUDED_TAGS: path,host  # Optional. Recommended to solve problem with tags limit (1000)

Note that the capitalized <APP-NAME> and <YOUR-APP-SLUG> appearing above indicate that your application name and slug should also be in full caps. For example, to set the password for an application named my-app, you would need to specify heroku config:set ALLOWED_APPS=my-app MY-APP_PASSWORD=example_password

The rationale for EXCLUDED_TAGS is that the path= tag in Heroku logs includes the full HTTP path - including, for instance, query parameters. This makes very easy to swarm Datadog with numerous distinct tag/value pairs; and Datadog has a hard limit of 1000 such distinct pairs. When the limit is breached, they blacklist the entire metric.

Heroku settings

You need use Standard dynos and better and enable log-runtime-metrics in heroku labs for every application.

heroku labs:enable log-runtime-metrics -a APP_NAME

This adds basic metrics (cpu, memory etc.) into logs.

Custom Metrics

If you want to log some custom metrics just format the log line like following:

app web.1 - info: responseLogger: metric#tag#route=/parser metric#request_id=11747467-f4ce-4b06-8c99-92be968a02e3 metric#request_length=541 metric#response_length=5163 metric#parser_time=5ms metric#eventLoop.count=606 metric#eventLoop.avg_ms=515.503300330033 metric#eventLoop.p50_ms=0.8805309734513275 metric#eventLoop.p95_ms=3457.206896551724 metric#eventLoop.p99_ms=3457.206896551724 metric#eventLoop.max_ms=5008

We support:

  • metric# and sample# for gauges
  • metric#tag for tags.
  • count# for counter increments
  • measure# for histograms

more info here

Overriding prefix and tags with drain query params

To change the prefix use the drain of form: https://<your-app-slug>:<password>@<this-log-drain-app-slug>.herokuapp.com?prefix=abcd.

To change tags use the drain of form: https://<your-app-slug>:<password>@<this-log-drain-app-slug>.herokuapp.com?tags=xyz,abcd

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].