Codota Logo
Timer.count
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain Timer
private void myMethod () {
Timer t =
  • Codota IconMeterRegistry meterRegistry;String str;Iterable iterable;meterRegistry.timer(str, iterable)
  • Smart code suggestions by Codota
}
origin: spring-cloud/spring-cloud-gateway

private long getCount(String tagKey, String tagValue) {
  return this.meterRegistry.get(REQUEST_METRICS_NAME).tag(tagKey, tagValue)
      .timer().count();
}
origin: reactor/reactor-core

@Test
public void onNextTimerCountsFuseable() {
  Flux<Integer> source = Flux.range(1, 123);
  new FluxMetricsFuseable<>(source, registry)
    .blockLast();
  Timer nextMeter = registry
      .find(METER_ON_NEXT_DELAY)
      .timer();
  assertThat(nextMeter).isNotNull();
  assertThat(nextMeter.count()).isEqualTo(123L);
  Flux<Integer> source2 = Flux.range(1, 10);
  new FluxMetricsFuseable<>(source2, registry)
    .take(3)
    .blockLast();
  assertThat(nextMeter.count()).isEqualTo(126L);
  Flux<Integer> source3 = Flux.range(1, 1000)
    .name("foo");
  new FluxMetricsFuseable<>(source3, registry)
    .blockLast();
  assertThat(nextMeter.count())
      .as("notTakingNamedIntoAccount")
      .isEqualTo(126L);
}
origin: reactor/reactor-core

@Test
public void splitMetricsOnNameFuseable() {
  final Mono<Integer> unnamedSource = Mono.just(0).map(v -> 100 / v);
  final Mono<Integer> namedSource = Mono.just(0).map(v -> 100 / v)
                     .name("foo");
  
  final Mono<Integer> unnamed = new MonoMetricsFuseable<>(unnamedSource, registry)
      .onErrorResume(e -> Mono.empty());
  final Mono<Integer> named = new MonoMetricsFuseable<>(namedSource, registry)
      .onErrorResume(e -> Mono.empty());
  Mono.when(unnamed, named).block();
  Timer unnamedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_EXCEPTION, ArithmeticException.class.getName())
      .tag(TAG_SEQUENCE_NAME, REACTOR_DEFAULT_NAME)
      .timer();
  Timer namedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_EXCEPTION, ArithmeticException.class.getName())
      .tag(TAG_SEQUENCE_NAME, "foo")
      .timer();
  assertThat(unnamedMeter).isNotNull();
  assertThat(unnamedMeter.count()).isOne();
  assertThat(namedMeter).isNotNull();
  assertThat(namedMeter.count()).isOne();
}
origin: reactor/reactor-core

@Test
public void onNextTimerCounts() {
  Flux<Integer> source = Flux.range(1, 123)
                .hide();
  new FluxMetrics<>(source, registry)
      .blockLast();
  Timer nextMeter = registry
      .find(METER_ON_NEXT_DELAY)
      .timer();
  assertThat(nextMeter).isNotNull();
  assertThat(nextMeter.count()).isEqualTo(123L);
  Flux<Integer> source2 = Flux.range(1, 10)
                .hide();
  new FluxMetrics<>(source2, registry)
      .take(3)
      .blockLast();
  assertThat(nextMeter.count()).isEqualTo(126L);
  Flux<Integer> source3 = Flux.range(1, 1000)
                .name("foo")
                .hide();
  new FluxMetrics<>(source3, registry)
      .blockLast();
  assertThat(nextMeter.count())
      .as("notTakingNamedIntoAccount")
      .isEqualTo(126L);
}
origin: reactor/reactor-core

@Test
public void splitMetricsOnNameFuseable() {
  final Flux<Integer> unnamedSource = Flux.just(0).map(v -> 100 / v);
  final Flux<Integer> namedSource = Flux.range(1, 40)
                     .map(i -> 100 / (40 - i))
                     .name("foo");
  
  final Flux<Integer> unnamed = new FluxMetricsFuseable<>(unnamedSource, registry)
      .onErrorResume(e -> Mono.empty());
  final Flux<Integer> named = new FluxMetricsFuseable<>(namedSource, registry)
      .onErrorResume(e -> Mono.empty());
  Mono.when(unnamed, named).block();
  Timer unnamedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_SEQUENCE_NAME, REACTOR_DEFAULT_NAME)
      .timer();
  Timer namedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_SEQUENCE_NAME, "foo")
      .timer();
  assertThat(unnamedMeter).isNotNull();
  assertThat(unnamedMeter.count()).isOne();
  assertThat(namedMeter).isNotNull();
  assertThat(namedMeter.count()).isOne();
}
origin: reactor/reactor-core

@Test
public void usesTagsFuseable() {
  Mono<Integer> source = Mono.just(8)
                .tag("tag1", "A")
                .name("usesTags")
                .tag("tag2", "foo");
  new MonoMetricsFuseable<>(source, registry)
    .block();
  Timer meter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_COMPLETE)
      .tag(TAG_SEQUENCE_NAME, "usesTags")
      .tag("tag1", "A")
      .tag("tag2", "foo")
      .timer();
  assertThat(meter).isNotNull();
  assertThat(meter.count()).isEqualTo(1L);
}
origin: reactor/reactor-core

@Test
public void splitMetricsOnName() {
  final Mono<Integer> unnamedSource = Mono.<Integer>error(new ArithmeticException("boom"))
      .hide();
  final Mono<Integer> unnamed = new MonoMetrics<>(unnamedSource, registry)
      .onErrorResume(e -> Mono.empty());
  final Mono<Integer> namedSource = Mono.just(40)
                     .name("foo")
                     .map(i -> 100 / (40 - i))
                     .hide();
  final Mono<Integer> named = new MonoMetrics<>(namedSource, registry)
      .onErrorResume(e -> Mono.empty());
  Mono.when(unnamed, named).block();
  Timer unnamedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_EXCEPTION, ArithmeticException.class.getName())
      .tag(TAG_SEQUENCE_NAME, REACTOR_DEFAULT_NAME)
      .timer();
  Timer namedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_EXCEPTION, ArithmeticException.class.getName())
      .tag(TAG_SEQUENCE_NAME, "foo")
      .timer();
  assertThat(unnamedMeter).isNotNull();
  assertThat(namedMeter).isNotNull();
  assertThat(unnamedMeter.count()).isOne();
  assertThat(namedMeter.count()).isOne();
}
origin: reactor/reactor-core

@Test
public void splitMetricsOnName() {
  final Flux<Integer> unnamedSource = Flux.<Integer>error(new ArithmeticException("boom"))
      .hide();
  final Flux<Integer> unnamed = new FluxMetrics<>(unnamedSource, registry)
      .onErrorResume(e -> Mono.empty());
  final Flux<Integer> namedSource = Flux.range(1, 40)
                     .name("foo")
                     .map(i -> 100 / (40 - i))
                     .hide();
  final Flux<Integer> named = new FluxMetrics<>(namedSource, registry)
      .onErrorResume(e -> Mono.empty());
  Mono.when(unnamed, named).block();
  Timer unnamedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_EXCEPTION, ArithmeticException.class.getName())
      .tag(TAG_SEQUENCE_NAME, REACTOR_DEFAULT_NAME)
      .timer();
  Timer namedMeter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_ERROR)
      .tag(TAG_EXCEPTION, ArithmeticException.class.getName())
      .tag(TAG_SEQUENCE_NAME, "foo")
      .timer();
  assertThat(unnamedMeter).isNotNull();
  assertThat(namedMeter).isNotNull();
  assertThat(unnamedMeter.count()).isOne();
  assertThat(namedMeter.count()).isOne();
}
origin: reactor/reactor-core

@Test
public void usesTagsFuseable() {
  Flux<Integer> source = Flux.range(1, 8)
                .tag("tag1", "A")
                .name("usesTags")
                .tag("tag2", "foo");
  new FluxMetricsFuseable<>(source, registry)
    .blockLast();
  Timer meter = registry
      .find(METER_ON_NEXT_DELAY)
      .tag(TAG_SEQUENCE_NAME, "usesTags")
      .tag("tag1", "A")
      .tag("tag2", "foo")
      .timer();
  assertThat(meter).isNotNull();
  assertThat(meter.count()).isEqualTo(8L);
}
origin: reactor/reactor-core

@Test
public void usesTags() {
  Mono<Integer> source = Mono.just(1)
                .tag("tag1", "A")
                .name("usesTags")
                .tag("tag2", "foo")
                .hide();
  new MonoMetrics<>(source, registry)
      .block();
  Timer meter = registry
      .find(METER_FLOW_DURATION)
      .tag(TAG_STATUS, TAGVALUE_ON_COMPLETE)
      .tag(TAG_SEQUENCE_NAME, "usesTags")
      .tag("tag1", "A")
      .tag("tag2", "foo")
      .timer();
  assertThat(meter).isNotNull();
  assertThat(meter.count()).isEqualTo(1L);
}
origin: reactor/reactor-core

@Test
public void usesTags() {
  Flux<Integer> source = Flux.range(1, 8)
                .tag("tag1", "A")
                .name("usesTags")
                .tag("tag2", "foo")
                .hide();
  new FluxMetrics<>(source, registry)
      .blockLast();
  Timer meter = registry
      .find(METER_ON_NEXT_DELAY)
      .tag(TAG_SEQUENCE_NAME, "usesTags")
      .tag("tag1", "A")
      .tag("tag2", "foo")
      .timer();
  assertThat(meter).isNotNull();
  assertThat(meter.count()).isEqualTo(8L);
}
origin: rsocket/rsocket-java

@DisplayName("requestResponse gathers metrics")
@Test
void requestResponse() {
 Payload payload = DefaultPayload.create("test-metadata", "test-data");
 when(delegate.requestResponse(payload)).thenReturn(Mono.empty());
 new MicrometerRSocket(delegate, meterRegistry, Tag.of("test-key", "test-value"))
   .requestResponse(payload)
   .as(StepVerifier::create)
   .verifyComplete();
 assertThat(findTimer("request.response", SignalType.ON_COMPLETE).count()).isEqualTo(1);
}
origin: spring-projects/spring-integration

.tag("name", "eipBean.handler")
.tag("result", "success")
.timer().count()).isEqualTo(1);
.timer().count()).isEqualTo(1);
.timer().count()).isEqualTo(1);
.timer().count()).isEqualTo(1);
.timer().count()).isEqualTo(1);
.tag("name", "nullChannel")
.tag("result", "success")
.timer().count()).isEqualTo(1);
.tag("name", "newChannel")
.tag("result", "success")
.timer().count()).isEqualTo(1);
origin: spring-projects/spring-integration

.tag("name", "queue")
.tag("result", "success")
.timer().count()).isEqualTo(1);
origin: io.vertx/vertx-micrometer-metrics

private static JsonObject timerToJson(JsonObject obj, Timer timer) {
 return obj.put("type", "timer")
  .put("count", timer.count())
  .put("totalTimeMs", timer.totalTime(TimeUnit.MILLISECONDS))
  .put("meanMs", timer.mean(TimeUnit.MILLISECONDS))
  .put("maxMs", timer.max(TimeUnit.MILLISECONDS));
}
origin: io.micrometer/micrometer-registry-elastic

Optional<String> writeTimer(Timer timer) {
  return Optional.of(writeDocument(timer, builder -> {
    builder.append(",\"count\":").append(timer.count());
    builder.append(",\"sum\":").append(timer.totalTime(getBaseTimeUnit()));
    builder.append(",\"mean\":").append(timer.mean(getBaseTimeUnit()));
    builder.append(",\"max\":").append(timer.max(getBaseTimeUnit()));
  }));
}
origin: yidongnan/grpc-spring-boot-starter

    this.meterRegistry.find(METRIC_NAME_CLIENT_PROCESSING_DURATION).timer();
assertNotNull(clientTimer);
assertEquals(1, clientTimer.count());
assertTrue(clientTimer.max(TimeUnit.SECONDS) < 1);
    .timer();
assertNotNull(serverTimer);
assertEquals(1, serverTimer.count());
assertTrue(serverTimer.max(TimeUnit.SECONDS) < 1);
assertEquals(2, clientTimer.count());
assertTrue(clientTimer.max(TimeUnit.SECONDS) < 1);
assertEquals(2, serverTimer.count());
assertTrue(serverTimer.max(TimeUnit.SECONDS) < 1);
origin: yidongnan/grpc-spring-boot-starter

    .timer();
assertNotNull(clientTimer);
assertEquals(1, clientTimer.count());
assertTrue(clientTimer.max(TimeUnit.SECONDS) < 1);
    .timer();
assertNotNull(serverTimer);
assertEquals(1, serverTimer.count());
assertTrue(serverTimer.max(TimeUnit.SECONDS) < 1);
origin: io.micrometer/micrometer-registry-new-relic

private Stream<String> writeTimer(Timer timer) {
  return Stream.of(event(timer.getId(),
      new Attribute("count", timer.count()),
      new Attribute("avg", timer.mean(getBaseTimeUnit())),
      new Attribute("totalTime", timer.totalTime(getBaseTimeUnit())),
      new Attribute("max", timer.max(getBaseTimeUnit()))
  ));
}
origin: io.micrometer/micrometer-test

@Test
@DisplayName("record a runnable task")
default void recordWithRunnable(MeterRegistry registry) {
  Timer t = registry.timer("myTimer");
  try {
    t.record(() -> clock(registry).add(10, TimeUnit.NANOSECONDS));
    clock(registry).add(step());
  } finally {
    assertAll(() -> assertEquals(1L, t.count()),
        () -> assertEquals(10, t.totalTime(TimeUnit.NANOSECONDS), 1.0e-12));
  }
}
io.micrometer.core.instrumentTimercount

Popular methods of Timer

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

Popular in Java

  • Making http post requests using okhttp
  • compareTo (BigDecimal)
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now