ocaml-opentelemetry/opentelemetry/Opentelemetry/Scope/index.html
2025-01-31 01:39:34 +00:00

15 lines
11 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>Scope (opentelemetry.Opentelemetry.Scope)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><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> &#x00BB; <a href="../index.html">Opentelemetry</a> &#x00BB; 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-item_list"><a href="#type-item_list" class="anchor"></a><code><span><span class="keyword">type</span> item_list</span></code></div></div><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.items" class="def record field anchored"><a href="#type-t.items" class="anchor"></a><code><span><span class="keyword">mutable</span> items : <a href="#type-item_list">item_list</a>;</span></code></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-attrs"><a href="#val-attrs" class="anchor"></a><code><span><span class="keyword">val</span> attrs : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../index.html#type-key_value">key_value</a> list</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-events"><a href="#val-events" class="anchor"></a><code><span><span class="keyword">val</span> events : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Event/index.html#type-t">Event.t</a> list</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-links"><a href="#val-links" class="anchor"></a><code><span><span class="keyword">val</span> links : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Span_link/index.html#type-t">Span_link.t</a> list</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-status"><a href="#val-status" class="anchor"></a><code><span><span class="keyword">val</span> status : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Span_status/index.html#type-t">Span_status.t</a> option</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-kind"><a href="#val-kind" class="anchor"></a><code><span><span class="keyword">val</span> kind : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Span_kind/index.html#type-t">Span_kind.t</a> option</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="label">trace_id</span>:<a href="../Trace_id/index.html#type-t">Trace_id.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">span_id</span>:<a href="../Span_id/index.html#type-t">Span_id.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?events</span>:<span><a href="../Event/index.html#type-t">Event.t</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?attrs</span>:<span><a href="../index.html#type-key_value">key_value</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?links</span>:<span><a href="../Span_link/index.html#type-t">Span_link.t</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?status</span>:<a href="../Span_status/index.html#type-t">Span_status.t</a> <span class="arrow">&#45;&gt;</span></span>
<span>unit <span class="arrow">&#45;&gt;</span></span>
<a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_span_link"><a href="#val-to_span_link" class="anchor"></a><code><span><span class="keyword">val</span> to_span_link :
<span><span class="optlabel">?trace_state</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?attrs</span>:<span><a href="../index.html#type-key_value">key_value</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?dropped_attributes_count</span>:int <span class="arrow">&#45;&gt;</span></span>
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<a href="../Span_link/index.html#type-t">Span_link.t</a></span></code></div><div class="spec-doc"><p>Turn the scope into a span link</p></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">&#45;&gt;</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">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <a href="../Event/index.html#type-t">Event.t</a>)</span> <span class="arrow">&#45;&gt;</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-record_exception"><a href="#val-record_exception" class="anchor"></a><code><span><span class="keyword">val</span> record_exception : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>exn <span class="arrow">&#45;&gt;</span></span> <span><a href="../../../ocaml/Stdlib/Printexc/index.html#type-raw_backtrace">Stdlib.Printexc.raw_backtrace</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></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">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span><a href="../index.html#type-key_value">key_value</a> list</span>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Add attributes 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-add_links"><a href="#val-add_links" class="anchor"></a><code><span><span class="keyword">val</span> add_links : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span><a href="../Span_link/index.html#type-t">Span_link.t</a> list</span>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Add links to the scope. It will be aggregated into the span.</p><p>Note that this takes a function that produces links, 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-set_status"><a href="#val-set_status" class="anchor"></a><code><span><span class="keyword">val</span> set_status : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Span_status/index.html#type-t">Span_status.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>set the span status.</p><p>Note that this function will be called only if there is an instrumentation backend.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_kind"><a href="#val-set_kind" class="anchor"></a><code><span><span class="keyword">val</span> set_kind : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Span_kind/index.html#type-t">Span_kind.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Set the span's kind.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> NEXT_RELEASE</li></ul></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> <span class="xref-unresolved">{Ambient_context}3</span>.key</span></span></code></div><div class="spec-doc"><p>The opaque key necessary to access/set the ambient scope with <code>Ambient_context</code>.</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">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> option</span></span></code></div><div class="spec-doc"><p>Obtain current scope from <code>Ambient_context</code>, 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">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</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>