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

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

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

origin: micrometer-metrics/micrometer

@Benchmark
public int sumTimedWithSample() {
  Timer.Sample sample = Timer.start(registry);
  int sum = sum();
  sample.stop(timer);
  return sum;
}
origin: reactor/reactor-core

@Override
public void onSubscribe(Subscription s) {
  if (Operators.validate(this.s, s)) {
    this.subscribedCounter.increment();
    this.subscribeToTerminateSample = Timer.start(clock);
    if (s instanceof Fuseable.QueueSubscription) {
      //noinspection unchecked
      this.qs = (Fuseable.QueueSubscription<T>) s;
    }
    this.s = s;
    actual.onSubscribe(this);
  }
}
origin: spring-cloud/spring-cloud-gateway

@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
  Sample sample = Timer.start(meterRegistry);
  return chain.filter(exchange).doOnSuccessOrError((aVoid, ex) -> {
    endTimerRespectingCommit(exchange, sample);
  });
}
origin: reactor/reactor-core

@Override
public void onSubscribe(Subscription s) {
  if (Operators.validate(this.s, s)) {
    this.subscribedCounter.increment();
    this.subscribeToTerminateSample = Timer.start(clock);
    this.lastNextEventNanos = clock.monotonicTime();
    if (s instanceof Fuseable.QueueSubscription) {
      //noinspection unchecked
      this.qs = (Fuseable.QueueSubscription<T>) s;
    }
    this.s = s;
    actual.onSubscribe(this);
  }
}
origin: rsocket/rsocket-java

Sample start() {
 return Timer.start(meterRegistry);
}
origin: yidongnan/grpc-spring-boot-starter

/**
 * Creates a new delegating ServerCall that will wrap the given server call to collect metrics.
 *
 * @param delegate The original call to wrap.
 * @param registry The registry to save the metrics to.
 * @param responseCounter The counter for incoming responses.
 * @param timerFunction A function that will return a timer for a given status code.
 */
public MetricCollectingServerCall(final ServerCall<Q, A> delegate, final MeterRegistry registry,
    final Counter responseCounter,
    final Function<Code, Timer> timerFunction) {
  super(delegate);
  this.responseCounter = responseCounter;
  this.timerFunction = timerFunction;
  this.timerSample = Timer.start(registry);
}
origin: yidongnan/grpc-spring-boot-starter

/**
 * Creates a new delegating ClientCallListener that will wrap the given client call listener to collect metrics.
 *
 * @param delegate The original call to wrap.
 * @param registry The registry to save the metrics to.
 * @param responseCounter The counter for incoming responses.
 * @param timerFunction A function that will return a timer for a given status code.
 */
public MetricCollectingClientCallListener(
    final ClientCall.Listener<A> delegate,
    final MeterRegistry registry,
    final Counter responseCounter,
    final Function<Code, Timer> timerFunction) {
  super(delegate);
  this.responseCounter = responseCounter;
  this.timerFunction = timerFunction;
  this.timerSample = Timer.start(registry);
}
origin: jooby-project/jooby

public Sample start(MeterRegistry registry) {
 if (longTask) {
  LongTaskTimer.Sample sample = LongTaskTimer.builder(name)
    .description(description)
    .tags(tags)
    .register(registry)
    .start();
  return () -> sample.stop();
 }
 Timer.Sample sample = Timer.start(registry);
 Timer timer = Timer.builder(name)
   .description(description)
   .tags(tags)
   .publishPercentileHistogram(histogram)
   .publishPercentiles(percentiles)
   .register(registry);
 return () -> sample.stop(timer);
}
origin: spring-projects/spring-integration

@Override
public SampleFacade start() {
  return new MicroSample(Timer.start(this.meterRegistry));
}
origin: org.springframework.boot/spring-boot-actuator

private TimingContext startAndAttachTimingContext(HttpServletRequest request) {
  Timer.Sample timerSample = Timer.start(this.registry);
  TimingContext timingContext = new TimingContext(timerSample);
  timingContext.attachTo(request);
  return timingContext;
}
origin: org.apache.camel/camel-micrometer

public MicrometerMessageHistory(MeterRegistry meterRegistry, Route route, NamedNode namedNode, MicrometerMessageHistoryNamingStrategy namingStrategy, long timestamp) {
  super(route.getId(), namedNode, timestamp);
  this.meterRegistry = meterRegistry;
  this.route = route;
  this.namingStrategy = namingStrategy;
  this.sample = Timer.start(meterRegistry);
}
origin: org.zalando/riptide-failsafe

@API(status = INTERNAL)
MetricsCircuitBreakerListener(final MeterRegistry registry, final String metricName,
    final ImmutableList<Tag> defaultTags) {
  this.registry = registry;
  this.metricName = metricName;
  this.defaultTags = defaultTags;
  this.sample = new AtomicReference<>(start(registry));
}
origin: org.zalando/riptide-failsafe

private void on(final State to) {
  final State from = state.getAndSet(to);
  final Sample last = sample.getAndSet(start(registry));
  if (from != CLOSED) {
    last.stop(registry.timer(metricName, tags(from)));
  }
}
origin: zalando/riptide

private void on(final State to) {
  final State from = state.getAndSet(to);
  final Sample last = sample.getAndSet(start(registry));
  if (from != CLOSED) {
    last.stop(registry.timer(metricName, tags(from)));
  }
}
origin: codecentric/spring-boot-starter-batch-web

protected Object profileMethod(ProceedingJoinPoint pjp) throws Throwable {
  Timer.Sample sample = Timer.start(meterRegistry);
  try {
    return pjp.proceed();
  } finally {
    sample.stop(meterRegistry.timer(MetricsListener.METRIC_NAME, Arrays.asList(//
        new ImmutableTag("context", getStepIdentifier()), //
        new ImmutableTag("method", ClassUtils.getShortName(pjp.getTarget().getClass()) + "."
            + pjp.getSignature().getName()))));
  }
}
origin: de.codecentric/batch-web-spring-boot-autoconfigure

protected Object profileMethod(ProceedingJoinPoint pjp) throws Throwable {
  Timer.Sample sample = Timer.start(meterRegistry);
  try {
    return pjp.proceed();
  } finally {
    sample.stop(meterRegistry.timer(MetricsListener.METRIC_NAME, Arrays.asList(//
        new ImmutableTag("context", getStepIdentifier()), //
        new ImmutableTag("method", ClassUtils.getShortName(pjp.getTarget().getClass()) + "."
            + pjp.getSignature().getName()))));
  }
}
origin: org.apache.camel/camel-micrometer

void handleStart(Exchange exchange, MeterRegistry registry, String metricsName) {
  String propertyName = getPropertyName(metricsName);
  Timer.Sample sample = getTimerSampleFromExchange(exchange, propertyName);
  if (sample == null) {
    sample = Timer.start(registry);
    exchange.setProperty(propertyName, sample);
  } else {
    LOG.warn("Timer \"{}\" already running", metricsName);
  }
}
origin: io.micrometer/micrometer-spring-legacy

TimingSampleContext(HttpServletRequest request, Object handlerObject) {
  timedAnnotations = annotations(handlerObject);
  timerSample = Timer.start(registry);
  longTaskTimerSamples = timedAnnotations.stream()
    .filter(Timed::longTask)
    .map(t -> LongTaskTimer.builder(t)
      .tags(tagsProvider.httpLongRequestTags(request, handlerObject))
      .register(registry)
      .start())
    .collect(Collectors.toList());
}
origin: io.projectreactor/reactor-core

@Override
public void onSubscribe(Subscription s) {
  if (Operators.validate(this.s, s)) {
    this.subscribedCounter.increment();
    this.subscribeToTerminateSample = Timer.start(clock);
    if (s instanceof Fuseable.QueueSubscription) {
      //noinspection unchecked
      this.qs = (Fuseable.QueueSubscription<T>) s;
    }
    this.s = s;
    actual.onSubscribe(this);
  }
}
origin: io.micrometer/micrometer-test

@Test
@DisplayName("record with stateful Sample instance")
default void recordWithSample(MeterRegistry registry) {
  Timer timer = registry.timer("myTimer");
  Timer.Sample sample = Timer.start(registry);
  clock(registry).add(10, TimeUnit.NANOSECONDS);
  sample.stop(timer);
  clock(registry).add(step());
  assertAll(() -> assertEquals(1L, timer.count()),
      () -> assertEquals(10, timer.totalTime(TimeUnit.NANOSECONDS), 1.0e-12));
}
io.micrometer.core.instrumentTimerstart

Popular methods of Timer

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

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Reference (javax.naming)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JTextField (javax.swing)
  • 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