ocaml-opentelemetry/opentelemetry/Opentelemetry_ambient_context/index.html
2026-04-06 19:57:49 +00:00

2 lines
7.3 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>Opentelemetry_ambient_context (opentelemetry.Opentelemetry_ambient_context)</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">opentelemetry</a> &#x00BB; Opentelemetry_ambient_context</nav><header class="odoc-preamble"><h1>Module <code><span>Opentelemetry_ambient_context</span></code></h1><p>Just forward to the <code>ambient-context</code> library</p></header><div class="odoc-content"><div class="odoc-include"><details open="open"><summary class="spec include"><code><span><span class="keyword">include</span> <span class="keyword">module</span> <span class="keyword">type</span> <span class="keyword">of</span> <span class="keyword">struct</span> <span class="keyword">include</span> <a href="../../ambient-context/Ambient_context/index.html">Ambient_context</a> <span class="keyword">end</span></span></code></summary><div class="odoc-include"><details open="open"><summary class="spec include"><code><span><span class="keyword">include</span> <span class="keyword">module</span> <span class="keyword">type</span> <span class="keyword">of</span> <span class="keyword">struct</span> <span class="keyword">include</span> <a href="../../ambient-context/Ambient_context_core/index.html">Ambient_context_core</a> <span class="keyword">end</span></span></code></summary><div class="odoc-spec"><div class="spec module anchored" id="module-Context"><a href="#module-Context" class="anchor"></a><code><span><span class="keyword">module</span> Context</span><span> = <a href="../../ambient-context/Ambient_context_core/Context/index.html">Ambient_context.Context</a></span></code></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Storage"><a href="#module-Storage" class="anchor"></a><code><span><span class="keyword">module</span> Storage</span><span> = <a href="../../ambient-context/Ambient_context_core/Storage/index.html">Ambient_context.Storage</a></span></code></div></div></details></div><div class="odoc-spec"><div class="spec value anchored" id="val-default_storage"><a href="#val-default_storage" class="anchor"></a><code><span><span class="keyword">val</span> default_storage : <a href="../../ambient-context/Ambient_context_core/Storage/index.html#type-t">Ambient_context_core.Storage.t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_current_storage"><a href="#val-get_current_storage" class="anchor"></a><code><span><span class="keyword">val</span> get_current_storage : <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="../../ambient-context/Ambient_context_core/Storage/index.html#type-t">Storage.t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_current_storage"><a href="#val-set_current_storage" class="anchor"></a><code><span><span class="keyword">val</span> set_current_storage : <span><a href="../../ambient-context/Ambient_context_core/Storage/index.html#type-t">Storage.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><h3 id="functions-operating-with-the-current-storage"><a href="#functions-operating-with-the-current-storage" class="anchor"></a>Functions operating with the current storage</h3><div class="odoc-spec"><div class="spec value anchored" id="val-get_context"><a href="#val-get_context" class="anchor"></a><code><span><span class="keyword">val</span> get_context : <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="../../ambient-context/Ambient_context_core/Context/index.html#type-t">Ambient_context_core.Context.t</a></span></code></div><div class="spec-doc"><p>Get the context from the current storage, or <code>Hmap.empty</code> if there is no ambient context.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_context"><a href="#val-with_context" class="anchor"></a><code><span><span class="keyword">val</span> with_context : <span><a href="../../ambient-context/Ambient_context_core/Context/index.html#type-t">Ambient_context_core.Context.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_context ctx f</code> calls <code>f()</code> in an ambient context in which <code>get_context()</code> will return <code>ctx</code>. Once <code>f()</code> returns, the storage is reset to its previous value.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get"><a href="#val-get" class="anchor"></a><code><span><span class="keyword">val</span> get : <span><span><span class="type-var">'a</span> <a href="../../ambient-context/Ambient_context_core/Context/index.html#type-key">Context.key</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> option</span></span></code></div><div class="spec-doc"><p>Get the ambient context and then look up <code>k</code> in it</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-new_key"><a href="#val-new_key" class="anchor"></a><code><span><span class="keyword">val</span> new_key : <span>unit <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <a href="../../ambient-context/Ambient_context_core/Context/index.html#type-key">Context.key</a></span></span></code></div><div class="spec-doc"><p>Create a new key</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_key_bound_to"><a href="#val-with_key_bound_to" class="anchor"></a><code><span><span class="keyword">val</span> with_key_bound_to : <span><span><span class="type-var">'a</span> <a href="../../hmap/Hmap/index.html#type-key">Hmap.key</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>with_key_bound_to storage k v f</code> calls <code>f()</code> in a context updated to have <code>k</code> map to <code>v</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_key_unbound"><a href="#val-with_key_unbound" class="anchor"></a><code><span><span class="keyword">val</span> with_key_unbound : <span><span><span class="type-var">'a</span> <a href="../../hmap/Hmap/index.html#type-key">Hmap.key</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>with_key_unbound k f</code> calls <code>f()</code> in a context updated to have <code>k</code> bound to no value.</p></div></div></details></div></div></body></html>