mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 12:23:32 -04:00
13 lines
3.6 KiB
HTML
13 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Env (opentelemetry-client-ocurl.Opentelemetry_client_ocurl.Config.Env)</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> » <a href="../../../index.html">opentelemetry-client-ocurl</a> » <a href="../../index.html">Opentelemetry_client_ocurl</a> » <a href="../index.html">Config</a> » Env</nav><header class="odoc-preamble"><h1>Module <code><span>Config.Env</span></code></h1></header><div class="odoc-content"><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="../../../../opentelemetry/Opentelemetry_client/Config/index.html#type-t">Opentelemetry_client.Config.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="../../../../opentelemetry/Opentelemetry_client/Config/index.html#type-make">Opentelemetry_client.Config.make</a></span></span></code></div><div class="spec-doc"><p><code>make f</code> is a <code>make</code> 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>
|