ocaml-trace/trace/Trace_debug/Track_spans/index.html
2026-01-21 01:33:49 +00:00

5 lines
2.7 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>Track_spans (trace.Trace_debug.Track_spans)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.1.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; <a href="../index.html">Trace_debug</a> &#x00BB; Track_spans</nav><header class="odoc-preamble"><h1>Module <code><span>Trace_debug.Track_spans</span></code></h1><p>Helper to track which spans never get closed.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-unclosed_spans"><a href="#type-unclosed_spans" class="anchor"></a><code><span><span class="keyword">type</span> unclosed_spans</span><span> = </span><span>{</span></code><ol><li id="type-unclosed_spans.num" class="def record field anchored"><a href="#type-unclosed_spans.num" class="anchor"></a><code><span>num : int;</span></code></li><li id="type-unclosed_spans.by_name" class="def record field anchored"><a href="#type-unclosed_spans.by_name" class="anchor"></a><code><span>by_name : <span><span>(string * int)</span> list</span>;</span></code></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-track"><a href="#val-track" class="anchor"></a><code><span><span class="keyword">val</span> track :
<span><span class="optlabel">?on_lingering_spans</span>:<span>[ <span>`Out of <a href="../../../ocaml/Stdlib/index.html#type-out_channel">out_channel</a></span> <span><span>| `Call</span> of <span><a href="#type-unclosed_spans">unclosed_spans</a> <span class="arrow">&#45;&gt;</span></span> unit</span> ]</span> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../Trace_core/Collector/index.html#type-t">Trace_core.Collector.t</a> <span class="arrow">&#45;&gt;</span></span>
<a href="../../Trace_core/Collector/index.html#type-t">Trace_core.Collector.t</a></span></code></div><div class="spec-doc"><p>Modify the enter/exit span functions to track the set of spans that are open, and warn at the end if some are not closed.</p><p>implementation notes: for now this uses a regular <code>Hashtbl</code> protected by a mutex, so runtime overhead isn't trivial.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">on_lingering_spans</span> <p>what to do with the non-closed spans</p></li></ul></div></div></div></body></html>