Skip to content

Commit

Permalink
Add heartbeat check-ins plug endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
unflxw committed Sep 16, 2024
1 parent b6269da commit 50880d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions elixir/plug/app/lib/plug_example.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ defmodule PlugExample do
send_resp(conn, 200, "Cron check-in sent!")
end

get "/heartbeat" do
Appsignal.CheckIn.heartbeat("custom-heartbeat-checkin")

send_resp(conn, 200, "Heartbeat check-in sent!")
end

get "/custom_instrumentation" do
Appsignal.Span.set_namespace(Appsignal.Tracer.root_span(), "custom")

Expand Down
3 changes: 2 additions & 1 deletion elixir/plug/app/lib/plug_example/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ defmodule PlugExample.Application do
def start(_type, _args) do
port = String.to_integer(System.get_env("PORT") || "4000")
children = [
{Plug.Cowboy, scheme: :http, plug: PlugExample, options: [port: port]}
{Plug.Cowboy, scheme: :http, plug: PlugExample, options: [port: port]},
{Appsignal.CheckIn.Heartbeat, "continuous-heartbeat-checkin"}
]

# See https://hexdocs.pm/elixir/Supervisor.html
Expand Down

0 comments on commit 50880d3

Please sign in to comment.