Exemplo n.º 1
0
 @PreDestroy
 public void shutdown() {
   request.stop();
   readBytes.stop();
   writtenBytes.stop();
   executor.shutdown();
 }
Exemplo n.º 2
0
 public void record(
     String method,
     int responseCode,
     long requestSizeInBytes,
     long responseSizeInBytes,
     Duration schedulingDelay,
     Duration requestProcessingTime) {
   request.update(1);
   requestTime.update((long) requestProcessingTime.toMillis());
   readBytes.update(requestSizeInBytes);
   writtenBytes.update(responseSizeInBytes);
 }
Exemplo n.º 3
0
  @Inject
  public RequestStats() {
    executor =
        new ScheduledThreadPoolExecutor(
            2,
            new ThreadFactoryBuilder()
                .setNameFormat("RequestStatsTicker-%s")
                .setDaemon(true)
                .build());

    request = new CounterStat(executor);
    requestTime = new TimeStat();
    readBytes = new MeterStat(executor);
    writtenBytes = new MeterStat(executor);

    request.start();
    readBytes.start();
    writtenBytes.start();
  }