Module gen_server_passage

gen_server wrapper module for providing tracing facility.

Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>

Behaviours: gen_server.

Description

gen_server wrapper module for providing tracing facility.

The tracing facility is based on passage.

Data Types

server_name()

server_name() = {local, atom()} | {global, term()} | {via, module(), term()}

The name of a gen_server process.

See the documentation of gen_server module for more details.

server_ref()

server_ref() = pid() | atom() | {atom(), node()} | {global, term()} | {via, module(), term()}

A reference to a gen_server process.

See the documentation of gen_server module for more details.

start_option()

start_option() = {span, passage:maybe_span()} | {trace_process_lifecycle, passage:start_span_options()} | {inspect, boolean()} | (GenServerOptions::term())

GenServerOptions are options handled by the gen_server functions (e.g., gen_server:start_link/3).

start_options()

start_options() = [start_option()]

start_result()

start_result() = {ok, pid()} | ignore | {error, {already_started, pid()} | term()}

The result of a process startup.

See the documentation of gen_server module for more details.

Function Index

call/2Equivalent to call(ServerRef, Request, 5000).
call/3Traceable variant of gen_server:call/3.
cast/2Traceable variant of gen_server:cast/2.
process_span/0Returns the process scope span.
reply/2Equivalent to gen_server:reply / 2.
safe_call/3Equivalent to safe_call(Module, ServerRef, Request, 500).
safe_call/4A variant of call/3 that is safe even in a multiple nodes environment.
safe_cast/3A variant of call/3 that is safe even in a multiple nodes environment.
start/3Traceable variant of gen_server:start/3.
start/4Traceable variant of gen_server:start/4.
start_link/3Traceable variant of gen_server:start_link/3.
start_link/4Traceable variant of gen_server:start_link/4.
stop/1Equivalent to gen_server:stop / 1.
stop/3Equivalent to gen_server:stop / 3.
with_process_span/1Executes Fun within the process scope span.

Function Details

call/2

call(ServerRef::server_ref(), Request::term()) -> Reply::term()

Equivalent to call(ServerRef, Request, 5000).

call/3

call(ServerRef::server_ref(), Request::term(), Timeout::timeout()) -> Reply::term()

Traceable variant of gen_server:call/3.

This piggybacks the current span which retrieved by passage_pd:current_span/1 when sending Request to ServerRef. The span will be handled by gen_server_passage:handle_call/3 transparently for the gen_server implementation module.

Note that it is prefered to use safe_call/4 in a distributed environment where multiple nodes constitute an erlang cluster.

cast/2

cast(ServerRef::server_ref(), Request::term()) -> ok

Traceable variant of gen_server:cast/2.

This piggybacks the current span which retrieved by passage_pd:current_span/1 when sending Request to ServerRef. The span will be handled by gen_server_passage:handle_cast/2 transparently for the gen_server implementation module.

Note that it is prefered to use safe_cast/3 in a distributed environment where multiple nodes constitute an erlang cluster.

process_span/0

process_span() -> passage:maybe_span()

Returns the process scope span.

See also: trace_process_lifecycle option of start_option().

reply/2

reply(Client::term(), Reply::term()) -> term()

Equivalent to gen_server:reply / 2.

safe_call/3

safe_call(CallbackModule::module(), ServerRef::server_ref(), Request::term()) -> Reply::term()

Equivalent to safe_call(Module, ServerRef, Request, 500).

safe_call/4

safe_call(CallbackModule::module(), ServerRef::server_ref(), Request::term(), Timeout::timeout()) -> Reply::term()

A variant of call/3 that is safe even in a multiple nodes environment.

This function checks if the server process for CallbackModule in Node has the capability to handle tracing. If it has no capability, this will switch to the ordinary gen_server:call/3 function internally.

The checking result is cached in the local ETS. So normally, the cost between call/3 and safe_call/4 is negligible.

safe_cast/3

safe_cast(CallbackModule::module(), ServerRef::server_ref(), Request::term()) -> ok

A variant of call/3 that is safe even in a multiple nodes environment.

This function checks if the server process for CallbackModule in Node has the capability to handle tracing. If it has no capability, this will switch to the ordinary gen_server:cast/2 function internally.

The checking result is cached in the local ETS. So normally, the cost between cast/2 and safe_cast/3 is negligible.

start/3

start(Module::module(), Args::term(), Options0::start_options()) -> start_result()

Traceable variant of gen_server:start/3.

start/4

start(ServerName::server_name(), Module::module(), Args::term(), Options0::start_options()) -> start_result()

Traceable variant of gen_server:start/4.

start_link/3

start_link(Module::module(), Args::term(), Options0::start_options()) -> start_result()

Traceable variant of gen_server:start_link/3.

start_link/4

start_link(ServerName::server_name(), Module::module(), Args::term(), Options0::start_options()) -> start_result()

Traceable variant of gen_server:start_link/4.

stop/1

stop(ServerRef::server_ref()) -> ok

Equivalent to gen_server:stop / 1.

stop/3

stop(ServerRef::server_ref(), Reason::term(), Timeout::timeout()) -> ok

Equivalent to gen_server:stop / 3.

with_process_span/1

with_process_span(Fun) -> Result

Executes Fun within the process scope span.

See also: trace_process_lifecycle option of start_option().


Generated by EDoc, Jan 18 2018, 21:42:56.