KomachiHeartbeat
https://hex.pm/packages/komachi_heartbeat
Vital monitoring Elixir Web application.
Slide 15
Slide 15 text
KomachiHeartbeat
The name is originate from a great Rubygems :
https://rubygems.org/gems/komachi_heartbeat
Slide 16
Slide 16 text
Add KomachiHeartbeat.
defmodule Example.Router do
use Plug.Router
plug(:match)
plug(:dispatch)
forward("/ops", to: KomachiHeartbeat)
end
defmodule ExampleWeb.Router do
use ExampleWeb, :router
forward("/ops", KomachiHeartbeat)
end
Slide 17
Slide 17 text
Check it.
% curl http://localhost/ops/heartbeat
heartbeat:ok
Also available from Zabbix, ALB health check or
Mackerel's "External Http monitor (外形監視)".
Slide 18
Slide 18 text
Error collection
Listening canary song.
Slide 19
Slide 19 text
Sentry
https://sentry.io/
Collect & sort errors.
Show the error environments: stacktrace, HTTP
params, app host, release ver…
Assign & resolve issue.
Integrate with Sass: Slack, GitHub…
Slide 20
Slide 20 text
Add https://hex.pm/packages/sentry in your app.
defmodule Example.Application do
use Application
def start(_type, _args) do
Logger.add_backend(Sentry.LoggerBackend)
…
end
defmodule Example.Router do
use Sentry.Plug
…
end
& add many metadata, by yourself (・﹏・)
Slide 21
Slide 21 text
Metrics monitoring
Know the app behaviour & detect anomary.
Slide 22
Slide 22 text
Prometheus + Grafana
+
deadtrickster/beam-dashboards
Beautiful. But to keep Prometheus servers have
many toils.
OK. I see container's metrics.
How about BEAM metrics?
Slide 28
Slide 28 text
KomachiHeartbeat + mackerel-
plugin-json
https://hex.pm/packages/komachi_heartbeat
Vital monitoring Elixir Web application.
https://github.com/mackerelio/mackerel-plugin-json
Json custom metrics plugin for mackerel.io agent.
Slide 29
Slide 29 text
KomachiHeartbeat has /stats endpoint that
returns app's stats in JSON.
mackerel-plugin-json posts any data gotten from
JSON API as Mackerel custome metrics.
Slide 30
Slide 30 text
We have KomachiHeartbeat.BeamVital .
https://github.com/ne-
sachirou/ex_komachi_heartbeat/pull/29
(Sorry for under development.)
Slide 31
Slide 31 text
Add KomachiHeartbeat.BeamVital .
defmodule TeijiBot.Router do
use Plug.Router
plug(:match)
plug(:dispatch)
forward(
"/ops",
to: KomachiHeartbeat,
init_opts: [vitals: [KomachiHeartbeat.BeamVital]]
)
end