Skip to content

Commit

Permalink
feat: add uptime vis in grafana (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaRedHand authored Jan 22, 2024
1 parent b1b0c78 commit dfa0f48
Show file tree
Hide file tree
Showing 2 changed files with 317 additions and 233 deletions.
11 changes: 9 additions & 2 deletions lib/lambda_ethereum_consensus/telemetry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,25 @@ defmodule LambdaEthereumConsensus.Telemetry do
last_value("vm.system_counts.process_count"),
last_value("vm.system_counts.atom_count"),
last_value("vm.system_counts.port_count"),
last_value("vm.message_queue.length", tags: [:process])
last_value("vm.message_queue.length", tags: [:process]),
last_value("vm.uptime.total", unit: :millisecond)
]
end

defp periodic_measurements do
[
# A module, function and arguments to be invoked periodically.
# This function must call :telemetry.execute/3 and a metric must be added above.
{__MODULE__, :message_queue_lengths, []}
{__MODULE__, :message_queue_lengths, []},
{__MODULE__, :uptime, []}
]
end

def uptime do
{uptime, _} = :erlang.statistics(:wall_clock)
:telemetry.execute([:vm, :uptime], %{total: uptime})
end

defp register_queue_length(name, len) do
:telemetry.execute([:vm, :message_queue], %{length: len}, %{process: inspect(name)})
end
Expand Down
Loading

0 comments on commit dfa0f48

Please sign in to comment.