mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 20:33:36 -04:00
2 lines
No EOL
4.4 KiB
HTML
2 lines
No EOL
4.4 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Scope (opentelemetry.Opentelemetry.Scope)</title><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/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">opentelemetry</a> » <a href="../index.html">Opentelemetry</a> » Scope</nav><header class="odoc-preamble"><h1>Module <code><span>Opentelemetry.Scope</span></code></h1><p>Scopes.</p><p>A scope is a trace ID and the span ID of the currently active span.</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> t</span><span> = </span><span>{</span></code><ol><li id="type-t.trace_id" class="def record field anchored"><a href="#type-t.trace_id" class="anchor"></a><code><span>trace_id : <a href="../Trace_id/index.html#type-t">Trace_id.t</a>;</span></code></li><li id="type-t.span_id" class="def record field anchored"><a href="#type-t.span_id" class="anchor"></a><code><span>span_id : <a href="../Span_id/index.html#type-t">Span_id.t</a>;</span></code></li><li id="type-t.events" class="def record field anchored"><a href="#type-t.events" class="anchor"></a><code><span><span class="keyword">mutable</span> events : <span><a href="../Event/index.html#type-t">Event.t</a> list</span>;</span></code></li><li id="type-t.attrs" class="def record field anchored"><a href="#type-t.attrs" class="anchor"></a><code><span><span class="keyword">mutable</span> attrs : <span><a href="../index.html#type-key_value">key_value</a> list</span>;</span></code></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_event"><a href="#val-add_event" class="anchor"></a><code><span><span class="keyword">val</span> add_event : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span>(<span>unit <span class="arrow">-></span></span> <a href="../Event/index.html#type-t">Event.t</a>)</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Add an event to the scope. It will be aggregated into the span.</p><p>Note that this takes a function that produces an event, and will only call it if there is an instrumentation backend.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_attrs"><a href="#val-add_attrs" class="anchor"></a><code><span><span class="keyword">val</span> add_attrs : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span>(<span>unit <span class="arrow">-></span></span> <span><a href="../index.html#type-key_value">key_value</a> list</span>)</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Add an attr to the scope. It will be aggregated into the span.</p><p>Note that this takes a function that produces attributes, and will only call it if there is an instrumentation backend.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_surrounding"><a href="#val-get_surrounding" class="anchor"></a><code><span><span class="keyword">val</span> get_surrounding : <span>?scope:<a href="#type-t">t</a> <span class="arrow">-></span></span> <span>unit <span class="arrow">-></span></span> <span><a href="#type-t">t</a> option</span></span></code></div><div class="spec-doc"><p>Obtain current scope from thread-local storage, if available</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_scope"><a href="#val-with_scope" class="anchor"></a><code><span><span class="keyword">val</span> with_scope : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span>(<span>unit <span class="arrow">-></span></span> <span class="type-var">'a</span>)</span> <span class="arrow">-></span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>with_scope sc f</code> calls <code>f()</code> in a context where <code>sc</code> is the (thread)-local scope, then reverts to the previous local scope, if any.</p></div></div></div></body></html> |