io.micrometer.core.instrument.Gauge.value()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(220)

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

Gauge.value介绍

暂无

代码示例

代码示例来源:origin: com.expedia.www/haystack-client-micrometer

@Override
  public double value() {
    return delegate.value();
  }
}

代码示例来源:origin: org.ballerinalang/ballerina-micrometer-extension

@Override
  public double get() {
    return gauge.value();
  }
}

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

@Override public double value() {
 return impl.value();
}

代码示例来源:origin: org.apache.camel/camel-micrometer

@Override
  protected void serializeStatistics(Gauge gauge, JsonGenerator json, SerializerProvider provider) throws IOException {
    json.writeNumberField("value", gauge.value());
  }
}

代码示例来源:origin: io.vertx/vertx-micrometer-metrics

private static JsonObject gaugeToJson(JsonObject obj, Gauge gauge) {
 return obj.put("type", "gauge")
  .put("value", gauge.value());
}

代码示例来源:origin: spring-projects/spring-integration

this.queue.receive();
MeterRegistry registry = this.meterRegistry;
assertThat(registry.get("spring.integration.channels").gauge().value()).isEqualTo(3);

代码示例来源:origin: io.micrometer/micrometer-registry-elastic

Optional<String> writeGauge(Gauge gauge) {
  Double value = gauge.value();
  if (Double.isFinite(value)) {
    return Optional.of(writeDocument(gauge, builder -> {
      builder.append(",\"value\":").append(value);
    }));
  }
  return Optional.empty();
}

代码示例来源:origin: spring-projects/spring-integration

assertThat(registry.get("spring.integration.channels").gauge().value()).isEqualTo(6);
assertThat(registry.get("spring.integration.handlers").gauge().value()).isEqualTo(3);
assertThat(registry.get("spring.integration.sources").gauge().value()).isEqualTo(1);

代码示例来源:origin: io.micrometer/micrometer-registry-new-relic

private Stream<String> writeGauge(Gauge gauge) {
  Double value = gauge.value();
  return value.isNaN() ? Stream.empty() : Stream.of(event(gauge.getId(), new Attribute("value", value)));
}

代码示例来源:origin: io.micrometer/micrometer-registry-cloudwatch

private Stream<MetricDatum> gaugeData(Gauge gauge) {
  double value = gauge.value();
  if (!Double.isFinite(value))
    return Stream.empty();
  return Stream.of(metricDatum(gauge.getId(), "value", value));
}

代码示例来源:origin: io.micrometer/micrometer-test

@Test
@DisplayName("gauges attached to a number are updated when their values are observed")
default void numericGauge(MeterRegistry registry) {
  AtomicInteger n = registry.gauge("my.gauge", new AtomicInteger(0));
  n.set(1);
  Gauge g = registry.get("my.gauge").gauge();
  assertThat(g.value()).isEqualTo(1);
  n.set(2);
  assertThat(g.value()).isEqualTo(2);
}

代码示例来源:origin: io.micrometer/micrometer-test

@Test
@DisplayName("gauges can be directly associated with collection size")
default void collectionSizeGauge(MeterRegistry registry) {
  List<String> list = registry.gaugeCollectionSize("my.gauge", emptyList(), new ArrayList<>());
  list.addAll(Arrays.asList("a", "b"));
  Gauge g = registry.get("my.gauge").gauge();
  assertThat(g.value()).isEqualTo(2);
}

代码示例来源:origin: io.micrometer/micrometer-test

@Test
@DisplayName("gauges attached to an object are updated when their values are observed")
default void objectGauge(MeterRegistry registry) {
  List<String> list = registry.gauge("my.gauge", emptyList(), new ArrayList<>(), List::size);
  list.addAll(Arrays.asList("a", "b"));
  Gauge g = registry.get("my.gauge").gauge();
  assertThat(g.value()).isEqualTo(2);
}

代码示例来源:origin: io.micrometer/micrometer-test

@Test
@DisplayName("gauges can be directly associated with map entry size")
default void mapSizeGauge(MeterRegistry registry) {
  Map<String, Integer> map = registry.gaugeMapSize("my.gauge", emptyList(), new HashMap<>());
  map.put("a", 1);
  Gauge g = registry.get("my.gauge").gauge();
  assertThat(g.value()).isEqualTo(1);
}

代码示例来源:origin: jhipster/jhipster

private Map<String, Number> processMetrics() {
  Map<String, Number> resultsProcess = new HashMap<>();
  Collection<Gauge> gauges = Search.in(this.meterRegistry).name(s -> s.contains("cpu") || s.contains("system") || s.contains("process")).gauges();
  gauges.forEach(gauge -> resultsProcess.put(gauge.getId().getName(), gauge.value()));
  Collection<TimeGauge> timeGauges = Search.in(this.meterRegistry).name(s -> s.contains("process")).timeGauges();
  timeGauges.forEach(gauge -> resultsProcess.put(gauge.getId().getName(), gauge.value(TimeUnit.MILLISECONDS)));
  return resultsProcess;
}

代码示例来源:origin: io.micrometer/micrometer-registry-appoptics

Optional<String> writeGauge(Gauge gauge) {
  double value = gauge.value();
  if (!Double.isFinite(value)) {
    return Optional.empty();
  }
  return Optional.of(write(gauge.getId(), "gauge", Fields.Value.tag(), decimal(value)));
}

代码示例来源:origin: io.micrometer/micrometer-test

@Test
@DisplayName("gauges that reference an object that is garbage collected report NaN")
default void garbageCollectedSourceObject(MeterRegistry registry) {
  registry.gauge("my.gauge", emptyList(), (Map) null, Map::size);
  assertThat(registry.get("my.gauge").gauge().value()).matches(val -> val == null || Double.isNaN(val) || val == 0.0);
}

代码示例来源:origin: io.micrometer/micrometer-registry-kairos

Stream<String> writeGauge(Gauge gauge) {
  Double value = gauge.value();
  if (Double.isFinite(value)) {
    return Stream.of(writeMetric(gauge.getId(), config().clock().wallTime(), value));
  }
  return Stream.empty();
}

代码示例来源:origin: io.micrometer/micrometer-test

@Test
  @DisplayName("strong reference gauges")
  default void strongReferenceGauges(MeterRegistry registry) {
    Gauge.builder("weak.ref", 1.0, n -> n).register(registry);
    Gauge.builder("strong.ref", 1.0, n -> n)
        .strongReference(true)
        .register(registry);

    System.gc();

    assertThat(registry.get("weak.ref").gauge().value()).isEqualTo(Double.NaN);
    assertThat(registry.get("strong.ref").gauge().value()).isEqualTo(1.0);
  }
}

代码示例来源:origin: io.micrometer/micrometer-test

@Test
void size() {
  put("k", "v");
  assertThat(binder.size()).isIn(null, 1L);
  if (binder.size() != null) {
    assertThat(registry.get("cache.size")
        .tag("cache", "mycache")
        .gauge().value())
        .isEqualTo(1);
  }
}

相关文章