ElixirDashboard.PerformanceMonitor (ElixirDashboard v0.2.0)

View Source

Main module for the Performance Monitor functionality.

Quick Start

Add to your application's supervision tree:

children = [
  # ... your other children
  ElixirDashboard.PerformanceMonitor.Supervisor
]

Then attach the telemetry handlers (typically in development only):

if Mix.env() == :dev do
  ElixirDashboard.PerformanceMonitor.TelemetryHandler.attach()
end

Configuration

Configure in your config/dev.exs:

config :elixir_dashboard,
  # Maximum number of items to keep in memory
  max_items: 100,
  # Endpoint duration threshold in milliseconds
  endpoint_threshold_ms: 100,
  # Query duration threshold in milliseconds
  query_threshold_ms: 50,
  # List of Ecto repo telemetry prefixes to monitor
  repo_prefixes: [[:my_app, :repo]]

Accessing Data

# Get slow endpoints
ElixirDashboard.PerformanceMonitor.Store.get_slow_endpoints()

# Get slow queries
ElixirDashboard.PerformanceMonitor.Store.get_slow_queries()

# Clear all data
ElixirDashboard.PerformanceMonitor.Store.clear_all()

Summary

Functions

Attaches telemetry handlers to start monitoring.

Returns the child spec for adding to a supervision tree.

Detaches telemetry handlers to stop monitoring.

Functions

attach()

Attaches telemetry handlers to start monitoring.

child_spec(opts)

Returns the child spec for adding to a supervision tree.

clear_all()

See ElixirDashboard.PerformanceMonitor.Store.clear_all/0.

detach()

Detaches telemetry handlers to stop monitoring.

get_slow_endpoints()

See ElixirDashboard.PerformanceMonitor.Store.get_slow_endpoints/0.

get_slow_queries()

See ElixirDashboard.PerformanceMonitor.Store.get_slow_queries/0.