mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 04:17:56 -04:00
11 lines
4 KiB
HTML
11 lines
4 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Env (opentelemetry.Opentelemetry_client.Config.Env)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.0.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> » <a href="../index.html">Config</a> » Env</nav><header class="odoc-preamble"><h1>Module <code><span>Config.Env</span></code></h1><p>A generative functor that produces a state-space that can read configuration values from the environment, provide stateful configuration setting and accessing operations, and a way to make a new <a href="../index.html#type-t"><code>t</code></a> configuration record</p></header><div class="odoc-tocs"><nav class="odoc-toc odoc-local-toc"><ul><li><a href="#parameters">Parameters</a></li><li><a href="#signature">Signature</a></li></ul></nav></div><div class="odoc-content"><h2 id="parameters"><a href="#parameters" class="anchor"></a>Parameters</h2><h2 id="signature"><a href="#signature" class="anchor"></a>Signature</h2><div class="odoc-spec"><div class="spec value anchored" id="val-get_debug"><a href="#val-get_debug" class="anchor"></a><code><span><span class="keyword">val</span> get_debug : <span>unit <span class="arrow">-></span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_debug"><a href="#val-set_debug" class="anchor"></a><code><span><span class="keyword">val</span> set_debug : <span>bool <span class="arrow">-></span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_headers"><a href="#val-get_headers" class="anchor"></a><code><span><span class="keyword">val</span> get_headers : <span>unit <span class="arrow">-></span></span> <span><span>(string * string)</span> list</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_headers"><a href="#val-set_headers" class="anchor"></a><code><span><span class="keyword">val</span> set_headers : <span><span><span>(string * string)</span> list</span> <span class="arrow">-></span></span> unit</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>(<span><a href="../index.html#type-t">t</a> <span class="arrow">-></span></span> <span class="type-var">'a</span>)</span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <a href="../index.html#type-make">make</a></span></span></code></div><div class="spec-doc"><p><code>make f</code> is a <a href="../index.html#type-make"><code>make</code></a> function that will give <code>f</code> a safely constructed <a href="../index.html#type-t"><code>t</code></a>.</p><p>Typically this is used to extend the constructor for <a href="../index.html#type-t"><code>t</code></a> with new optional arguments.</p><p>E.g., we can construct a configuration that includes a <a href="../index.html#type-t"><code>t</code></a> alongside a more specific field like so:</p><pre class="language-ocaml"><code> type extended_config = {
|
||
new_field: string;
|
||
common: t;
|
||
}
|
||
|
||
let make : (new_field:string -> unit -> extended_config) make =
|
||
Env.make (fun common ~new_field () -> { new_field; common })
|
||
|
||
let _example : extended_config =
|
||
make ~new_field:"foo" ~url_traces:"foo/bar" ~debug:true ()</code></pre><p>As a special case, we can get the simple constructor function for <a href="../index.html#type-t"><code>t</code></a> with <code>Env.make (fun common () -> common)</code></p></div></div></div></body></html>
|