ocaml-opentelemetry/dev/opentelemetry-cohttp-lwt/Opentelemetry_cohttp_lwt/Server/index.html
2022-08-15 18:04:09 +00:00

27 lines
No EOL
6.1 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>Server (opentelemetry-cohttp-lwt.Opentelemetry_cohttp_lwt.Server)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.1.1"/><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-cohttp-lwt</a> &#x00BB; <a href="../index.html">Opentelemetry_cohttp_lwt</a> &#x00BB; Server</nav><header class="odoc-preamble"><h1>Module <code><span>Opentelemetry_cohttp_lwt.Server</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value" id="val-trace" class="anchored"><a href="#val-trace" class="anchor"></a><code><span><span class="keyword">val</span> trace :
<span>?service_name:string <span class="arrow">&#45;&gt;</span></span>
<span>?attrs:<span><a href="../../../opentelemetry/Opentelemetry/Span/index.html#type-key_value">Otel.Span.key_value</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>( <span><span class="type-var">'conn</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Cohttp_lwt</span>.Request.t <span class="arrow">&#45;&gt;</span></span>
<span><span class="type-var">'body</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="xref-unresolved">Cohttp_lwt</span>.Response.t * <span class="type-var">'body</span>)</span> <span class="xref-unresolved">Lwt</span>.t</span> )</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="type-var">'conn</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Cohttp_lwt</span>.Request.t <span class="arrow">&#45;&gt;</span></span>
<span><span class="type-var">'body</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="xref-unresolved">Cohttp_lwt</span>.Response.t * <span class="type-var">'body</span>)</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p>Trace requests to a Cohttp server.</p><p>Use it like this:</p><p>let my_server callback = let callback_traced = Opentelemetry_cohttp_lwt.Server.trace ~service_name:&quot;my-service&quot; (fun _scope -&gt; callback) in Cohttp_lwt_unix.Server.create ~mode:(`TCP (`Port 8080)) (Server.make () ~callback:callback_traced)</p></div></div><div class="odoc-spec"><div class="spec value" id="val-with_" class="anchored"><a href="#val-with_" class="anchor"></a><code><span><span class="keyword">val</span> with_ :
<span>?trace_state:string <span class="arrow">&#45;&gt;</span></span>
<span>?service_name:string <span class="arrow">&#45;&gt;</span></span>
<span>?attrs:<span><a href="../../../opentelemetry/Opentelemetry/Span/index.html#type-key_value">Otel.Span.key_value</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span>?kind:<a href="../../../opentelemetry/Opentelemetry/Span/index.html#type-kind">Otel.Span.kind</a> <span class="arrow">&#45;&gt;</span></span>
<span>?links:<span><a href="../../../opentelemetry/Opentelemetry/Span_link/index.html#type-t">Otel.Span_link.t</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span>string <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Cohttp_lwt</span>.Request.t <span class="arrow">&#45;&gt;</span></span>
<span><span>( <span><span class="xref-unresolved">Cohttp_lwt</span>.Request.t <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="xref-unresolved">Lwt</span>.t</span> )</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="type-var">'a</span> <span class="xref-unresolved">Lwt</span>.t</span></span></code></div><div class="spec-doc"><p>Trace a new internal span.</p><p>Identical to <code>Opentelemetry_lwt.Trace.with_</code>, but fetches/stores the trace scope in the <code>x-ocaml-otel-traceparent</code> header in the request for convenience.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-get_trace_context" class="anchored"><a href="#val-get_trace_context" class="anchor"></a><code><span><span class="keyword">val</span> get_trace_context :
<span>?from:<span>[ `Internal <span>| `External</span> ]</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Cohttp_lwt</span>.Request.t <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../../opentelemetry/Opentelemetry/Trace/index.html#type-scope">Otel.Trace.scope</a> option</span></span></code></div><div class="spec-doc"><p>Get the tracing scope from the custom <code>x-ocaml-otel-traceparent</code> header added by <code>trace</code> and <code>with_</code>.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-set_trace_context" class="anchored"><a href="#val-set_trace_context" class="anchor"></a><code><span><span class="keyword">val</span> set_trace_context :
<span><a href="../../../opentelemetry/Opentelemetry/Trace/index.html#type-scope">Otel.Trace.scope</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Cohttp_lwt</span>.Request.t <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Cohttp_lwt</span>.Request.t</span></code></div><div class="spec-doc"><p>Set the tracing scope in the custom <code>x-ocaml-otel-traceparent</code> header used by <code>trace</code> and <code>with_</code>.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-remove_trace_context" class="anchored"><a href="#val-remove_trace_context" class="anchor"></a><code><span><span class="keyword">val</span> remove_trace_context : <span><span class="xref-unresolved">Cohttp_lwt</span>.Request.t <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Cohttp_lwt</span>.Request.t</span></code></div><div class="spec-doc"><p>Strip the custom <code>x-ocaml-otel-traceparent</code> header added by <code>trace</code> and <code>with_</code>.</p></div></div></div></body></html>