Skip to content

Commit

Permalink
Merge pull request #228 from appsignal/add-heartbeat-checkins-elixir
Browse files Browse the repository at this point in the history
Add heartbeat check-ins `plug` endpoint
  • Loading branch information
unflxw authored Sep 16, 2024
2 parents c8b50a2 + 50880d3 commit 39355b2
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 39355b2

Please sign in to comment.