Auto Generated Documentation
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Spans represent periods of time in which a program was executing in a particular context."><meta name="keywords" content="rust, rustlang, rust-lang, span"><title>tracing::span - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `span` mod in crate `tracing`."><meta name="keywords" content="rust, rustlang, rust-lang, span"><title>tracing::span - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../tracing/index.html'><div class='logo-container'><img src='https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png' alt='logo'></div></a><p class="location">Module span</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div><p class="location"><a href="../index.html">tracing</a></p><div id="sidebar-vars" data-name="span" data-ty="mod" data-relpath="../"></div><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">tracing</a>::<wbr><a class="mod" href="">span</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/tracing/span.rs.html#1-1508" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Spans represent periods of time in which a program was executing in a
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../tracing/index.html'><div class='logo-container'><img src='https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png' alt='logo'></div></a><p class="location">Module span</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div><p class="location"><a href="../index.html">tracing</a></p><script>window.sidebarCurrent = {name: "span", ty: "mod", relpath: "../"};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/tracing/span.rs.html#1-1508" title="goto source code">[src]</a></span><span class="in-band">Module <a href="../index.html">tracing</a>::<wbr><a class="mod" href="">span</a></span></h1><div class="docblock"><p>Spans represent periods of time in which a program was executing in a
|
||||
particular context.</p>
|
||||
<p>A span consists of <a href="../field/index.html">fields</a>, user-defined key-value pairs of arbitrary data
|
||||
that describe the context the span represents, and a set of fixed attributes
|
||||
@@ -10,7 +10,7 @@ include:</p>
|
||||
<ul>
|
||||
<li>An <a href="struct.Id.html"><code>Id</code></a> assigned by the subscriber that uniquely identifies it in relation
|
||||
to other spans.</li>
|
||||
<li>The span’s <a href="#span-relationships">parent</a> in the trace tree.</li>
|
||||
<li>The span's <a href="#span-relationships">parent</a> in the trace tree.</li>
|
||||
<li><a href="../struct.Metadata.html">Metadata</a> that describes static characteristics of all spans
|
||||
originating from that callsite, such as its name, source code location,
|
||||
<a href="../struct.Level.html">verbosity level</a>, and the names of its fields.</li>
|
||||
@@ -21,8 +21,8 @@ following arguments, in order:</p>
|
||||
<ul>
|
||||
<li>The <a href="../struct.Metadata.html#method.target"><code>target</code></a> and/or <a href="#span-relationships"><code>parent</code></a> attributes, if the user wishes to
|
||||
override their default values.</li>
|
||||
<li>The span’s <a href="../struct.Level.html">verbosity level</a></li>
|
||||
<li>A string literal providing the span’s name.</li>
|
||||
<li>The span's <a href="../struct.Level.html">verbosity level</a></li>
|
||||
<li>A string literal providing the span's name.</li>
|
||||
<li>Finally, between zero and 32 arbitrary key/value fields.</li>
|
||||
</ul>
|
||||
<p>For example:</p>
|
||||
@@ -41,7 +41,7 @@ verbosity levels.</p>
|
||||
<h2 id="recording-span-creation" class="section-header"><a href="#recording-span-creation">Recording Span Creation</a></h2>
|
||||
<p>The <a href="struct.Attributes.html"><code>Attributes</code></a> type contains data associated with a span, and is
|
||||
provided to the <a href="../subscriber/trait.Subscriber.html"><code>Subscriber</code></a> when a new span is created. It contains
|
||||
the span’s metadata, the ID of <a href="#span-relationships">the span’s parent</a> if one was
|
||||
the span's metadata, the ID of <a href="#span-relationships">the span's parent</a> if one was
|
||||
explicitly set, and any fields whose values were recorded when the span was
|
||||
constructed. The subscriber, which is responsible for recording <code>tracing</code>
|
||||
data, can then store or record these values.</p>
|
||||
@@ -115,7 +115,7 @@ inside the span:</p>
|
||||
<h2 id="span-relationships" class="section-header"><a href="#span-relationships">Span Relationships</a></h2>
|
||||
<p>Spans form a tree structure — unless it is a root span, all spans have a
|
||||
<em>parent</em>, and may have one or more <em>children</em>. When a new span is created,
|
||||
the current span becomes the new span’s parent. The total execution time of
|
||||
the current span becomes the new span's parent. The total execution time of
|
||||
a span consists of the time spent in that span and in the entire subtree
|
||||
represented by its children. Thus, a parent span always lasts for at least
|
||||
as long as the longest-executing span in its subtree.</p>
|
||||
@@ -150,8 +150,8 @@ the <code>span!</code> macro. For example:</p>
|
||||
<span class="kw">let</span> <span class="ident">baz</span> <span class="op">=</span> <span class="macro">span</span><span class="macro">!</span>(<span class="ident">parent</span>: <span class="kw-2">&</span><span class="ident">foo</span>, <span class="ident">Level</span>::<span class="ident">INFO</span>, <span class="string">"baz"</span>);</pre></div>
|
||||
<p>A child span should typically be considered <em>part</em> of its parent. For
|
||||
example, if a subscriber is recording the length of time spent in various
|
||||
spans, it should generally include the time spent in a span’s children as
|
||||
part of that span’s duration.</p>
|
||||
spans, it should generally include the time spent in a span's children as
|
||||
part of that span's duration.</p>
|
||||
<p>In addition to having zero or one parent, a span may also <em>follow from</em> any
|
||||
number of other spans. This indicates a causal relationship between the span
|
||||
and the spans that it follows from, but a follower is <em>not</em> typically
|
||||
@@ -199,12 +199,12 @@ to be <em>idle</em>.</p>
|
||||
<p>Because spans may be entered and exited multiple times before they close,
|
||||
<a href="../subscriber/trait.Subscriber.html"><code>Subscriber</code></a>s have separate trait methods which are called to notify them
|
||||
of span exits and when span handles are dropped. When execution exits a
|
||||
span, <a href="../subscriber/trait.Subscriber.html#tymethod.exit"><code>exit</code></a> will always be called with that span’s ID to notify the
|
||||
span, <a href="../subscriber/trait.Subscriber.html#tymethod.exit"><code>exit</code></a> will always be called with that span's ID to notify the
|
||||
subscriber that the span has been exited. When span handles are dropped, the
|
||||
<a href="../subscriber/trait.Subscriber.html#method.drop_span"><code>drop_span</code></a> method is called with that span’s ID. The subscriber may use
|
||||
<a href="../subscriber/trait.Subscriber.html#method.drop_span"><code>drop_span</code></a> method is called with that span's ID. The subscriber may use
|
||||
this to determine whether or not the span will be entered again.</p>
|
||||
<p>If there is only a single handle with the capacity to exit a span, dropping
|
||||
that handle “closes” the span, since the capacity to enter it no longer
|
||||
that handle "closes" the span, since the capacity to enter it no longer
|
||||
exists. For example:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
@@ -227,7 +227,7 @@ given ID, then no more handles to the span with that ID exist. The
|
||||
subscriber may then treat it as closed.</p>
|
||||
<h1 id="when-to-use-spans" class="section-header"><a href="#when-to-use-spans">When to use spans</a></h1>
|
||||
<p>As a rule of thumb, spans should be used to represent discrete units of work
|
||||
(e.g., a given request’s lifetime in a server) or periods of time spent in a
|
||||
(e.g., a given request's lifetime in a server) or periods of time spent in a
|
||||
given context (e.g., time spent interacting with an instance of an external
|
||||
system, such as a database).</p>
|
||||
<p>Which scopes in a program correspond to new spans depend somewhat on user
|
||||
@@ -266,5 +266,4 @@ entered and is currently executing.</p>
|
||||
exists.</p>
|
||||
</td></tr></table><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<table><tr class="module-item"><td><a class="trait" href="trait.AsId.html" title="tracing::span::AsId trait">AsId</a></td><td class="docblock-short"><p>Trait implemented by types which have a span <code>Id</code>.</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tracing"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "tracing";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
Reference in New Issue
Block a user