↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

Out-of-the-box Elixir telemetry with Phoenix

Phoenix ships with telemetry, metrics, and dashboard support that expose Phoenix, Ecto, and BEAM activity by default. The article shows how the dashboard aggregates these measurements, how custom metrics can be added in telemetry.ex, and how telemetry events can carry metadata for tagging and splitting data.

It also shows that Elixir nodes can be clustered and observed through the same dashboard, even when the target node is not running Phoenix. The final point is that telemetry is useful only when it is connected to alerts and operational action.

Reading notes
#

  • Telemetry is presented as instrumentation that makes internal system operations visible so people can act on the data.
  • Raw actions from the system are events; aggregated events become metrics.
  • Phoenix includes telemetry poller and telemetry metrics dependencies, and starts the telemetry supervisor by default.
  • The generated telemetry.ex module defines metrics for Phoenix, the repo, and the VM.
  • summary is already configured, and the article names counter, sum, last_value, and distribution as other metric types.
  • The tutorial adds :os_mon so the dashboard can receive operating-system-related events.
  • The dashboard shows metrics for the OS, BEAM memory, the atom table, supervision trees, running applications, and custom application metrics.
  • Custom metrics are added by editing telemetry.ex and defining new metric entries.
  • The article demonstrates emitting telemetry events from iex with :telemetry.execute/2.
  • One event can feed multiple metrics.
  • Event metadata can be used to tag metrics and compare different user or process categories.
  • Elixir clustering is shown by starting two Phoenix nodes with the same cookie and connecting them with :net_adm.ping/1.
  • The dashboard can detach from one node and attach to another node in the cluster.
  • A node not running Phoenix can still appear in the dashboard once it is joined to the cluster.
  • The article argues that telemetry becomes useful when it drives alerts and operational response, not when it stays as instrumentation alone.