44 lines
56 KiB
HTML
44 lines
56 KiB
HTML
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@opentelemetry/instrumentation | OpenTelemetry SDK</title><meta name="description" content="Documentation for OpenTelemetry SDK"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">OpenTelemetry SDK</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">OpenTelemetry SDK</a></li><li><a href="_opentelemetry_instrumentation.html">@opentelemetry/instrumentation</a></li></ul><h1>Module @opentelemetry/instrumentation</h1></div><section class="tsd-panel tsd-typography"><a id="opentelemetry-instrumentation-for-web-and-node" class="tsd-anchor"></a><h1 class="tsd-anchor-link">OpenTelemetry Instrumentation for web and node<a href="#opentelemetry-instrumentation-for-web-and-node" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h1><p><a href="https://www.npmjs.com/package/@opentelemetry/instrumentation"><img src="https://badge.fury.io/js/%40opentelemetry%2Finstrumentation.svg" alt="NPM Published Version"></a>
|
|
<a href="https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat"><img src="https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat" alt="Apache License"></a></p>
|
|
<p><strong>Note: This is an experimental package under active development. New releases may include breaking changes.</strong></p>
|
|
<a id="installation" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation<a href="#installation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p><strong>Note: Much of OpenTelemetry JS documentation is written assuming the compiled application is run as CommonJS.</strong>
|
|
For more details on ECMAScript Modules vs CommonJS, refer to <a href="https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md">esm-support</a>.</p>
|
|
<pre><code class="bash"><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><span class="hl-1"> </span><span class="hl-3">--save</span><span class="hl-1"> </span><span class="hl-2">@opentelemetry/instrumentation</span>
|
|
</code><button type="button">Copy</button></pre>
|
|
|
|
<a id="usage-in-node" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Usage in Node<a href="#usage-in-node" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">InstrumentationBase</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-6">InstrumentationConfig</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-6">InstrumentationNodeModuleDefinition</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-6">InstrumentationNodeModuleFile</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">'@opentelemetry/instrumentation'</span><span class="hl-1">;</span><br/><br/><span class="hl-7">import</span><span class="hl-1"> </span><span class="hl-7">type</span><span class="hl-1"> </span><span class="hl-3">*</span><span class="hl-1"> </span><span class="hl-7">as</span><span class="hl-1"> </span><span class="hl-6">module_name_to_be_patched</span><span class="hl-1"> </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">'module_name_to_be_patched'</span><span class="hl-1">;</span><br/><br/><span class="hl-7">export</span><span class="hl-1"> </span><span class="hl-3">class</span><span class="hl-1"> </span><span class="hl-8">MyInstrumentation</span><span class="hl-1"> </span><span class="hl-3">extends</span><span class="hl-1"> </span><span class="hl-8">InstrumentationBase</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">constructor</span><span class="hl-1">(</span><span class="hl-6">config</span><span class="hl-1">: </span><span class="hl-8">InstrumentationConfig</span><span class="hl-1"> = {}) {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">(</span><span class="hl-2">'MyInstrumentation'</span><span class="hl-1">, </span><span class="hl-4">VERSION</span><span class="hl-1">, </span><span class="hl-6">config</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-5">/**</span><br/><span class="hl-5"> * Init method will be called when the plugin is constructed.</span><br/><span class="hl-5"> * It returns an `InstrumentationNodeModuleDefinition` which describes</span><br/><span class="hl-5"> * the node module to be instrumented and patched.</span><br/><span class="hl-5"> * It may also return a list of `InstrumentationNodeModuleDefinition`s if</span><br/><span class="hl-5"> * the plugin should patch multiple modules or versions.</span><br/><span class="hl-5"> */</span><br/><span class="hl-1"> </span><span class="hl-3">protected</span><span class="hl-1"> </span><span class="hl-0">init</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">module</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">InstrumentationNodeModuleDefinition</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">'module_name_to_be_patched'</span><span class="hl-1">,</span><br/><span class="hl-1"> [</span><span class="hl-2">'1.*'</span><span class="hl-1">],</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-6">_onPatchMain</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-6">_onUnPatchMain</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-5">// in case you need to patch additional files - this is optional</span><br/><span class="hl-1"> </span><span class="hl-8">module</span><span class="hl-1">.</span><span class="hl-6">files</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">(</span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_addPatchingMethod</span><span class="hl-1">());</span><br/><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-8">module</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-5">// you can also define more modules then just return an array of modules</span><br/><span class="hl-1"> </span><span class="hl-5">// return [module1, module2, ....]</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_onPatchMain</span><span class="hl-1">(</span><span class="hl-6">moduleExports</span><span class="hl-1">: </span><span class="hl-3">typeof</span><span class="hl-1"> </span><span class="hl-6">module_name_to_be_patched</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_wrap</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-6">moduleExports</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">'mainMethodName'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_patchMainMethodName</span><span class="hl-1">()</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-6">moduleExports</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_onUnPatchMain</span><span class="hl-1">(</span><span class="hl-6">moduleExports</span><span class="hl-1">: </span><span class="hl-3">typeof</span><span class="hl-1"> </span><span class="hl-6">module_name_to_be_patched</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_unwrap</span><span class="hl-1">(</span><span class="hl-6">moduleExports</span><span class="hl-1">, </span><span class="hl-2">'mainMethodName'</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_addPatchingMethod</span><span class="hl-1">(): </span><span class="hl-8">InstrumentationNodeModuleFile</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">file</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">InstrumentationNodeModuleFile</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">'module_name_to_be_patched/src/some_file.js'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-6">_onPatchMethodName</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-6">_onUnPatchMethodName</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-6">file</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_onPatchMethodName</span><span class="hl-1">(</span><span class="hl-6">moduleExports</span><span class="hl-1">: </span><span class="hl-3">typeof</span><span class="hl-1"> </span><span class="hl-6">module_name_to_be_patched</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_wrap</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-6">moduleExports</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">'methodName'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_patchMethodName</span><span class="hl-1">()</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-6">moduleExports</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_onUnPatchMethodName</span><span class="hl-1">(</span><span class="hl-6">moduleExports</span><span class="hl-1">: </span><span class="hl-3">typeof</span><span class="hl-1"> </span><span class="hl-6">module_name_to_be_patched</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_unwrap</span><span class="hl-1">(</span><span class="hl-6">moduleExports</span><span class="hl-1">, </span><span class="hl-2">'methodName'</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_patchMethodName</span><span class="hl-1">(): (</span><span class="hl-6">original</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-8">any</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">plugin</span><span class="hl-1"> = </span><span class="hl-3">this</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">methodName</span><span class="hl-1">(</span><span class="hl-6">original</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">patchMethodName</span><span class="hl-1">(</span><span class="hl-3">this</span><span class="hl-1">: </span><span class="hl-8">any</span><span class="hl-1">): </span><span class="hl-8">PromiseOrValue</span><span class="hl-1"><</span><span class="hl-8">module_name_to_be_patched</span><span class="hl-1">.</span><span class="hl-8">methodName</span><span class="hl-1">> {</span><br/><span class="hl-1"> </span><span class="hl-6">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'methodName'</span><span class="hl-1">, </span><span class="hl-3">arguments</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-6">original</span><span class="hl-1">.</span><span class="hl-0">apply</span><span class="hl-1">(</span><span class="hl-3">this</span><span class="hl-1">, </span><span class="hl-3">arguments</span><span class="hl-1">);</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_patchMainMethodName</span><span class="hl-1">(): (</span><span class="hl-6">original</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-8">any</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">plugin</span><span class="hl-1"> = </span><span class="hl-3">this</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">mainMethodName</span><span class="hl-1">(</span><span class="hl-6">original</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">patchMainMethodName</span><span class="hl-1">(</span><span class="hl-3">this</span><span class="hl-1">: </span><span class="hl-8">any</span><span class="hl-1">): </span><span class="hl-8">PromiseOrValue</span><span class="hl-1"><</span><span class="hl-8">module_name_to_be_patched</span><span class="hl-1">.</span><span class="hl-8">mainMethodName</span><span class="hl-1">> {</span><br/><span class="hl-1"> </span><span class="hl-6">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'mainMethodName'</span><span class="hl-1">, </span><span class="hl-3">arguments</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-6">original</span><span class="hl-1">.</span><span class="hl-0">apply</span><span class="hl-1">(</span><span class="hl-3">this</span><span class="hl-1">, </span><span class="hl-3">arguments</span><span class="hl-1">);</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-5">// Later, but before the module to instrument is required</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myInstrumentation</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">MyInstrumentation</span><span class="hl-1">();</span><br/><span class="hl-6">myInstrumentation</span><span class="hl-1">.</span><span class="hl-0">setTracerProvider</span><span class="hl-1">(</span><span class="hl-6">provider</span><span class="hl-1">); </span><span class="hl-5">// this is optional, only if global TracerProvider shouldn't be used</span><br/><span class="hl-6">myInstrumentation</span><span class="hl-1">.</span><span class="hl-0">setMeterProvider</span><span class="hl-1">(</span><span class="hl-6">meterProvider</span><span class="hl-1">); </span><span class="hl-5">// this is optional</span><br/><span class="hl-6">myInstrumentation</span><span class="hl-1">.</span><span class="hl-0">enable</span><span class="hl-1">();</span><br/><span class="hl-5">// or use Auto Loader</span>
|
|
</code><button type="button">Copy</button></pre>
|
|
|
|
<a id="usage-in-web" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Usage in Web<a href="#usage-in-web" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="typescript"><span class="hl-7">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">InstrumentationBase</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-6">InstrumentationConfig</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">'@opentelemetry/instrumentation'</span><span class="hl-1">;</span><br/><br/><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-6">Instrumentation</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-2">'@opentelemetry/instrumentation'</span><span class="hl-1">;</span><br/><br/><span class="hl-7">export</span><span class="hl-1"> </span><span class="hl-3">class</span><span class="hl-1"> </span><span class="hl-8">MyInstrumentation</span><span class="hl-1"> </span><span class="hl-3">extends</span><span class="hl-1"> </span><span class="hl-8">InstrumentationBase</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">constructor</span><span class="hl-1">(</span><span class="hl-6">config</span><span class="hl-1">: </span><span class="hl-8">InstrumentationConfig</span><span class="hl-1"> = {}) {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">(</span><span class="hl-2">'MyInstrumentation'</span><span class="hl-1">, </span><span class="hl-4">VERSION</span><span class="hl-1">, </span><span class="hl-6">config</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-0">_patchOpen</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> (</span><span class="hl-6">original</span><span class="hl-1">: </span><span class="hl-8">OpenFunction</span><span class="hl-1">): </span><span class="hl-8">OpenFunction</span><span class="hl-1"> </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">plugin</span><span class="hl-1"> = </span><span class="hl-3">this</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">patchOpen</span><span class="hl-1">(</span><span class="hl-3">this</span><span class="hl-1">: </span><span class="hl-8">XMLHttpRequest</span><span class="hl-1">, ...</span><span class="hl-6">args</span><span class="hl-1">): </span><span class="hl-8">void</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'open'</span><span class="hl-1">, </span><span class="hl-3">arguments</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">return</span><span class="hl-1"> </span><span class="hl-6">original</span><span class="hl-1">.</span><span class="hl-0">apply</span><span class="hl-1">(</span><span class="hl-3">this</span><span class="hl-1">, </span><span class="hl-6">args</span><span class="hl-1">);</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">public</span><span class="hl-1"> </span><span class="hl-0">enable</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_wrap</span><span class="hl-1">(</span><span class="hl-8">XMLHttpRequest</span><span class="hl-1">.</span><span class="hl-6">prototype</span><span class="hl-1">, </span><span class="hl-2">'open'</span><span class="hl-1">, </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_patchOpen</span><span class="hl-1">());</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-3">public</span><span class="hl-1"> </span><span class="hl-0">disable</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-0">_unwrap</span><span class="hl-1">(</span><span class="hl-8">XMLHttpRequest</span><span class="hl-1">.</span><span class="hl-6">prototype</span><span class="hl-1">, </span><span class="hl-2">'open'</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-5">// Later</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myInstrumentation</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">MyInstrumentation</span><span class="hl-1">();</span><br/><span class="hl-6">myInstrumentation</span><span class="hl-1">.</span><span class="hl-0">setTracerProvider</span><span class="hl-1">(</span><span class="hl-6">provider</span><span class="hl-1">); </span><span class="hl-5">// this is optional, only if global TracerProvider shouldn't be used</span><br/><span class="hl-6">myInstrumentation</span><span class="hl-1">.</span><span class="hl-0">setMeterProvider</span><span class="hl-1">(</span><span class="hl-6">meterProvider</span><span class="hl-1">); </span><span class="hl-5">// this is optional, only if global MeterProvider shouldn't be used</span><br/><span class="hl-6">myInstrumentation</span><span class="hl-1">.</span><span class="hl-0">enable</span><span class="hl-1">();</span><br/><span class="hl-5">// or use Auto Loader</span>
|
|
</code><button type="button">Copy</button></pre>
|
|
|
|
<a id="autoloader" class="tsd-anchor"></a><h2 class="tsd-anchor-link">AutoLoader<a href="#autoloader" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="node---auto-loader" class="tsd-anchor"></a><h3 class="tsd-anchor-link">NODE - Auto Loader<a href="#node---auto-loader" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">B3Propagator</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/propagator-b3'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">registerInstrumentations</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/instrumentation'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">HttpInstrumentation</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/instrumentation-http'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">NodeTracerProvider</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/sdk-trace-node'</span><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">tracerProvider</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">NodeTracerProvider</span><span class="hl-1">();</span><br/><br/><span class="hl-6">tracerProvider</span><span class="hl-1">.</span><span class="hl-0">register</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-6">propagator:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">B3Propagator</span><span class="hl-1">(),</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">registerInstrumentations</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-6">instrumentations:</span><span class="hl-1"> [</span><br/><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">HttpInstrumentation</span><span class="hl-1">(),</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1"> </span><span class="hl-5">//tracerProvider: tracerProvider, // optional, only if global TracerProvider shouldn't be used</span><br/><span class="hl-1"> </span><span class="hl-5">//meterProvider: meterProvider, // optional, only if global MeterProvider shouldn't be used</span><br/><span class="hl-1">});</span><br/>
|
|
</code><button type="button">Copy</button></pre>
|
|
|
|
<a id="web---auto-loader" class="tsd-anchor"></a><h3 class="tsd-anchor-link">WEB - Auto Loader<a href="#web---auto-loader" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">B3Propagator</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/propagator-b3'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">registerInstrumentations</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/instrumentation'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">XMLHttpRequestInstrumentation</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/instrumentation-xml-http-request'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">WebTracerProvider</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'@opentelemetry/sdk-trace-web'</span><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">tracerProvider</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">WebTracerProvider</span><span class="hl-1">();</span><br/><br/><span class="hl-6">tracerProvider</span><span class="hl-1">.</span><span class="hl-0">register</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-6">propagator:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">B3Propagator</span><span class="hl-1">(),</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">registerInstrumentations</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-6">instrumentations:</span><span class="hl-1"> [</span><br/><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">XMLHttpRequestInstrumentation</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-6">ignoreUrls:</span><span class="hl-1"> [</span><span class="hl-12">/localhost/</span><span class="hl-1">],</span><br/><span class="hl-1"> </span><span class="hl-6">propagateTraceHeaderCorsUrls:</span><span class="hl-1"> [</span><br/><span class="hl-1"> </span><span class="hl-2">'http://localhost:8090'</span><span class="hl-1">,</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1"> }),</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1"> </span><span class="hl-5">//tracerProvider: tracerProvider, // optional, only if global TracerProvider shouldn't be used</span><br/><span class="hl-1"> </span><span class="hl-5">//meterProvider: meterProvider, // optional, only if global MeterProvider shouldn't be used</span><br/><span class="hl-1">});</span>
|
|
</code><button type="button">Copy</button></pre>
|
|
|
|
<a id="selection-of-the-used-tracerprovidermeterprovider" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Selection of the used TracerProvider/MeterProvider<a href="#selection-of-the-used-tracerprovidermeterprovider" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The <code>registerInstrumentations()</code> API allows to specify which <code>TracerProvider</code> and/or <code>MeterProvider</code> to use by the given options object.
|
|
If nothing is specified the global registered provider is used. Usually this is what most users want therefore it's recommended to keep this default.</p>
|
|
<p>There might be use case where someone has the need for more providers within an application. Please note that special care must be takes in such setups
|
|
to avoid leaking information from one provider to the other because there are a lot places where e.g. the global <code>ContextManager</code> or <code>Propagator</code> is used.</p>
|
|
<a id="instrumentation-for-ecmascript-modules-esm-in-nodejs-experimental" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Instrumentation for ECMAScript Modules (ESM) in Node.js (experimental)<a href="#instrumentation-for-ecmascript-modules-esm-in-nodejs-experimental" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Node.js uses a different module loader for ECMAScript Modules (ESM) vs. CommonJS (CJS).
|
|
A <code>require()</code> call will cause Node.js to use the CommonJS module loader.
|
|
An <code>import ...</code> statement or <code>import()</code> call will cause Node.js to use the ECMAScript module loader.</p>
|
|
<p>If your application is written in JavaScript as ESM, or it must compile to ESM from TypeScript, then a loader hook is required to properly patch instrumentation.
|
|
The custom hook for ESM instrumentation is <code>--experimental-loader=@opentelemetry/instrumentation/hook.mjs</code>.
|
|
This flag must be passed to the <code>node</code> binary, which is often done as a startup command and/or in the <code>NODE_OPTIONS</code> environment variable.</p>
|
|
<p>For more details on ECMAScript Modules vs CommonJS, refer to <a href="https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md">esm-support</a>.</p>
|
|
<a id="limitations" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Limitations<a href="#limitations" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Instrumentations for external modules (e.g. express, mongodb,...) hooks the <code>require</code> call or <code>import</code> statement. Therefore following conditions need to be met that this mechanism can work:</p>
|
|
<ul>
|
|
<li>Instrumentations are registered <strong>before</strong> the module to instrument is <code>require</code>ed (CJS only)</li>
|
|
<li>modules are not included in a bundle. Tools like <code>esbuild</code>, <code>webpack</code>, ... usually have some mechanism to exclude specific modules from bundling</li>
|
|
</ul>
|
|
<a id="license" class="tsd-anchor"></a><h2 class="tsd-anchor-link">License<a href="#license" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Apache 2.0 - See <a href="https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE">LICENSE</a> for more information.</p>
|
|
<p>Third-party licenses and copyright notices can be found in the <a href="./LICENSES">LICENSES directory</a>.</p>
|
|
<a id="useful-links" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Useful links<a href="#useful-links" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|
|
<li>For more information on OpenTelemetry, visit: <a href="https://opentelemetry.io/">https://opentelemetry.io/</a></li>
|
|
<li>For help or feedback on this project, join us in <a href="https://github.com/open-telemetry/opentelemetry-js/discussions">GitHub Discussions</a></li>
|
|
</ul>
|
|
</section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Enumerations"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Enumerations</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="semconvstability" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Enumeration"><use href="../assets/icons.svg#icon-8"></use></svg><a href="../enums/_opentelemetry_instrumentation.SemconvStability.html">SemconvStability</a><a href="#semconvstability" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Classes"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Classes</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="instrumentationbase" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><a href="../classes/_opentelemetry_instrumentation.InstrumentationBase.html">InstrumentationBase</a><a href="#instrumentationbase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="instrumentationnodemoduledefinition" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><a href="../classes/_opentelemetry_instrumentation.InstrumentationNodeModuleDefinition.html">InstrumentationNodeModuleDefinition</a><a href="#instrumentationnodemoduledefinition" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="instrumentationnodemodulefile" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><a href="../classes/_opentelemetry_instrumentation.InstrumentationNodeModuleFile.html">InstrumentationNodeModuleFile</a><a href="#instrumentationnodemodulefile" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Interfaces"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Interfaces</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="autoloaderoptions" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><a href="../interfaces/_opentelemetry_instrumentation.AutoLoaderOptions.html">AutoLoaderOptions</a><a href="#autoloaderoptions" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="autoloaderresult" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><a href="../interfaces/_opentelemetry_instrumentation.AutoLoaderResult.html">AutoLoaderResult</a><a href="#autoloaderresult" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="instrumentation" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><a href="../interfaces/_opentelemetry_instrumentation.Instrumentation.html">Instrumentation</a><a href="#instrumentation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="instrumentationconfig" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><a href="../interfaces/_opentelemetry_instrumentation.InstrumentationConfig.html">InstrumentationConfig</a><a href="#instrumentationconfig" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="instrumentationmoduledefinition" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><a href="../interfaces/_opentelemetry_instrumentation.InstrumentationModuleDefinition.html">InstrumentationModuleDefinition</a><a href="#instrumentationmoduledefinition" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="instrumentationmodulefile" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><a href="../interfaces/_opentelemetry_instrumentation.InstrumentationModuleFile.html">InstrumentationModuleFile</a><a href="#instrumentationmodulefile" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="shimwrapped" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><a href="../interfaces/_opentelemetry_instrumentation.ShimWrapped.html">ShimWrapped</a><a href="#shimwrapped" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Type Aliases"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Type Aliases</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="spancustomizationhook" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Type Alias"><use href="../assets/icons.svg#icon-2097152"></use></svg><a href="../types/_opentelemetry_instrumentation.SpanCustomizationHook.html">SpanCustomizationHook</a><a href="#spancustomizationhook" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Functions"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Functions</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="iswrapped" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/_opentelemetry_instrumentation.isWrapped.html">isWrapped</a><a href="#iswrapped" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="registerinstrumentations" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/_opentelemetry_instrumentation.registerInstrumentations.html">registerInstrumentations</a><a href="#registerinstrumentations" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="safeexecuteinthemiddle" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/_opentelemetry_instrumentation.safeExecuteInTheMiddle.html">safeExecuteInTheMiddle</a><a href="#safeexecuteinthemiddle" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="safeexecuteinthemiddleasync" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/_opentelemetry_instrumentation.safeExecuteInTheMiddleAsync.html">safeExecuteInTheMiddleAsync</a><a href="#safeexecuteinthemiddleasync" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="semconvstabilityfromstr" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/_opentelemetry_instrumentation.semconvStabilityFromStr.html">semconvStabilityFromStr</a><a href="#semconvstabilityfromstr" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#opentelemetry-instrumentation-for-web-and-node"><span>Open<wbr/>Telemetry <wbr/>Instrumentation for web and node</span></a><ul><li><a href="#installation"><span>Installation</span></a></li><li><a href="#usage-in-node"><span>Usage in <wbr/>Node</span></a></li><li><a href="#usage-in-web"><span>Usage in <wbr/>Web</span></a></li><li><a href="#autoloader"><span>Auto<wbr/>Loader</span></a></li><li><ul><li><a href="#node---auto-loader"><span>NODE -<wbr/> <wbr/>Auto <wbr/>Loader</span></a></li><li><a href="#web---auto-loader"><span>WEB -<wbr/> <wbr/>Auto <wbr/>Loader</span></a></li></ul></li><li><a href="#selection-of-the-used-tracerprovidermeterprovider"><span>Selection of the used <wbr/>Tracer<wbr/>Provider/<wbr/>Meter<wbr/>Provider</span></a></li><li><a href="#instrumentation-for-ecmascript-modules-esm-in-nodejs-experimental"><span>Instrumentation for ECMAScript <wbr/>Modules (ESM) in <wbr/>Node.js (experimental)</span></a></li><li><a href="#limitations"><span>Limitations</span></a></li><li><a href="#license"><span>License</span></a></li><li><a href="#useful-links"><span>Useful links</span></a></li></ul><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Enumerations"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Enumerations</summary><div><a href="#semconvstability" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Enumeration"><use href="../assets/icons.svg#icon-8"></use></svg><span>Semconv<wbr/>Stability</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Classes"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Classes</summary><div><a href="#instrumentationbase" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><span>Instrumentation<wbr/>Base</span></a><a href="#instrumentationnodemoduledefinition" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><span>Instrumentation<wbr/>Node<wbr/>Module<wbr/>Definition</span></a><a href="#instrumentationnodemodulefile" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><span>Instrumentation<wbr/>Node<wbr/>Module<wbr/>File</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Interfaces"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Interfaces</summary><div><a href="#autoloaderoptions" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><span>Auto<wbr/>Loader<wbr/>Options</span></a><a href="#autoloaderresult" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><span>Auto<wbr/>Loader<wbr/>Result</span></a><a href="#instrumentation" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><span>Instrumentation</span></a><a href="#instrumentationconfig" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><span>Instrumentation<wbr/>Config</span></a><a href="#instrumentationmoduledefinition" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><span>Instrumentation<wbr/>Module<wbr/>Definition</span></a><a href="#instrumentationmodulefile" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><span>Instrumentation<wbr/>Module<wbr/>File</span></a><a href="#shimwrapped" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Interface"><use href="../assets/icons.svg#icon-256"></use></svg><span>Shim<wbr/>Wrapped</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Type Aliases"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Type Aliases</summary><div><a href="#spancustomizationhook" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Type Alias"><use href="../assets/icons.svg#icon-2097152"></use></svg><span>Span<wbr/>Customization<wbr/>Hook</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Functions"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Functions</summary><div><a href="#iswrapped" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>is<wbr/>Wrapped</span></a><a href="#registerinstrumentations" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>register<wbr/>Instrumentations</span></a><a href="#safeexecuteinthemiddle" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>safe<wbr/>Execute<wbr/>In<wbr/>The<wbr/>Middle</span></a><a href="#safeexecuteinthemiddleasync" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>safe<wbr/>Execute<wbr/>In<wbr/>The<wbr/>Middle<wbr/>Async</span></a><a href="#semconvstabilityfromstr" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>semconv<wbr/>Stability<wbr/>From<wbr/>Str</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html">OpenTelemetry SDK</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|