@JsonProperty("timeToLastByte") public Duration getTimeToLastByteDuration() { return new Duration(timeToLastByte, MILLISECONDS); }
@JsonProperty public Duration getTimeToRequestEnd() { return new Duration(beginToEndMillis, MILLISECONDS); }
@JsonProperty public Duration getTimeToDispatch() { return new Duration(beginToDispatchMillis, MILLISECONDS); }
@Nullable @JsonProperty public Duration getTimeResponseContent() { if (firstToLastContentTimeInMillis < 0) { return null; } return new Duration(firstToLastContentTimeInMillis, MILLISECONDS); }
@JsonProperty public Duration getMax() { return new Duration(stats.getMax(), MILLISECONDS); }
private static double nanosToMillis(long nanos) { return new Duration(nanos, NANOSECONDS).getValue(MILLISECONDS); }
static RetryBudget tokenRetryBudget(BigDecimal retryBudgetRatio, Duration retryBudgetRatioPeriod, int retryBudgetMinPerSecond, Ticker ticker) { checkArgument(retryBudgetRatio.compareTo(ZERO) >= 0, "retryBudgetRatio must be non-negative"); checkArgument(retryBudgetRatio.compareTo(SCALE_FACTOR) <= 0, "retryBudgetRatio must be no greater than " + SCALE_FACTOR); checkArgument(retryBudgetRatioPeriod.compareTo(new Duration(1, SECONDS)) >= 0, " retryBudgetRatioPeriod must be at least 1s"); checkArgument(retryBudgetRatioPeriod.compareTo(new Duration(60, SECONDS)) <= 0, " retryBudgetRatioPeriod must be at most 60s"); checkArgument(retryBudgetMinPerSecond >= 0, "retryBudgetMinPerSecond must be non-negative"); if (retryBudgetRatio.equals(ZERO) && retryBudgetMinPerSecond == 0) { return NoRetryBudget.INSTANCE; } return new TokenRetryBudget(retryBudgetRatio, retryBudgetRatioPeriod, retryBudgetMinPerSecond, ticker); }
public Command setTimeLimit(double value, TimeUnit timeUnit) { return setTimeLimit(new Duration(value, timeUnit)); }
public static <T> Appender<T> createFileAppender(String logPath, int maxHistory, DataSize maxFileSize, DataSize maxTotalSize, Encoder<T> encoder, Context context) { return createFileAppender(logPath, maxHistory, 0, new Duration(0, SECONDS), maxFileSize, maxTotalSize, encoder, context); }
@Override public Duration backoff(Duration previousBackoff) { long prev = previousBackoff.roundTo(TimeUnit.NANOSECONDS); long range = Math.abs(prev * 3 - min); long randBackoff; if (range == 0) { randBackoff = min; } else { randBackoff = min + ThreadLocalRandom.current().nextLong(range); } long backoff = Math.min(max, randBackoff); return new Duration(backoff, TimeUnit.NANOSECONDS); } }
@Managed public String getKeepAliveTime() { return new Duration(threadPoolExecutor.getKeepAliveTime(NANOSECONDS), NANOSECONDS) .convertToMostSuccinctTimeUnit() .toString(); }
state.set("FAILED"); long responseStart = System.nanoTime(); Duration requestProcessingTime = new Duration(responseStart - requestStart, TimeUnit.NANOSECONDS); if (e instanceof Exception) { if (e instanceof InterruptedException) { 0, requestProcessingTime, new Duration(0, TimeUnit.NANOSECONDS)); throw (Error) e; Duration requestProcessingTime = new Duration(responseStart - requestStart, TimeUnit.NANOSECONDS); try { return responseHandler.handle(request, response);
@Override public void log(Request request, Response response) { Duration requestTime = new Duration(max(0, System.currentTimeMillis() - request.getTimeStamp()), TimeUnit.MILLISECONDS); SSLSession sslSession = (SSLSession) request.getAttribute(REQUEST_SSL_SESSION_ATTRIBUTE); stats.record(request.getContentRead(), response.getContentCount(), requestTime); detailedRequestStats.requestTimeByCode(response.getStatus(), response.getStatus() / 100).add(requestTime); if (sslSession != null) { detailedRequestStats.tlsRequest(sslSession.getProtocol(), sslSession.getCipherSuite()).add(1); } } }
static void recordRequestComplete(RequestStats requestStats, Request request, long requestStart, long bytesWritten, JettyResponse response, long responseStart) { if (response == null) { return; } Duration responseProcessingTime = Duration.nanosSince(responseStart); Duration requestProcessingTime = new Duration(responseStart - requestStart, NANOSECONDS); requestStats.record(request.getMethod(), response.getStatusCode(), bytesWritten, response.getBytesRead(), requestProcessingTime, responseProcessingTime); } }
Duration requestProcessingTime = new Duration(responseStart - requestStart, TimeUnit.NANOSECONDS);
stateManager, serviceInventory, new Duration(100, TimeUnit.DAYS), true);
JsonRequestLog(HttpServerConfig config) { appender = Logging.createFileAppender( config.getLogPath(), config.getLogMaxHistory(), config.getLogQueueSize(), new Duration(10, SECONDS), config.getLogMaxSegmentSize(), config.getLogMaxTotalSize(), new EventEncoder(), new ContextBase()); }
DelimitedRequestLog(HttpServerConfig config) { appender = Logging.createFileAppender( config.getLogPath(), config.getLogMaxHistory(), config.getLogQueueSize(), new Duration(10, SECONDS), config.getLogMaxSegmentSize(), config.getLogMaxTotalSize(), new EventEncoder(), new ContextBase()); }