| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_292) on Tue Jun 15 06:01:48 GMT 2021 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>LogThrottlingHelper (Apache Hadoop Common 3.3.1 API)</title> |
| <meta name="date" content="2021-06-15"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="LogThrottlingHelper (Apache Hadoop Common 3.3.1 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":9,"i2":10,"i3":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/LogThrottlingHelper.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/hadoop/log/LogLevel.html" title="class in org.apache.hadoop.log"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/hadoop/log/LogThrottlingHelper.html" target="_top">Frames</a></li> |
| <li><a href="LogThrottlingHelper.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.hadoop.log</div> |
| <h2 title="Class LogThrottlingHelper" class="title">Class LogThrottlingHelper</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.hadoop.log.LogThrottlingHelper</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">LogThrottlingHelper</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block">This is a class to help easily throttle log statements, so that they will |
| not be emitted more frequently than a certain rate. It is useful to help |
| prevent flooding the application logs with redundant messages. |
| |
| The instantiator specifies a minimum period at which statements should be |
| logged. When <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-double...-"><code>record(double...)</code></a> is called, if enough time has elapsed |
| since the last time it was called, the return value will indicate to the |
| caller that it should write to its actual log. Note that this class does not |
| write to any actual log; it only records information about how many times |
| <code>record</code> has been called and with what arguments, and indicates to the |
| caller whether or not it should write to its log. If not enough time has yet |
| elapsed, this class records the arguments and updates its summary |
| information, and indicates to the caller that it should not log. |
| |
| For example, say that you want to know whenever too large of a request is |
| received, but want to avoid flooding the logs if many such requests are |
| received. |
| <pre><code> |
| // Helper with a minimum period of 5 seconds |
| private LogThrottlingHelper helper = new LogThrottlingHelper(5000); |
| |
| public void receiveRequest(int requestedObjects) { |
| if (requestedObjects > MAXIMUM_REQUEST_SIZE) { |
| LogAction logAction = helper.record(requestedObjects); |
| if (logAction.shouldLog()) { |
| LOG.warn("Received {} large request(s) with a total of {} objects " + |
| "requested; maximum objects requested was {}", |
| logAction.getCount(), logAction.getStats(0).getSum(), |
| logAction.getStats(0).getMax()); |
| } |
| } |
| } |
| </code></pre> |
| The above snippet allows you to record extraneous events, but if they become |
| frequent, to limit their presence in the log to only every 5 seconds while |
| still maintaining overall information about how many large requests were |
| received. |
| |
| <p>This class can also be used to coordinate multiple logging points; see |
| <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-java.lang.String-long-double...-"><code>record(String, long, double...)</code></a> for more details. |
| |
| <p>This class is not thread-safe.</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Class and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a></span></code> |
| <div class="block">An indication of what action the caller should take.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#DO_NOT_LOG">DO_NOT_LOG</a></span></code> |
| <div class="block">A <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log"><code>LogThrottlingHelper.LogAction</code></a> representing a state that should not yet be logged.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#LogThrottlingHelper-long-">LogThrottlingHelper</a></span>(long minLogPeriodMs)</code> |
| <div class="block">Create a log helper without any primary recorder.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#LogThrottlingHelper-long-java.lang.String-">LogThrottlingHelper</a></span>(long minLogPeriodMs, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> primaryRecorderName)</code> |
| <div class="block">Create a log helper with a specified primary recorder name; this can be |
| used in conjunction with <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-java.lang.String-long-double...-"><code>record(String, long, double...)</code></a> to set up |
| primary and dependent recorders.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>org.apache.commons.math3.stat.descriptive.SummaryStatistics</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#getCurrentStats-java.lang.String-int-">getCurrentStats</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> recorderName, |
| int idx)</code> |
| <div class="block">Return the summary information for given index.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#getLogSupressionMessage-org.apache.hadoop.log.LogThrottlingHelper.LogAction-">getLogSupressionMessage</a></span>(<a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a> action)</code> |
| <div class="block">Helper function to create a message about how many log statements were |
| suppressed in the provided log action.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-double...-">record</a></span>(double... values)</code> |
| <div class="block">Record some set of values at the current time into this helper.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-java.lang.String-long-double...-">record</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> recorderName, |
| long currentTimeMs, |
| double... values)</code> |
| <div class="block">Record some set of values at the specified time into this helper.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="DO_NOT_LOG"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>DO_NOT_LOG</h4> |
| <pre>public static final <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a> DO_NOT_LOG</pre> |
| <div class="block">A <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log"><code>LogThrottlingHelper.LogAction</code></a> representing a state that should not yet be logged. |
| If any attempt is made to extract information from this, it will throw |
| an <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang"><code>IllegalStateException</code></a>.</div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="LogThrottlingHelper-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>LogThrottlingHelper</h4> |
| <pre>public LogThrottlingHelper(long minLogPeriodMs)</pre> |
| <div class="block">Create a log helper without any primary recorder.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#LogThrottlingHelper-long-java.lang.String-"><code>LogThrottlingHelper(long, String)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="LogThrottlingHelper-long-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>LogThrottlingHelper</h4> |
| <pre>public LogThrottlingHelper(long minLogPeriodMs, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> primaryRecorderName)</pre> |
| <div class="block">Create a log helper with a specified primary recorder name; this can be |
| used in conjunction with <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-java.lang.String-long-double...-"><code>record(String, long, double...)</code></a> to set up |
| primary and dependent recorders. See |
| <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-java.lang.String-long-double...-"><code>record(String, long, double...)</code></a> for more details.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>minLogPeriodMs</code> - The minimum period with which to log; do not log |
| more frequently than this.</dd> |
| <dd><code>primaryRecorderName</code> - The name of the primary recorder.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="record-double...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>record</h4> |
| <pre>public <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a> record(double... values)</pre> |
| <div class="block">Record some set of values at the current time into this helper. Note that |
| this does <i>not</i> actually write information to any log. Instead, this |
| will return a LogAction indicating whether or not the caller should write |
| to its own log. The LogAction will additionally contain summary information |
| about the values specified since the last time the caller was expected to |
| write to its log. |
| |
| <p>Specifying multiple values will maintain separate summary statistics |
| about each value. For example: |
| <pre><code> |
| helper.record(1, 0); |
| LogAction action = helper.record(3, 100); |
| action.getStats(0); // == 2 |
| action.getStats(1); // == 50 |
| </code></pre></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - The values about which to maintain summary information. Every |
| time this method is called, the same number of values must |
| be specified.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>A LogAction indicating whether or not the caller should write to |
| its log.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="record-java.lang.String-long-double...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>record</h4> |
| <pre>public <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a> record(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> recorderName, |
| long currentTimeMs, |
| double... values)</pre> |
| <div class="block">Record some set of values at the specified time into this helper. This can |
| be useful to avoid fetching the current time twice if the caller has |
| already done so for other purposes. This additionally allows the caller to |
| specify a name for this recorder. When multiple names are used, one is |
| denoted as the primary recorder. Only recorders named as the primary |
| will trigger logging; other names not matching the primary can <i>only</i> |
| be triggered by following the primary. This is used to coordinate multiple |
| logging points. A primary can be set via the |
| <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#LogThrottlingHelper-long-java.lang.String-"><code>LogThrottlingHelper(long, String)</code></a> constructor. If no primary |
| is set in the constructor, then the first recorder name used becomes the |
| primary. |
| |
| If multiple names are used, they maintain entirely different sets of values |
| and summary information. For example: |
| <pre><code> |
| // Initialize "pre" as the primary recorder name |
| LogThrottlingHelper helper = new LogThrottlingHelper(1000, "pre"); |
| LogAction preLog = helper.record("pre", Time.monotonicNow()); |
| if (preLog.shouldLog()) { |
| // ... |
| } |
| double eventsProcessed = ... // perform some action |
| LogAction postLog = |
| helper.record("post", Time.monotonicNow(), eventsProcessed); |
| if (postLog.shouldLog()) { |
| // ... |
| // Can use postLog.getStats(0) to access eventsProcessed information |
| } |
| </code></pre> |
| Since "pre" is the primary recorder name, logging to "pre" will trigger a |
| log action if enough time has elapsed. This will indicate that "post" |
| should log as well. This ensures that "post" is always logged in the same |
| iteration as "pre", yet each one is able to maintain its own summary |
| information. |
| |
| <p>Other behavior is the same as <a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-double...-"><code>record(double...)</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>recorderName</code> - The name of the recorder. This is used to check if the |
| current recorder is the primary. Other names are |
| arbitrary and are only used to differentiate between |
| distinct recorders.</dd> |
| <dd><code>currentTimeMs</code> - The current time.</dd> |
| <dd><code>values</code> - The values to log.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The LogAction for the specified recorder.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.html#record-double...-"><code>record(double...)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getCurrentStats-java.lang.String-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCurrentStats</h4> |
| <pre>public org.apache.commons.math3.stat.descriptive.SummaryStatistics getCurrentStats(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> recorderName, |
| int idx)</pre> |
| <div class="block">Return the summary information for given index.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>recorderName</code> - The name of the recorder.</dd> |
| <dd><code>idx</code> - The index value.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The summary information.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getLogSupressionMessage-org.apache.hadoop.log.LogThrottlingHelper.LogAction-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>getLogSupressionMessage</h4> |
| <pre>public static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getLogSupressionMessage(<a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log">LogThrottlingHelper.LogAction</a> action)</pre> |
| <div class="block">Helper function to create a message about how many log statements were |
| suppressed in the provided log action. If no statements were suppressed, |
| this returns an empty string. The message has the format (without quotes): |
| |
| <p>' (suppressed logging <i>{suppression_count}</i> times)'</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>action</code> - The log action to produce a message about.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>A message about suppression within this action.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/LogThrottlingHelper.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/hadoop/log/LogLevel.html" title="class in org.apache.hadoop.log"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/hadoop/log/LogThrottlingHelper.LogAction.html" title="interface in org.apache.hadoop.log"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/hadoop/log/LogThrottlingHelper.html" target="_top">Frames</a></li> |
| <li><a href="LogThrottlingHelper.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2008–2021 <a href="https://www.apache.org">Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |