# ClientMetrics

<div class="jsdoc-content"><header>
    
        <h2>
            <span class="ancestors"><a href="index.html">metrics</a>~</span>ClientMetrics</h2>
        
            <div class="class-description"><p>Represents a base class that is used to measure events from the server and the client as seen by the driver.</p></div>
        
    
</header>


    
        

        


<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L9" target="_blank" rel="noopener">metrics/client-metrics.js, line 9</a></p></div>


        
    
    

    

    

    

    

    

    

    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="onAuthenticationError"><span class="type-signature"></span>onAuthenticationError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an authentication error is obtained from the server.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">AuthenticationError</span>
|

<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error encountered.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L14" target="_blank" rel="noopener">metrics/client-metrics.js, line 14</a></p></div>




















        
            

    

    
    <h4 class="name" id="onClientTimeoutError"><span class="type-signature"></span>onClientTimeoutError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an error (different than a server or client timeout, authentication or connection error) is
encountered when executing a request.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">OperationTimedOutError</span>


            
            </td>

            

            

            <td class="description last"><p>The timeout error.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L21" target="_blank" rel="noopener">metrics/client-metrics.js, line 21</a></p></div>




















        
            

    

    
    <h4 class="name" id="onClientTimeoutRetry"><span class="type-signature"></span>onClientTimeoutRetry<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an execution is retried as a result of a client-level timeout.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error that caused the retry.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L58" target="_blank" rel="noopener">metrics/client-metrics.js, line 58</a></p></div>




















        
            

    

    
    <h4 class="name" id="onConnectionError"><span class="type-signature"></span>onConnectionError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when there is a connection error.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error encountered.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L27" target="_blank" rel="noopener">metrics/client-metrics.js, line 27</a></p></div>




















        
            

    

    
    <h4 class="name" id="onIgnoreError"><span class="type-signature"></span>onIgnoreError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an error is marked as ignored by the retry policy.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error that was ignored by the retry policy.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L89" target="_blank" rel="noopener">metrics/client-metrics.js, line 89</a></p></div>




















        
            

    

    
    <h4 class="name" id="onOtherError"><span class="type-signature"></span>onOtherError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an error (different than a server or client timeout, authentication or connection error) is
encountered when executing a request.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error encountered.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L34" target="_blank" rel="noopener">metrics/client-metrics.js, line 34</a></p></div>




















        
            

    

    
    <h4 class="name" id="onOtherErrorRetry"><span class="type-signature"></span>onOtherErrorRetry<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an error (other than a server or client timeout) is retried.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error that caused the retry.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L64" target="_blank" rel="noopener">metrics/client-metrics.js, line 64</a></p></div>




















        
            

    

    
    <h4 class="name" id="onReadTimeoutError"><span class="type-signature"></span>onReadTimeoutError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when a read timeout error is obtained from the server.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">ResponseError</span>


            
            </td>

            

            

            <td class="description last"><p>The error encountered.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L40" target="_blank" rel="noopener">metrics/client-metrics.js, line 40</a></p></div>




















        
            

    

    
    <h4 class="name" id="onReadTimeoutRetry"><span class="type-signature"></span>onReadTimeoutRetry<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an execution is retried as a result of a read timeout from the server (coordinator to replica).</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error that caused the retry.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L70" target="_blank" rel="noopener">metrics/client-metrics.js, line 70</a></p></div>




















        
            

    

    
    <h4 class="name" id="onResponse"><span class="type-signature"></span>onResponse<span class="signature">(latency)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when any response is obtained, the response can be the result of a successful execution or a
server-side error.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>latency</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;Number></span>


            
            </td>

            

            

            <td class="description last"><p>The latency represented in a <code>[seconds, nanoseconds]</code> tuple
Array, where nanoseconds is the remaining part of the real time that can't be represented in second precision.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L109" target="_blank" rel="noopener">metrics/client-metrics.js, line 109</a></p></div>




















        
            

    

    
    <h4 class="name" id="onSpeculativeExecution"><span class="type-signature"></span>onSpeculativeExecution<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when a speculative execution is started.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L94" target="_blank" rel="noopener">metrics/client-metrics.js, line 94</a></p></div>




















        
            

    

    
    <h4 class="name" id="onSuccessfulResponse"><span class="type-signature"></span>onSuccessfulResponse<span class="signature">(latency)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when a response is obtained successfully.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>latency</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;Number></span>


            
            </td>

            

            

            <td class="description last"><p>The latency represented in a <code>[seconds, nanoseconds]</code> tuple
Array, where nanoseconds is the remaining part of the real time that can't be represented in second precision.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L101" target="_blank" rel="noopener">metrics/client-metrics.js, line 101</a></p></div>




















        
            

    

    
    <h4 class="name" id="onUnavailableError"><span class="type-signature"></span>onUnavailableError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an unavailable error is obtained from the server.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">ResponseError</span>


            
            </td>

            

            

            <td class="description last"><p>The error encountered.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L52" target="_blank" rel="noopener">metrics/client-metrics.js, line 52</a></p></div>




















        
            

    

    
    <h4 class="name" id="onUnavailableRetry"><span class="type-signature"></span>onUnavailableRetry<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an execution is retried as a result of an unavailable error from the server.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error that caused the retry.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L76" target="_blank" rel="noopener">metrics/client-metrics.js, line 76</a></p></div>




















        
            

    

    
    <h4 class="name" id="onWriteTimeoutError"><span class="type-signature"></span>onWriteTimeoutError<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when a write timeout error is obtained from the server.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">ResponseError</span>


            
            </td>

            

            

            <td class="description last"><p>The error encountered.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L46" target="_blank" rel="noopener">metrics/client-metrics.js, line 46</a></p></div>




















        
            

    

    
    <h4 class="name" id="onWriteTimeoutRetry"><span class="type-signature"></span>onWriteTimeoutRetry<span class="signature">(e)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Method invoked when an execution is retried as a result of a write timeout from the server (coordinator to
replica).</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>e</code></td>
            

            <td class="type">
            
                
<span class="param-type">Error</span>


            
            </td>

            

            

            <td class="description last"><p>The error that caused the retry.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/metrics/client-metrics.js#L83" target="_blank" rel="noopener">metrics/client-metrics.js, line 83</a></p></div></div>
