gen_server
wrapper module for providing tracing facility.
Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>
Behaviours: gen_server.
gen_server
wrapper module for providing tracing facility.
server_name() = {local, atom()} | {global, term()} | {via, module(), term()}
The name of a gen_server
process.
server_ref() = pid() | atom() | {atom(), node()} | {global, term()} | {via, module(), term()}
A reference to a gen_server
process.
start_option() = {span, passage:maybe_span()} | {trace_process_lifecycle, passage:start_span_options()} | {inspect, boolean()} | (GenServerOptions::term())
span
: The parent span that starting this process. The default value is passage_pb:current_span()
.trace_process_lifecycle
: If this option is specified, the started process has a span including from the start of the process to the end of it. The span can be retrieved from the running process by calling process_span/0
.insepct
: If true
, spans for init/1
, handle_call/3
and handle_cast/2
are inserted. The default value is false
.GenServerOptions
are options handled by the gen_server
functions
(e.g., gen_server:start_link/3).
start_options() = [start_option()]
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.call/2 | Equivalent to call(ServerRef, Request, 5000). |
call/3 | Traceable variant of gen_server:call/3. |
cast/2 | Traceable variant of gen_server:cast/2. |
process_span/0 | Returns the process scope span. |
reply/2 | Equivalent to gen_server:reply / 2. |
safe_call/3 | Equivalent to safe_call(Module, ServerRef, Request, 500). |
safe_call/4 | A variant of call/3 that is safe even in a multiple nodes environment. |
safe_cast/3 | A variant of call/3 that is safe even in a multiple nodes environment. |
start/3 | Traceable variant of gen_server:start/3. |
start/4 | Traceable variant of gen_server:start/4. |
start_link/3 | Traceable variant of gen_server:start_link/3. |
start_link/4 | Traceable variant of gen_server:start_link/4. |
stop/1 | Equivalent to gen_server:stop / 1. |
stop/3 | Equivalent to gen_server:stop / 3. |
with_process_span/1 | Executes Fun within the process scope span. |
call(ServerRef::server_ref(), Request::term()) -> Reply::term()
Equivalent to call(ServerRef, Request, 5000).
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.
safe_call/4
in a distributed environment where multiple nodes constitute an erlang cluster.
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.
safe_cast/3
in a distributed environment where multiple nodes constitute an erlang cluster.
process_span() -> passage:maybe_span()
Returns the process scope span.
See also:trace_process_lifecycle
option of start_option()
.
reply(Client::term(), Reply::term()) -> term()
Equivalent to gen_server:reply / 2.
safe_call(CallbackModule::module(), ServerRef::server_ref(), Request::term()) -> Reply::term()
Equivalent to safe_call(Module, ServerRef, Request, 500).
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.
call/3
and safe_call/4
is negligible.
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.
cast/2
and safe_cast/3
is negligible.
start(Module::module(), Args::term(), Options0::start_options()) -> start_result()
Traceable variant of gen_server:start/3.
start(ServerName::server_name(), Module::module(), Args::term(), Options0::start_options()) -> start_result()
Traceable variant of gen_server:start/4.
start_link(Module::module(), Args::term(), Options0::start_options()) -> start_result()
Traceable variant of gen_server:start_link/3.
start_link(ServerName::server_name(), Module::module(), Args::term(), Options0::start_options()) -> start_result()
Traceable variant of gen_server:start_link/4.
stop(ServerRef::server_ref()) -> ok
Equivalent to gen_server:stop / 1.
stop(ServerRef::server_ref(), Reason::term(), Timeout::timeout()) -> ok
Equivalent to gen_server:stop / 3.
with_process_span(Fun) -> Result
Executes Fun
within the process scope span.
trace_process_lifecycle
option of start_option()
.
Generated by EDoc