View Source Grizzly.Trace (grizzly v8.5.3)

Module that tracks the commands that are sent and received by Grizzly

The trace will hold in memory the last 300 messages. If you want to generate a log file of the trace records you use Grizzly.Trace.dump/1.

The log format is:

timestamp source destination sequence_number command_name command_parameters

If you want to list the records that are currently being held in memory you can use Grizzly.Trace.list/0.

If you want to start traces from a fresh start you can call Grizzly.Trace.clear/0.

Summary

Functions

Returns a specification to start this module under a supervisor.

Reset the trace buffer.

Dump trace records into a file using Erlang External Term Format.

Serialize a list of trace records into a binary. The format can be one of

See list/2.

List all records in the trace buffer.

Add a record to the trace buffer.

Write trace records to standard out. See format/2 for the available formats.

Enable or disable logging of keepalive frames.

Change the max size of the trace buffer from the default of 300.

Start the trace server.

Types

@type dest() :: Grizzly.node_id() | :grizzly
@type format() :: :text | :raw
@type list_opt() :: {:node_id, Grizzly.node_id()}
@type log_opt() :: {:src, src()} | {:dest, dest()}
@type src() :: Grizzly.node_id() | :grizzly
@type trace_opt() ::
  {:name, atom()} | {:size, pos_integer()} | {:record_keepalives, boolean()}

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

clear(name \\ __MODULE__)

View Source
@spec clear(GenServer.server()) :: :ok

Reset the trace buffer.

@spec dump(binary()) :: :ok | {:error, atom()}

Dump trace records into a file using Erlang External Term Format.

Link to this function

format(records, format \\ :text)

View Source
@spec format([Grizzly.Trace.Record.t()], format()) :: binary()

Serialize a list of trace records into a binary. The format can be one of:

  • :text - Each record is on a new line and is formatted as timestamp source destination sequence_number command_name command_binary. This is the default format.

  • :raw - Each record is on a new line and is formatted as timestamp source -> destination: binary.

@spec list() :: [Grizzly.Trace.Record.t()]

See list/2.

@spec list(GenServer.server() | [list_opt()]) :: [Grizzly.Trace.Record.t()]

See list/2.

List all records in the trace buffer.

@spec log(binary(), [log_opt()]) :: :ok

See log/3

@spec log(GenServer.server(), binary(), [log_opt()]) :: :ok

Add a record to the trace buffer.

@spec print() :: :ok
Link to this function

print(records_or_format, opts)

View Source
@spec print([Grizzly.Trace.Record.t()] | format(), [list_opt()]) :: :ok

Write trace records to standard out. See format/2 for the available formats.

Link to this function

record_keepalives(enabled? \\ true)

View Source
@spec record_keepalives(boolean()) :: :ok

See record_keepalives/2.

Link to this function

record_keepalives(name, enabled?)

View Source
@spec record_keepalives(GenServer.server(), boolean()) :: :ok

Enable or disable logging of keepalive frames.

Link to this function

resize(name \\ __MODULE__, size)

View Source
@spec resize(GenServer.server(), pos_integer()) :: :ok

Change the max size of the trace buffer from the default of 300.

@spec start_link([trace_opt()]) :: GenServer.on_start()

Start the trace server.