Tabnine Logo
Timer.record
Code IndexAdd Tabnine to your IDE (free)

How to use
record
method
in
io.micrometer.core.instrument.Timer

Best Java code snippets using io.micrometer.core.instrument.Timer.record (Showing top 20 results out of 315)

origin: com.zaxxer/HikariCP

/** {@inheritDoc} */
@Override
public void recordConnectionAcquiredNanos(final long elapsedAcquiredNanos)
{
 connectionObtainTimer.record(elapsedAcquiredNanos, TimeUnit.NANOSECONDS);
}
origin: com.zaxxer/HikariCP

/** {@inheritDoc} */
@Override
public void recordConnectionUsageMillis(final long elapsedBorrowedMillis)
{
 connectionUsage.record(elapsedBorrowedMillis, TimeUnit.MILLISECONDS);
}
origin: com.zaxxer/HikariCP

  @Override
  public void recordConnectionCreatedMillis(long connectionCreatedMillis)
  {
   connectionCreation.record(connectionCreatedMillis, TimeUnit.MILLISECONDS);
  }
}
origin: relayrides/pushy

private void recordEndTimeForNotification(final long notificationId) {
  final long endTime = System.nanoTime();
  final Long startTime = this.notificationStartTimes.remove(notificationId);
  if (startTime != null) {
    this.notificationTimer.record(endTime - startTime, TimeUnit.NANOSECONDS);
  }
}
origin: alibaba/nacos

public static void logNotifyEvent(String dataId, String group, String tenant, String requestIpAppName, long ts,
                 String handleIp, String type, long delayed, String targetIp) {
  if (!LogUtil.traceLog.isInfoEnabled()) {
    return;
  }
  MetricsMonitor.getNotifyRtTimer().record(delayed, TimeUnit.MILLISECONDS);
  // 方便tlog切分
  if (StringUtils.isBlank(tenant)) {
    tenant = null;
  }
  //localIp | dataid | group | tenant | requestIpAppName | ts | handleIp | event | type | [delayed] | ext
  // (targetIp)
  LogUtil.traceLog.info("{}|{}|{}|{}|{}|{}|{}|{}|{}|{}|{}", LOCAL_IP, dataId, group, tenant,
    requestIpAppName, ts, handleIp, "notify", type, delayed, targetIp);
}
origin: alibaba/nacos

@Override
public HttpResult httpDelete(String path, List<String> headers, List<String> paramValues, String encoding, long readTimeoutMs) throws IOException {
  long start = System.currentTimeMillis();
  long end = 0;
  HttpResult result = null;
  try {
    result = httpAgent.httpDelete(path, headers, paramValues, encoding, readTimeoutMs);
  } catch (IOException e) {
    end = System.currentTimeMillis();
    MetricsMonitor.getConfigRequestMonitor("DELETE", path, "NA").record(end - start, TimeUnit.MILLISECONDS);
    throw e;
  }
  end = System.currentTimeMillis();
  MetricsMonitor.getConfigRequestMonitor("DELETE", path, String.valueOf(result.code)).record(end - start, TimeUnit.MILLISECONDS);
  return result;
}
origin: micrometer-metrics/micrometer

@Benchmark
public int sumTimedWithSupplier() {
  return timer.record(this::sum);
}
origin: alibaba/nacos

@Override
public HttpResult httpGet(String path, List<String> headers, List<String> paramValues, String encoding, long readTimeoutMs) throws IOException {
  long start = System.currentTimeMillis();
  long end = 0;
  HttpResult result = null;
  try {
    result = httpAgent.httpGet(path, headers, paramValues, encoding, readTimeoutMs);
  } catch (IOException e) {
    end = System.currentTimeMillis();
    MetricsMonitor.getConfigRequestMonitor("GET", path, "NA").record(end - start, TimeUnit.MILLISECONDS);
    throw e;
  }
  end = System.currentTimeMillis();
  MetricsMonitor.getConfigRequestMonitor("GET", path, String.valueOf(result.code)).record(end - start, TimeUnit.MILLISECONDS);
  return result;
}
origin: alibaba/nacos

@Override
public HttpResult httpPost(String path, List<String> headers, List<String> paramValues, String encoding, long readTimeoutMs) throws IOException {
  long start = System.currentTimeMillis();
  long end = 0;
  HttpResult result = null;
  try {
    result = httpAgent.httpPost(path, headers, paramValues, encoding, readTimeoutMs);
  } catch (IOException e) {
    end = System.currentTimeMillis();
    MetricsMonitor.getConfigRequestMonitor("POST", path, "NA").record(end - start, TimeUnit.MILLISECONDS);
    throw e;
  }
  end = System.currentTimeMillis();
  MetricsMonitor.getConfigRequestMonitor("POST", path, String.valueOf(result.code)).record(end - start, TimeUnit.MILLISECONDS);
  return result;
}
origin: micrometer-metrics/micrometer

@Benchmark
public int sumTimedWithRegistryLookup() {
  return registry.timer("timer").record(this::sum);
}
origin: alibaba/nacos

  ConfigTraceService.NOTIFY_EVENT_OK, delayed, serverIp);
MetricsMonitor.getNotifyRtTimer().record(delayed, TimeUnit.MILLISECONDS);
origin: alibaba/nacos

public String callServer(String api, Map<String, String> params, String curServer, String method)
  throws NacosException {
  long start = System.currentTimeMillis();
  long end = 0;
  List<String> headers = Arrays.asList("Client-Version", UtilAndComs.VERSION,
    "Accept-Encoding", "gzip,deflate,sdch",
    "Connection", "Keep-Alive",
    "RequestId", UuidUtils.generateUuid());
  String url;
  if (!curServer.contains(UtilAndComs.SERVER_ADDR_IP_SPLITER)) {
    curServer = curServer + UtilAndComs.SERVER_ADDR_IP_SPLITER + DEFAULT_SERVER_PORT;
  }
  url = HttpClient.getPrefix() + curServer + api;
  HttpClient.HttpResult result = HttpClient.request(url, headers, params, UtilAndComs.ENCODING, method);
  end = System.currentTimeMillis();
  MetricsMonitor.getNamingRequestMonitor(method, url, String.valueOf(result.code))
    .record(end - start, TimeUnit.MILLISECONDS);
  if (HttpURLConnection.HTTP_OK == result.code) {
    return result.content;
  }
  if (HttpURLConnection.HTTP_NOT_MODIFIED == result.code) {
    return StringUtils.EMPTY;
  }
  LogUtils.LOG.error("CALL-SERVER", "failed to req API:" + HttpClient.getPrefix() + curServer
    + api + ". code:"
    + result.code + " msg: " + result.content);
  throw new NacosException(NacosException.SERVER_ERROR, "failed to req API:" + HttpClient.getPrefix() + curServer
    + api + ". code:"
    + result.code + " msg: " + result.content);
}
origin: reactor/reactor-core

@Override
public void onNext(T t) {
  if (done) {
    this.malformedSourceCounter.increment();
    Operators.onNextDropped(t, actual.currentContext());
    return;
  }
  //record the delay since previous onNext/onSubscribe. This also records the count.
  long last = this.lastNextEventNanos;
  this.lastNextEventNanos = clock.monotonicTime();
  this.onNextIntervalTimer.record(lastNextEventNanos - last, TimeUnit.NANOSECONDS);
  actual.onNext(t);
}
origin: reactor/reactor-core

@Override
@Nullable
public T poll() {
  if (qs == null) {
    return null;
  }
  try {
    T v = qs.poll();
    if (v == null && fusionMode == SYNC) {
      //this is also a complete event
      this.subscribeToTerminateSample.stop(subscribeToCompleteTimer);
    }
    if (v != null) {
      //this is an onNext event
      //record the delay since previous onNext/onSubscribe. This also records the count.
      long last = this.lastNextEventNanos;
      this.lastNextEventNanos = clock.monotonicTime();
      this.onNextIntervalTimer.record(lastNextEventNanos - last, TimeUnit.NANOSECONDS);
    }
    return v;
  } catch (Throwable e) {
    //register a timer for that particular exception
    Timer timer = subscribeToErrorTimerFactory.apply(e);
    //record error termination
    this.subscribeToTerminateSample.stop(timer);
    throw e;
  }
}
origin: reactor/reactor-core

@Override
public void onNext(T t) {
  if (this.fusionMode == Fuseable.ASYNC) {
    actual.onNext(null);
    return;
  }
  if (done) {
    this.malformedSourceCounter.increment();
    Operators.onNextDropped(t, actual.currentContext());
    return;
  }
  //record the delay since previous onNext/onSubscribe. This also records the count.
  long last = this.lastNextEventNanos;
  this.lastNextEventNanos = clock.monotonicTime();
  this.onNextIntervalTimer.record(lastNextEventNanos - last, TimeUnit.NANOSECONDS);
  actual.onNext(t);
}
origin: spring-projects/spring-integration

@Override
public void record(long time, TimeUnit unit) {
  this.timer.record(time, unit);
}
origin: line/armeria

private static void onResponse(RequestLog log, MeterIdPrefixFunction meterIdPrefixFunction,
                ActiveRequestMetrics activeRequestMetrics) {
  final RequestContext ctx = log.context();
  final MeterRegistry registry = ctx.meterRegistry();
  final MeterIdPrefix idPrefix = meterIdPrefixFunction.apply(registry, log);
  final RequestMetrics metrics = MicrometerUtil.register(
      registry, idPrefix, RequestMetrics.class, DefaultRequestMetrics::new);
  if (log.requestCause() != null) {
    metrics.failure().increment();
    return;
  }
  metrics.requestDuration().record(log.requestDurationNanos(), TimeUnit.NANOSECONDS);
  metrics.requestLength().record(log.requestLength());
  metrics.responseDuration().record(log.responseDurationNanos(), TimeUnit.NANOSECONDS);
  metrics.responseLength().record(log.responseLength());
  metrics.totalDuration().record(log.totalDurationNanos(), TimeUnit.NANOSECONDS);
  if (isSuccess(log)) {
    metrics.success().increment();
  } else {
    metrics.failure().increment();
  }
  activeRequestMetrics.decrement();
}
origin: org.springframework.boot/spring-boot-actuator

private void success(ServerWebExchange exchange, long start) {
  Iterable<Tag> tags = this.tagsProvider.httpRequestTags(exchange, null);
  this.registry.timer(this.metricName, tags).record(System.nanoTime() - start,
      TimeUnit.NANOSECONDS);
}
origin: org.springframework.boot/spring-boot-actuator

private void error(ServerWebExchange exchange, long start, Throwable cause) {
  Iterable<Tag> tags = this.tagsProvider.httpRequestTags(exchange, cause);
  this.registry.timer(this.metricName, tags).record(System.nanoTime() - start,
      TimeUnit.NANOSECONDS);
}
origin: org.springframework.boot/spring-boot-actuator

@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
    ClientHttpRequestExecution execution) throws IOException {
  long startTime = System.nanoTime();
  ClientHttpResponse response = null;
  try {
    response = execution.execute(request, body);
    return response;
  }
  finally {
    getTimeBuilder(request, response).register(this.meterRegistry)
        .record(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
    urlTemplate.remove();
  }
}
io.micrometer.core.instrumentTimerrecord

Popular methods of Timer

  • builder
  • start
  • count
  • totalTime
  • getId
  • max
  • mean
  • takeSnapshot
  • recordCallable
  • wrap
  • baseTimeUnit
  • close
  • baseTimeUnit,
  • close,
  • histogramCountAtValue,
  • measure,
  • percentile

Popular in Java

  • Start an intent from android
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Runner (org.openjdk.jmh.runner)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now