Skip to content

Instantly share code, notes, and snippets.

@zunda
Last active November 12, 2017 01:55
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 zunda/6423a290312832c2d2de17c884e9d2eb to your computer and use it in GitHub Desktop.
Save zunda/6423a290312832c2d2de17c884e9d2eb to your computer and use it in GitHub Desktop.
HerokuのMastodonでstatsdを使ってみる

https://github.com/DataDog/heroku-buildpack-datadog

$ heroku buildpacks:add --index 2 https://github.com/DataDog/heroku-buildpack-datadog.git -a zundan-mastodon-experiment
Buildpack added. Next release on zundan-mastodon-experiment will use:
  1. heroku/metrics
  2. https://github.com/DataDog/heroku-buildpack-datadog.git
  3. https://github.com/heroku/heroku-buildpack-apt
  4. heroku/nodejs
  5. heroku/ruby
Run git push heroku master to create a new release using these buildpacks.

デプロイして、

$ heroku config:set DD_HOSTNAME=zundan-mastodon \
DD_API_KEY=<DataDogのAPI Key> \
DD_APM_ENABLED=true -a zundan-mastodon
$ heroku pipelines:promote -a zundan-mastodon-experiment
$ heroku logs -t -a zundan-mastodon
  :
2017-11-12T01:23:40.661664+00:00 app[web.1]: 2017-11-12 01:23:40,661 | INFO | dd.dogstatsd | utils.pidfile(pidfile.py:35) | Pid file is: /app/.apt/opt/datadog-agent/run/dogstatsd.pid
2017-11-12T01:23:40.662044+00:00 app[web.1]: 2017-11-12 01:23:40,661 | INFO | dd.dogstatsd | daemon(daemon.py:233) | Starting
  :

これでDataDogに何か送られるようになったようだ。Hostがあるとは表示される。メトリクスは見られない。

The Datadog agent provides a listening port on 8125 for statsd/dogstatsd metrics and events. Traces are collected on port 8126 (older Datadog tracing libraries may use port 7777).

このあとどうすればいいのだ。

config/initializers/statsd.rbがもう存在するね。

heroku config:set STATSD_ADDR=localhost:8125 -a zundan-mastodon

これでなんだかたっくさんのメトリクスがDataDogに来るようになったみたい。どれを見るべきかわからなーい。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment