nanoev/trace/Trace_subscriber/index.html
2025-05-30 19:31:31 +00:00

2 lines
6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Trace_subscriber (trace.Trace_subscriber)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.0.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../index.html">Index</a> &#x00BB; <a href="../index.html">trace</a> &#x00BB; Trace_subscriber</nav><header class="odoc-preamble"><h1>Module <code><span>Trace_subscriber</span></code></h1><p>Generic subscribers.</p><p>This defines the notion of a <b>subscriber</b>, a set of callbacks for every trace event. It also defines a collector that needs to be installed for the subscriber(s) to be called.</p><p>Thanks to <a href="Subscriber/index.html#val-tee_l"><code>Subscriber.tee_l</code></a> it's possible to combine multiple subscribers into a single collector.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.8</li></ul></header><div class="odoc-tocs"><nav class="odoc-toc odoc-local-toc"><ul><li><a href="#main-api">Main API</a></li></ul></nav></div><div class="odoc-content"><div class="odoc-spec"><div class="spec module anchored" id="module-Callbacks"><a href="#module-Callbacks" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Callbacks/index.html">Callbacks</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Callbacks used for subscribers.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Subscriber"><a href="#module-Subscriber" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Subscriber/index.html">Subscriber</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Trace subscribers</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Span_tbl"><a href="#module-Span_tbl" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Span_tbl/index.html">Span_tbl</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>A table that can be used to remember information about spans.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-user_data"><a href="#type-user_data" class="anchor"></a><code><span><span class="keyword">type</span> user_data</span><span> = </span></code><ol><li id="type-user_data.U_bool" class="def variant constructor anchored"><a href="#type-user_data.U_bool" class="anchor"></a><code><span>| </span><span><span class="constructor">U_bool</span> <span class="keyword">of</span> bool</span></code></li><li id="type-user_data.U_float" class="def variant constructor anchored"><a href="#type-user_data.U_float" class="anchor"></a><code><span>| </span><span><span class="constructor">U_float</span> <span class="keyword">of</span> float</span></code></li><li id="type-user_data.U_int" class="def variant constructor anchored"><a href="#type-user_data.U_int" class="anchor"></a><code><span>| </span><span><span class="constructor">U_int</span> <span class="keyword">of</span> int</span></code></li><li id="type-user_data.U_none" class="def variant constructor anchored"><a href="#type-user_data.U_none" class="anchor"></a><code><span>| </span><span><span class="constructor">U_none</span></span></code></li><li id="type-user_data.U_string" class="def variant constructor anchored"><a href="#type-user_data.U_string" class="anchor"></a><code><span>| </span><span><span class="constructor">U_string</span> <span class="keyword">of</span> string</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>A non polymorphic-variant version of <a href="../Trace_core/index.html#type-user_data"><code>Trace_core.user_data</code></a></p><span class="comment-delim">*)</span></div></li></ol></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-flavor"><a href="#type-flavor" class="anchor"></a><code><span><span class="keyword">type</span> flavor</span><span> = </span></code><ol><li id="type-flavor.Sync" class="def variant constructor anchored"><a href="#type-flavor.Sync" class="anchor"></a><code><span>| </span><span><span class="constructor">Sync</span></span></code></li><li id="type-flavor.Async" class="def variant constructor anchored"><a href="#type-flavor.Async" class="anchor"></a><code><span>| </span><span><span class="constructor">Async</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>A non polymorphic-variant version of <code>Trace_core.flavor</code></p><span class="comment-delim">*)</span></div></li></ol></div></div><h3 id="main-api"><a href="#main-api" class="anchor"></a>Main API</h3><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span><span> = <a href="Subscriber/index.html#type-t">Subscriber.t</a></span></code></div><div class="spec-doc"><p>A trace subscriber. It pairs a set of callbacks with the state they need (which can contain a file handle, a socket to write events to, config, etc.).</p><p>The design goal for this is that it should be possible to avoid allocations whenever the trace collector invokes the callbacks.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-collector"><a href="#val-collector" class="anchor"></a><code><span><span class="keyword">val</span> collector : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Trace_core/index.html#type-collector">Trace_core.collector</a></span></code></div><div class="spec-doc"><p>A collector that calls the subscriber's callbacks.</p><p>It uses <code>mtime</code> (if available) to obtain timestamps.</p></div></div></div></body></html>