mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 04:17:56 -04:00
8 lines
5.5 KiB
HTML
8 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Batch (opentelemetry.Opentelemetry_client.Batch)</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> » <a href="../../index.html">opentelemetry</a> » <a href="../index.html">Opentelemetry_client</a> » Batch</nav><header class="odoc-preamble"><h1>Module <code><span>Opentelemetry_client.Batch</span></code></h1><p>A thread-safe batch of resources to be popper when ready .</p></header><div class="odoc-content"><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> <span>'a t</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-make"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make :
|
||
<span><span class="optlabel">?batch</span>:int <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?high_watermark</span>:int <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?now</span>:<a href="../../../mtime/Mtime/index.html#type-t">Mtime.t</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?timeout</span>:<a href="../../../mtime/Mtime/index.html#type-span">Mtime.span</a> <span class="arrow">-></span></span>
|
||
<span>unit <span class="arrow">-></span></span>
|
||
<span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>make ()</code> is a new batch</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">batch</span> <p>the number of elements after which the batch will be considered <b>full</b>, and ready to pop. Set to <code>0</code> to disable batching. It is required that <code>batch >= 0</code>. Default <code>1</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">high_watermark</span> <p>the batch size limit after which new elements will be <code>`Dropped</code> by <a href="#val-push"><code>push</code></a>. This prevents the queue from growing too fast for effective transmission in case of signal floods. Default <code>if batch = 1 then 100 else batch * 10</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">now</span> <p>the current time. Default <code>Mtime_clock.now ()</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">timeout</span> <p>the time span after which a batch is ready to pop, whether or not it is <b>full</b>.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pop_if_ready"><a href="#val-pop_if_ready" class="anchor"></a><code><span><span class="keyword">val</span> pop_if_ready : <span><span class="optlabel">?force</span>:bool <span class="arrow">-></span></span> <span><span class="label">now</span>:<a href="../../../mtime/Mtime/index.html#type-t">Mtime.t</a> <span class="arrow">-></span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span><span class="type-var">'a</span> list</span> option</span></span></code></div><div class="spec-doc"><p><code>pop_if_ready ~now b</code> is <code>Some xs</code>, where is <code>xs</code> includes all the elements <a href="#val-push"><code>push</code></a>ed since the last batch, if the batch ready to be emitted.</p><p>A batch is ready to pop if it contains some elements and</p><ul><li>batching is disabled, and any elements have been batched, or batching was enabled and at least <code>batch</code> elements have been pushed, or</li><li>a <code>timeout</code> was provided, and more than a <code>timeout</code> span has passed since the last pop was ready, or</li><li>the pop is <code>force</code>d,</li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">now</span> <p>the current time</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">force</span> <p>override the other batch conditions, for when when we just want to emit batches before exit or because the user asks for it</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-push"><a href="#val-push" class="anchor"></a><code><span><span class="keyword">val</span> push : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span><span class="type-var">'a</span> list</span> <span class="arrow">-></span></span> <span>[ `Dropped <span>| `Ok</span> ]</span></span></code></div><div class="spec-doc"><p><code>push b xs</code> is <code>`Ok</code> if it succeeds in pushing the values in <code>xs</code> into the batch <code>b</code>, or <code>`Dropped</code> if the current size of the batch has exceeded the high water mark determined by the <code>batch</code> argument to <code>{!make}</code>. )</p></div></div></div></body></html>
|