com.netflix.servo.monitor.Timer.record()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中com.netflix.servo.monitor.Timer.record()方法的一些代码示例,展示了Timer.record()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.record()方法的具体详情如下:
包路径:com.netflix.servo.monitor.Timer
类名称:Timer
方法名:record

Timer.record介绍

[英]Record a new value for this timer.
[中]记录此计时器的新值。

代码示例

代码示例来源:origin: Netflix/servo

/**
 * Record a duration to the dynamic timer indicated by the provided config.
 * The units in which the timer is reported and the duration unit  are the same.
 *
 * @deprecated Use {@link DynamicTimer#record(MonitorConfig, java.util.concurrent.TimeUnit,
 * long, java.util.concurrent.TimeUnit)} instead.
 * The new method allows you to be specific about the units used for reporting the timer and
 * the units in which the duration is measured.
 */
public static void record(MonitorConfig config, long duration, TimeUnit unit) {
 INSTANCE.get(config, unit).record(duration, unit);
}

代码示例来源:origin: Netflix/servo

/**
 * {@inheritDoc}
 */
@Override
public void record(long duration, TimeUnit timeUnit) {
 getMonitorForCurrentContext().record(duration, timeUnit);
}

代码示例来源:origin: Netflix/servo

/**
 * Record result to the dynamic timer indicated by the provided config
 * with a TimeUnit of milliseconds.
 */
public static void record(MonitorConfig config, long duration) {
 INSTANCE.get(config, TimeUnit.MILLISECONDS).record(duration, TimeUnit.MILLISECONDS);
}

代码示例来源:origin: Netflix/servo

/**
 * Record a duration to the dynamic timer indicated by the provided config/reportUnit.
 *
 * @param config       Config to identify a particular timer instance to update.
 * @param reportUnit   The unit to use when reporting values to observers. For example if sent to
 *                     a typical time series graphing system this would be the unit
 *                     for the y-axis.
 *                     It is generally recommended to use base units for reporting, so
 *                     {@link TimeUnit#SECONDS} is the preferred value.
 * @param duration     Measured duration to record.
 * @param durationUnit Unit for the measured duration. This should typically be the unit used for
 *                     timing source. For example if using {@link System#nanoTime()}
 *                     the unit would be nanoseconds.
 */
public static void record(MonitorConfig config, TimeUnit reportUnit, long duration,
             TimeUnit durationUnit) {
 INSTANCE.get(config, reportUnit).record(duration, durationUnit);
}

代码示例来源:origin: Netflix/servo

/**
 * {@inheritDoc}
 */
@Override
@Deprecated
public void record(long duration) {
 Timer monitor = getMonitorForCurrentContext();
 monitor.record(duration, monitor.getTimeUnit());
}

代码示例来源:origin: Netflix/servo

/**
  * {@inheritDoc}
  */
 @Override
 public void stop() {
  super.stop();
  timer.record(getDuration(), TimeUnit.NANOSECONDS);
 }
}

代码示例来源:origin: Netflix/servo

@Test
public void testGetValue() throws Exception {
 Stopwatch s = DynamicTimer.start("test1", tagList);
 Timer c = getByName("test1");
 s.stop();
 // we don't call s.stop(), so we only have one recorded value
 assert c != null;
 assertEquals(c.getValue().longValue(), s.getDuration(TimeUnit.MILLISECONDS));
 c.record(13, TimeUnit.MILLISECONDS);
 long expected = (13 + s.getDuration(TimeUnit.MILLISECONDS)) / 2;
 assertEquals(c.getValue().longValue(), expected);
}

代码示例来源:origin: io.reactivex/rxnetty-servo

@Override
protected void onFlushSuccess(long duration, TimeUnit timeUnit) {
  decrementLongGauge(pendingFlushes);
  flushTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.servo/servo-core

/**
 * Record result to the dynamic timer indicated by the provided config
 * with a TimeUnit of milliseconds.
 */
public static void record(MonitorConfig config, long duration) {
 INSTANCE.get(config, TimeUnit.MILLISECONDS).record(duration, TimeUnit.MILLISECONDS);
}

代码示例来源:origin: io.reactivex/rxnetty-servo

@Override
protected void onFlushSuccess(long duration, TimeUnit timeUnit) {
  decrementLongGauge(pendingFlushes);
  flushTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty-servo

@Override
protected void onFlushSuccess(long duration, TimeUnit timeUnit) {
  decrementLongGauge(pendingFlushes);
  flushTimes.record(duration, timeUnit);
}

代码示例来源:origin: io.reactivex/rxnetty-servo

@Override
protected void onWriteSuccess(long duration, TimeUnit timeUnit, long bytesWritten) {
  decrementLongGauge(pendingWrites);
  this.bytesWritten.increment(bytesWritten);
  writeTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty-servo

@Override
protected void onWriteSuccess(long duration, TimeUnit timeUnit, long bytesWritten) {
  decrementLongGauge(pendingWrites);
  this.bytesWritten.increment(bytesWritten);
  writeTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty-servo

@Override
protected void onWriteSuccess(long duration, TimeUnit timeUnit, long bytesWritten) {
  decrementLongGauge(pendingWrites);
  this.bytesWritten.increment(bytesWritten);
  writeTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.servo/servo-core

/**
  * {@inheritDoc}
  */
 @Override
 public void stop() {
  super.stop();
  timer.record(getDuration(), TimeUnit.NANOSECONDS);
 }
}

代码示例来源:origin: io.reactivex/rxnetty-servo

@Override
protected void onWriteSuccess(long duration, TimeUnit timeUnit, long bytesWritten) {
  decrementLongGauge(pendingWrites);
  this.bytesWritten.increment(bytesWritten);
  writeTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty-servo

@Override
protected void onHandshakeSuccess(long duration, TimeUnit timeUnit) {
  decrementLongGauge(inflightHandshakes);
  incrementLongGauge(processedHandshakes);
  handshakeProcessingTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty-servo

@Override
protected void onConnectSuccess(long duration, TimeUnit timeUnit) {
  decrementLongGauge(pendingConnects);
  incrementLongGauge(liveConnections);
  connectionCount.increment();
  connectionTimes.record(duration, timeUnit);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty-servo

@Override
protected void onHandshakeFailure(long duration, TimeUnit timeUnit, Throwable throwable) {
  decrementLongGauge(inflightHandshakes);
  incrementLongGauge(processedHandshakes);
  incrementLongGauge(failedHandshakes);
  handshakeProcessingTimes.record(duration, timeUnit);
}

代码示例来源:origin: io.reactivex/rxnetty-servo

@Override
protected void onHandshakeFailure(long duration, TimeUnit timeUnit, Throwable throwable) {
  decrementLongGauge(inflightHandshakes);
  incrementLongGauge(processedHandshakes);
  incrementLongGauge(failedHandshakes);
  handshakeProcessingTimes.record(duration, timeUnit);
}

相关文章