Ferricstore.LatencyTrace (ferricstore v0.5.2)

Copy Markdown View Source

Request-local latency trace collector.

This is intentionally process-local and opt-in. Normal hot-path calls pay only the small enabled?/0 check in selected boundaries; traced native requests set the collector in the lane process and receive the accumulated timings in the response payload.

Summary

Functions

add(key, duration_us)

@spec add(binary(), non_neg_integer()) :: :ok

command_wrapper?(arg1)

@spec command_wrapper?(term()) :: boolean()

enabled?()

@spec enabled?() :: boolean()

finish(previous)

@spec finish(term()) :: map()

maybe_span(key, list)

(macro)

maybe_wrap_command(command)

@spec maybe_wrap_command(term()) :: term()

merge(trace)

@spec merge(map()) :: :ok

merge_result(results)

@spec merge_result(term()) :: term()

span(key, fun)

@spec span(binary(), (-> result)) :: result when result: term()

start(initial \\ %{})

@spec start(map()) :: term()

unwrap_command(command)

@spec unwrap_command(term()) :: term()

wrap_command(command)

@spec wrap_command(term()) :: term()

wrap_result(result, trace)

@spec wrap_result(term(), map()) :: term()