Comprehensive Java utility library providing infrastructure and helper classes for the Eclipse Jetty web server
—
Built-in statistics collection and monitoring capabilities for performance tracking and system diagnostics in server applications.
Counter-based statistics for tracking numeric values over time.
/**
* Counter-based statistic tracking
*/
public class CounterStatistic {
/** Create counter statistic */
public CounterStatistic();
/** Increment counter by 1 */
public void increment();
/** Decrement counter by 1 */
public void decrement();
/** Add value to counter */
public void add(long value);
/** Get current value */
public long getCurrent();
/** Get maximum value reached */
public long getMax();
/** Reset counter to zero */
public void reset();
/** Reset and get previous max */
public long resetMax();
}Rate-based statistics with time windows for monitoring throughput.
/**
* Rate-based statistics with time windows
*/
public class RateStatistic {
/** Create rate statistic with time window */
public RateStatistic(long timeWindow, TimeUnit unit);
/** Record an event */
public void record();
/** Get current rate per second */
public double getRate();
/** Get rate for oldest time window */
public double getOldestRate();
/** Get total event count */
public long getTotal();
}Sampling-based statistics for analyzing value distributions.
/**
* Sampling-based statistics
*/
public class SampleStatistic {
/** Create sample statistic */
public SampleStatistic();
/** Set current value */
public void set(long value);
/** Get maximum value */
public long getMax();
/** Get minimum value */
public long getMin();
/** Get mean value */
public double getMean();
/** Get standard deviation */
public double getStdDev();
/** Get sample count */
public long getCount();
/** Reset all statistics */
public void reset();
}Usage Examples:
import org.eclipse.jetty.util.statistic.*;
import java.util.concurrent.TimeUnit;
// Request counter
CounterStatistic requestCounter = new CounterStatistic();
requestCounter.increment(); // Track each request
System.out.println("Requests: " + requestCounter.getCurrent());
System.out.println("Peak: " + requestCounter.getMax());
// Request rate monitoring
RateStatistic requestRate = new RateStatistic(60, TimeUnit.SECONDS);
requestRate.record(); // Record each request
double rps = requestRate.getRate(); // Requests per second
// Response time statistics
SampleStatistic responseTime = new SampleStatistic();
responseTime.set(150); // Record response time in ms
System.out.println("Avg response: " + responseTime.getMean() + "ms");
System.out.println("Max response: " + responseTime.getMax() + "ms");Statistics are commonly used for:
Install with Tessl CLI
npx tessl i tessl/maven-org-eclipse-jetty--jetty-util