mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 04:17:56 -04:00
2 lines
5.7 KiB
HTML
2 lines
5.7 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Scope (opentelemetry.Opentelemetry.Scope)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><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">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-to_span_ctx"><a href="#val-to_span_ctx" class="anchor"></a><code><span><span class="keyword">val</span> to_span_ctx : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="../Span_ctx/index.html#type-t">Span_ctx.t</a></span></code></div><div class="spec-doc"><p>Turn the scope into a span context</p></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-ambient_scope_key"><a href="#val-ambient_scope_key" class="anchor"></a><code><span><span class="keyword">val</span> ambient_scope_key : <span><a href="#type-t">t</a> <a href="../../../ambient-context/Ambient_context/index.html#type-key">Ambient_context.key</a></span></span></code></div><div class="spec-doc"><p>The opaque key necessary to access/set the ambient scope with <a href="../../../ambient-context/Ambient_context/index.html"><code>Ambient_context</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_ambient_scope"><a href="#val-get_ambient_scope" class="anchor"></a><code><span><span class="keyword">val</span> get_ambient_scope : <span><span class="optlabel">?scope</span>:<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 <a href="../../../ambient-context/Ambient_context/index.html"><code>Ambient_context</code></a>, if available.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_ambient_scope"><a href="#val-with_ambient_scope" class="anchor"></a><code><span><span class="keyword">val</span> with_ambient_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">'a0</span></span></code></div><div class="spec-doc"><p><code>with_ambient_scope sc thunk</code> calls <code>thunk()</code> in a context where <code>sc</code> is the (thread|continuation)-local scope, then reverts to the previous local scope, if any.</p><ul class="at-tags"><li class="see"><span class="at-tag">see</span> <a href="https://github.com/ELLIOTTCABLE/ocaml-ambient-context" class="value">https://github.com/ELLIOTTCABLE/ocaml-ambient-context</a> <p>ambient-context docs</p></li></ul></div></div></div></body></html>
|