ocaml-opentelemetry/opentelemetry/Opentelemetry_client/Config/index.html
2025-07-12 04:26:53 +00:00

14 lines
9.9 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>Config (opentelemetry.Opentelemetry_client.Config)</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> &#x00BB; <a href="../../index.html">opentelemetry</a> &#x00BB; <a href="../index.html">Opentelemetry_client</a> &#x00BB; Config</nav><header class="odoc-preamble"><h1>Module <code><span>Opentelemetry_client.Config</span></code></h1><p>Constructing and managing the configuration needed in common by all clients</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 class="keyword">private</span> </span><span>{</span></code><ol><li id="type-t.debug" class="def record field anchored"><a href="#type-t.debug" class="anchor"></a><code><span>debug : bool;</span></code></li><li id="type-t.url_traces" class="def record field anchored"><a href="#type-t.url_traces" class="anchor"></a><code><span>url_traces : string;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Url to send traces</p><span class="comment-delim">*)</span></div></li><li id="type-t.url_metrics" class="def record field anchored"><a href="#type-t.url_metrics" class="anchor"></a><code><span>url_metrics : string;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Url to send metrics</p><span class="comment-delim">*)</span></div></li><li id="type-t.url_logs" class="def record field anchored"><a href="#type-t.url_logs" class="anchor"></a><code><span>url_logs : string;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Url to send logs</p><span class="comment-delim">*)</span></div></li><li id="type-t.headers" class="def record field anchored"><a href="#type-t.headers" class="anchor"></a><code><span>headers : <span><span>(string * string)</span> list</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>API headers sent to the endpoint. Default is none or &quot;OTEL_EXPORTER_OTLP_HEADERS&quot; if set.</p><span class="comment-delim">*)</span></div></li><li id="type-t.batch_traces" class="def record field anchored"><a href="#type-t.batch_traces" class="anchor"></a><code><span>batch_traces : <span>int option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Batch traces? If <code>Some i</code>, then this produces batches of (at most) <code>i</code> items. If <code>None</code>, there is no batching.</p><p>Note that traces and metrics are batched separately. Default <code>Some 400</code>.</p><span class="comment-delim">*)</span></div></li><li id="type-t.batch_metrics" class="def record field anchored"><a href="#type-t.batch_metrics" class="anchor"></a><code><span>batch_metrics : <span>int option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Batch metrics? If <code>Some i</code>, then this produces batches of (at most) <code>i</code> items. If <code>None</code>, there is no batching.</p><p>Note that traces and metrics are batched separately. Default <code>None</code>.</p><span class="comment-delim">*)</span></div></li><li id="type-t.batch_logs" class="def record field anchored"><a href="#type-t.batch_logs" class="anchor"></a><code><span>batch_logs : <span>int option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Batch logs? See <a href="#type-t.batch_metrics"><code>batch_metrics</code></a> for details. Default <code>Some 400</code></p><span class="comment-delim">*)</span></div></li><li id="type-t.batch_timeout_ms" class="def record field anchored"><a href="#type-t.batch_timeout_ms" class="anchor"></a><code><span>batch_timeout_ms : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Number of milliseconds after which we will emit a batch, even incomplete. Note that the batch might take longer than that, because this is only checked when a new event occurs or when a tick is emitted. Default 2_000.</p><span class="comment-delim">*)</span></div></li><li id="type-t.self_trace" class="def record field anchored"><a href="#type-t.self_trace" class="anchor"></a><code><span>self_trace : bool;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If true, the OTEL library will also emit its own spans. Default <code>false</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.7</li></ul><span class="comment-delim">*)</span></div></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>Configuration.</p><p>To build one, use <a href="#type-make"><code>make</code></a> below. This might be extended with more fields in the future.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-default_url"><a href="#val-default_url" class="anchor"></a><code><span><span class="keyword">val</span> default_url : string</span></code></div><div class="spec-doc"><p>The default base URL for the config.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span><span class="keyword">val</span> pp : <span><a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-make"><a href="#type-make" class="anchor"></a><code><span><span class="keyword">type</span> <span>'k make</span></span><span> =
<span><span class="optlabel">?debug</span>:bool <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?url</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?url_traces</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?url_metrics</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?url_logs</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?batch_traces</span>:<span>int option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?batch_metrics</span>:<span>int option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?batch_logs</span>:<span>int option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?headers</span>:<span><span>(string * string)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?batch_timeout_ms</span>:int <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?self_trace</span>:bool <span class="arrow">&#45;&gt;</span></span>
<span class="type-var">'k</span></span></code></div><div class="spec-doc"><p>A function that gathers all the values needed to construct a <a href="#type-t"><code>t</code></a>, and produces a <code>'k</code>. <code>'k</code> is typically a continuation used to construct a configuration that includes a <a href="#type-t"><code>t</code></a>.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">url</span> <p>base url used to construct per-signal urls. Per-signal url options take precedence over this base url. If not provided, this defaults to &quot;OTEL_EXPORTER_OTLP_ENDPOINT&quot; if set, or if not <a href="#val-default_url"><code>default_url</code></a>.</p></li></ul><p>Example of constructed per-signal urls with the base url http://localhost:4318</p><ul><li>Traces: http://localhost:4318/v1/traces</li><li>Metrics: http://localhost:4318/v1/metrics</li><li>Logs: http://localhost:4318/v1/logs</li></ul><p>Use per-signal url options if different urls are needed for each signal type.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">url_traces</span> <p>url to send traces, or &quot;OTEL_EXPORTER_OTLP_TRACES_ENDPOINT&quot; if set. The url is used as-is without any modification.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">url_metrics</span> <p>url to send metrics, or &quot;OTEL_EXPORTER_OTLP_METRICS_ENDPOINT&quot; if set. The url is used as-is without any modification.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">url_logs</span> <p>url to send logs, or &quot;OTEL_EXPORTER_OTLP_LOGS_ENDPOINT&quot; if set. The url is used as-is without any modification.</p></li></ul></div></div><div class="odoc-spec"><div class="spec module-type anchored" id="module-type-ENV"><a href="#module-type-ENV" class="anchor"></a><code><span><span class="keyword">module</span> <span class="keyword">type</span> <a href="module-type-ENV/index.html">ENV</a></span><span> = <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Construct, inspect, and update <a href="#type-t"><code>t</code></a> configurations, drawing defaults from the environment and encapsulating state</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Env"><a href="#module-Env" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Env/index.html">Env</a></span><span> () : <a href="module-type-ENV/index.html">ENV</a></span></code></div><div class="spec-doc"><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="#type-t"><code>t</code></a> configuration record</p></div></div></div></body></html>