js-libp2p/classes/_metrics_index_.metrics.html
2021-01-29 14:40:00 +01:00

811 lines
41 KiB
HTML

<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Metrics | libp2p - v0.30.6</title>
<meta name="description" content="Documentation for libp2p - v0.30.6">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<link href="https://unpkg.com/nord-highlightjs@0.1.0/dist/nord.css" rel="stylesheet" type="text/css" />
<style>
.toolbar-icon {
display: inline-block;
vertical-align: middle;
margin-left: 10px;
cursor: pointer;
}
.toolbar-icon-search {
box-sizing: border-box;
position: absolute;
overflow: hidden;
right: -40px;
width: 40px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
@media (min-width: 901px){
display: none
}
}
@media (min-width: 901px){
.toolbar-icon-menu {
display: none
}
.toolbar-icon-options {
display: none
}
}
.gg-menu {
transform: scale(var(--ggs,1))
}
.gg-menu,
.gg-menu::after,
.gg-menu::before {
box-sizing: border-box;
position: relative;
display: block;
width: 20px;
height: 2px;
border-radius: 3px;
background: currentColor
}
.gg-menu::after,
.gg-menu::before {
content: "";
position: absolute;
top: -6px
}
.gg-menu::after {
top: 6px
}
.gg-options {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 10px;
height: 2px;
box-shadow:
-3px 4px 0 0,
3px -4px 0 0
}
.gg-options::after,
.gg-options::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
width: 8px;
height: 8px;
border: 2px solid;
border-radius: 100%
}
.gg-options::before {
top: -7px;
left: -4px
}
.gg-options::after {
bottom: -7px;
right: -4px
}
.gg-search {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 16px;
height: 16px;
border: 2px solid;
border-radius: 100%;
margin-left: -4px;
margin-top: -4px
}
.gg-search::after {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
border-radius: 3px;
width: 2px;
height: 8px;
background: currentColor;
transform: rotate(-45deg);
top: 10px;
left: 12px
}
</style>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="toolbar-icon toolbar-icon-search"><i class="gg-search"></i></label>
<input id="tsd-search-field" type="text" />
</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">libp2p - v0.30.6</a>
</div>
<div class="table-cell" id="tsd-widgets">
<a href="#" class="toolbar-icon toolbar-icon-menu" data-toggle="menu"><i class="gg-menu"></i></a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../modules/_metrics_index_.html">metrics/index</a>
</li>
<li>
<a href="_metrics_index_.metrics.html">Metrics</a>
</li>
</ul>
<h1>Class Metrics</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{import(&#39;../connection-manager&#39;)} connectionManager</p>
</dd>
<dt>property</dt>
<dd><p>{number} [computeThrottleMaxQueueSize = defaultOptions.computeThrottleMaxQueueSize]</p>
</dd>
<dt>property</dt>
<dd><p>{number} [computeThrottleTimeout = defaultOptions.computeThrottleTimeout]</p>
</dd>
<dt>property</dt>
<dd><p>{number[]} [movingAverageIntervals = defaultOptions.movingAverageIntervals]</p>
</dd>
<dt>property</dt>
<dd><p>{number} [maxOldPeersRetention = defaultOptions.maxOldPeersRetention]</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">Metrics</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>References</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-reference tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#metricsoptions" class="tsd-kind-icon">Metrics<wbr>Options</a></li>
<li class="tsd-kind-reference tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#metricsproperties" class="tsd-kind-icon">Metrics<wbr>Properties</a></li>
<li class="tsd-kind-reference tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#multiaddrconnection" class="tsd-kind-icon">Multiaddr<wbr>Connection</a></li>
<li class="tsd-kind-reference tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#peerid" class="tsd-kind-icon">Peer<wbr>Id</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#_connectionmanager" class="tsd-kind-icon">_connection<wbr>Manager</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#_globalstats" class="tsd-kind-icon">_global<wbr>Stats</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#_oldpeers" class="tsd-kind-icon">_old<wbr>Peers</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><a href="_metrics_index_.metrics.html#_onmessage" class="tsd-kind-icon">_on<wbr>Message</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#_options" class="tsd-kind-icon">_options</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#_peerstats" class="tsd-kind-icon">_peer<wbr>Stats</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#_protocolstats" class="tsd-kind-icon">_protocol<wbr>Stats</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#_running" class="tsd-kind-icon">_running</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Accessors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#global" class="tsd-kind-icon">global</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#peers" class="tsd-kind-icon">peers</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#protocols" class="tsd-kind-icon">protocols</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#forpeer" class="tsd-kind-icon">for<wbr>Peer</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#forprotocol" class="tsd-kind-icon">for<wbr>Protocol</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#onpeerdisconnected" class="tsd-kind-icon">on<wbr>Peer<wbr>Disconnected</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#start" class="tsd-kind-icon">start</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#stop" class="tsd-kind-icon">stop</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#trackstream" class="tsd-kind-icon">track<wbr>Stream</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_metrics_index_.metrics.html#updateplaceholder" class="tsd-kind-icon">update<wbr>Placeholder</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_metrics_index_.metrics.html#mergestats" class="tsd-kind-icon">merge<wbr>Stats</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>References</h2>
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-class">
<a name="metricsoptions" class="tsd-anchor"></a>
<h3>Metrics<wbr>Options</h3>
Re-exports <a href="../modules/_metrics_index_.html#metricsoptions">MetricsOptions</a>
</section>
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-class">
<a name="metricsproperties" class="tsd-anchor"></a>
<h3>Metrics<wbr>Properties</h3>
Re-exports <a href="../modules/_metrics_index_.html#metricsproperties">MetricsProperties</a>
</section>
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-class">
<a name="multiaddrconnection" class="tsd-anchor"></a>
<h3>Multiaddr<wbr>Connection</h3>
Re-exports <a href="../modules/_metrics_index_.html#multiaddrconnection">MultiaddrConnection</a>
</section>
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-class">
<a name="peerid" class="tsd-anchor"></a>
<h3>Peer<wbr>Id</h3>
Re-exports <a href="../modules/_metrics_index_.html#peerid">PeerId</a>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Metrics<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><a href="_metrics_index_.metrics.html#metricsproperties" class="tsd-signature-type">MetricsProperties</a><span class="tsd-signature-symbol"> &amp; </span><a href="_metrics_index_.metrics.html#metricsoptions" class="tsd-signature-type">MetricsOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_metrics_index_.metrics.html" class="tsd-signature-type">Metrics</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>options: <a href="_metrics_index_.metrics.html#metricsproperties" class="tsd-signature-type">MetricsProperties</a><span class="tsd-signature-symbol"> &amp; </span><a href="_metrics_index_.metrics.html#metricsoptions" class="tsd-signature-type">MetricsOptions</a></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_metrics_index_.metrics.html" class="tsd-signature-type">Metrics</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="_connectionmanager" class="tsd-anchor"></a>
<h3>_connection<wbr>Manager</h3>
<div class="tsd-signature tsd-kind-icon">_connection<wbr>Manager<span class="tsd-signature-symbol">:</span> <a href="_connection_manager_index_.connectionmanager.html" class="tsd-signature-type">ConnectionManager</a></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="_globalstats" class="tsd-anchor"></a>
<h3>_global<wbr>Stats</h3>
<div class="tsd-signature tsd-kind-icon">_global<wbr>Stats<span class="tsd-signature-symbol">:</span> <a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="_oldpeers" class="tsd-anchor"></a>
<h3>_old<wbr>Peers</h3>
<div class="tsd-signature tsd-kind-icon">_old<wbr>Peers<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private">
<a name="_onmessage" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagPrivate">Private</span> _on<wbr>Message</h3>
<div class="tsd-signature tsd-kind-icon">_on<wbr>Message<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Takes the metadata for a message and tracks it in the
appropriate categories. If the protocol is present, protocol
stats will also be tracked.</p>
</div>
<dl class="tsd-comment-tags">
<dt>param</dt>
<dd></dd>
<dt>param</dt>
<dd><p>Remote peer</p>
</dd>
<dt>param</dt>
<dd><p>Protocol string the stream is running</p>
</dd>
<dt>param</dt>
<dd><p>One of [&#39;in&#39;,&#39;out&#39;]</p>
</dd>
<dt>param</dt>
<dd><p>Size of the message</p>
</dd>
<dt>returns</dt>
<dd></dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="_options" class="tsd-anchor"></a>
<h3>_options</h3>
<div class="tsd-signature tsd-kind-icon">_options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="_peerstats" class="tsd-anchor"></a>
<h3>_peer<wbr>Stats</h3>
<div class="tsd-signature tsd-kind-icon">_peer<wbr>Stats<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="_protocolstats" class="tsd-anchor"></a>
<h3>_protocol<wbr>Stats</h3>
<div class="tsd-signature tsd-kind-icon">_protocol<wbr>Stats<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="_running" class="tsd-anchor"></a>
<h3>_running</h3>
<div class="tsd-signature tsd-kind-icon">_running<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Accessors</h2>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="global" class="tsd-anchor"></a>
<h3>global</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> global<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Gets the global <code>Stats</code> object</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="peers" class="tsd-anchor"></a>
<h3>peers</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> peers<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Returns a list of <code>PeerId</code> strings currently being tracked</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="protocols" class="tsd-anchor"></a>
<h3>protocols</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> protocols<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Returns a list of all protocol strings currently being tracked.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="forpeer" class="tsd-anchor"></a>
<h3>for<wbr>Peer</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">for<wbr>Peer<span class="tsd-signature-symbol">(</span>peerId<span class="tsd-signature-symbol">: </span><a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Returns the <code>Stats</code> object for the given <code>PeerId</code> whether it
is a live peer, or in the disconnected peer LRU cache.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>peerId: <a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="forprotocol" class="tsd-anchor"></a>
<h3>for<wbr>Protocol</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">for<wbr>Protocol<span class="tsd-signature-symbol">(</span>protocol<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Returns the <code>Stats</code> object for the given <code>protocol</code>.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>protocol: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="onpeerdisconnected" class="tsd-anchor"></a>
<h3>on<wbr>Peer<wbr>Disconnected</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">on<wbr>Peer<wbr>Disconnected<span class="tsd-signature-symbol">(</span>peerId<span class="tsd-signature-symbol">: </span><a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Should be called when all connections to a given peer
have closed. The <code>Stats</code> collection for the peer will
be stopped and moved to an LRU for temporary retention.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>peerId: <a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a></h5>
<div class="tsd-comment tsd-typography">
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="start" class="tsd-anchor"></a>
<h3>start</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">start<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Must be called for stats to saved. Any data pushed for tracking
will be ignored.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="stop" class="tsd-anchor"></a>
<h3>stop</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">stop<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Stops all averages timers and prevents new data from being tracked.
Once <code>stop</code> is called, <code>start</code> must be called to resume stats tracking.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="trackstream" class="tsd-anchor"></a>
<h3>track<wbr>Stream</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">track<wbr>Stream<span class="tsd-signature-symbol">(</span>__namedParameters<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>protocol<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>remotePeer<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a><span class="tsd-signature-symbol">; </span>stream<span class="tsd-signature-symbol">: </span><a href="_metrics_index_.metrics.html#multiaddrconnection" class="tsd-signature-type">MultiaddrConnection</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_metrics_index_.metrics.html#multiaddrconnection" class="tsd-signature-type">MultiaddrConnection</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Tracks data running through a given Duplex Iterable <code>stream</code>. If
the <code>peerId</code> is not provided, a placeholder string will be created and
returned. This allows lazy tracking of a peer when the peer is not yet known.
When the <code>PeerId</code> is known, <code>Metrics.updatePlaceholder</code> should be called
with the placeholder string returned from here, and the known <code>PeerId</code>.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>__namedParameters: <span class="tsd-signature-symbol">{ </span>protocol<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>remotePeer<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a><span class="tsd-signature-symbol">; </span>stream<span class="tsd-signature-symbol">: </span><a href="_metrics_index_.metrics.html#multiaddrconnection" class="tsd-signature-type">MultiaddrConnection</a><span class="tsd-signature-symbol"> }</span></h5>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5>protocol<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5>
</li>
<li class="tsd-parameter">
<h5>remote<wbr>Peer<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a></h5>
</li>
<li class="tsd-parameter">
<h5>stream<span class="tsd-signature-symbol">: </span><a href="_metrics_index_.metrics.html#multiaddrconnection" class="tsd-signature-type">MultiaddrConnection</a></h5>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_metrics_index_.metrics.html#multiaddrconnection" class="tsd-signature-type">MultiaddrConnection</a></h4>
<p>The peerId string or placeholder string</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="updateplaceholder" class="tsd-anchor"></a>
<h3>update<wbr>Placeholder</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">update<wbr>Placeholder<span class="tsd-signature-symbol">(</span>placeholder<span class="tsd-signature-symbol">: </span><a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a>, peerId<span class="tsd-signature-symbol">: </span><a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Replaces the <code>PeerId</code> string with the given <code>peerId</code>.
If stats are already being tracked for the given <code>peerId</code>, the
placeholder stats will be merged with the existing stats.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>placeholder: <a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a></h5>
<div class="tsd-comment tsd-typography">
<p>A peerId string</p>
</div>
</li>
<li>
<h5>peerId: <a href="../modules/_metrics_index_.html#peerid" class="tsd-signature-type">PeerId</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a name="mergestats" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> merge<wbr>Stats</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">merge<wbr>Stats<span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a>, other<span class="tsd-signature-symbol">: </span><a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Merges <code>other</code> into <code>target</code>. <code>target</code> will be modified
and returned.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>target: <a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></h5>
</li>
<li>
<h5>other: <a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_metrics_stats_.stats.html" class="tsd-signature-type">Stats</a></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="current tsd-kind-module">
<a href="../modules/_metrics_index_.html">metrics/index</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-module">
<a href="_metrics_index_.metrics.html" class="tsd-kind-icon">Metrics</a>
<ul>
<li class=" tsd-kind-reference tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#metricsoptions" class="tsd-kind-icon">Metrics<wbr>Options</a>
</li>
<li class=" tsd-kind-reference tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#metricsproperties" class="tsd-kind-icon">Metrics<wbr>Properties</a>
</li>
<li class=" tsd-kind-reference tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#multiaddrconnection" class="tsd-kind-icon">Multiaddr<wbr>Connection</a>
</li>
<li class=" tsd-kind-reference tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#peerid" class="tsd-kind-icon">Peer<wbr>Id</a>
</li>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#_connectionmanager" class="tsd-kind-icon">_connection<wbr>Manager</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#_globalstats" class="tsd-kind-icon">_global<wbr>Stats</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#_oldpeers" class="tsd-kind-icon">_old<wbr>Peers</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-private">
<a href="_metrics_index_.metrics.html#_onmessage" class="tsd-kind-icon">_on<wbr>Message</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#_options" class="tsd-kind-icon">_options</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#_peerstats" class="tsd-kind-icon">_peer<wbr>Stats</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#_protocolstats" class="tsd-kind-icon">_protocol<wbr>Stats</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#_running" class="tsd-kind-icon">_running</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#global" class="tsd-kind-icon">global</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#peers" class="tsd-kind-icon">peers</a>
</li>
<li class=" tsd-kind-get-signature tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#protocols" class="tsd-kind-icon">protocols</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#forpeer" class="tsd-kind-icon">for<wbr>Peer</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#forprotocol" class="tsd-kind-icon">for<wbr>Protocol</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#onpeerdisconnected" class="tsd-kind-icon">on<wbr>Peer<wbr>Disconnected</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#start" class="tsd-kind-icon">start</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#stop" class="tsd-kind-icon">stop</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#trackstream" class="tsd-kind-icon">track<wbr>Stream</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_metrics_index_.metrics.html#updateplaceholder" class="tsd-kind-icon">update<wbr>Placeholder</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a href="_metrics_index_.metrics.html#mergestats" class="tsd-kind-icon">merge<wbr>Stats</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-type-alias tsd-parent-kind-module tsd-is-not-exported">
<a href="../modules/_metrics_index_.html#metricsoptions" class="tsd-kind-icon">Metrics<wbr>Options</a>
</li>
<li class=" tsd-kind-type-alias tsd-parent-kind-module tsd-is-not-exported">
<a href="../modules/_metrics_index_.html#metricsproperties" class="tsd-kind-icon">Metrics<wbr>Properties</a>
</li>
<li class=" tsd-kind-type-alias tsd-parent-kind-module tsd-is-not-exported">
<a href="../modules/_metrics_index_.html#multiaddrconnection" class="tsd-kind-icon">Multiaddr<wbr>Connection</a>
</li>
<li class=" tsd-kind-type-alias tsd-parent-kind-module tsd-is-not-exported">
<a href="../modules/_metrics_index_.html#peerid" class="tsd-kind-icon">Peer<wbr>Id</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer>
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-namespace"><span class="tsd-kind-icon">Namespace</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>