Tempo.Visualizer.Standalone (Tempo v0.5.0)

Copy Markdown View Source

A helper that runs Tempo.Visualizer as a standalone web server for local exploration.

Requires :plug and :bandit in your project's deps.

Tempo.Visualizer.Standalone.start(port: 4001)
# Visit http://localhost:4001

Stop the server with Tempo.Visualizer.Standalone.stop/1, passing the PID returned from start/1.

Summary

Functions

Return a child specification suitable for embedding under a supervision tree.

Start the visualizer on the given port.

Stop a standalone server started by start/1.

Functions

child_spec(options \\ [])

@spec child_spec(keyword()) :: Supervisor.child_spec()

Return a child specification suitable for embedding under a supervision tree.

Options

See start/1.

start(options \\ [])

@spec start(keyword()) :: {:ok, pid()} | {:error, term()}

Start the visualizer on the given port.

Options

  • :port — TCP port to listen on. Default 4001.

  • :ip — IP address to bind to. Default :loopback (only accessible from localhost). Pass :any to bind on all interfaces.

Returns

  • {:ok, pid} on success.

  • {:error, reason} on failure — typically a port-in-use error.

Examples

iex> {:ok, _pid} = Tempo.Visualizer.Standalone.start(port: 4002)
iex> _ = :timer.sleep(50)
iex> :ok

stop(pid)

@spec stop(pid()) :: :ok

Stop a standalone server started by start/1.

Arguments

  • pid — the process identifier returned by start/1.

Returns

  • :ok.