io.prometheus.client.Gauge.get()方法的使用及代码示例

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

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

Gauge.get介绍

[英]Get the value of the gauge.
[中]获取仪表的值。

代码示例

代码示例来源:origin: com.palantir.srx.prometheus/prometheus-metrics

private boolean isMaxCollections() {
    int limit = this.collectionLimit.get().limit();
    if (limit < 1) {
      log.warn("Ignoring max-concurrent-collections as its lower than 1. Current: {} Default {}",
          SafeArg.of("current", limit),
          SafeArg.of("default", PrometheusCollectionLimit.DEFAULT_MAX_COLLECTIONS));
      COLLECTION_REQUESTS_MAX.set(PrometheusCollectionLimit.DEFAULT_MAX_COLLECTIONS);
    } else {
      COLLECTION_REQUESTS_MAX.set(limit);
    }
    return currentRequests.incrementAndGet() > COLLECTION_REQUESTS_MAX.get();
  }
}

代码示例来源:origin: org.apache.pulsar/pulsar-proxy

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
  super.channelRegistered(ctx);
  activeConnections.inc();
  if (activeConnections.get() > service.getConfiguration().getMaxConcurrentInboundConnections()) {
    ctx.close();
    rejectedConnections.inc();
    return;
  }
}

代码示例来源:origin: com.palantir.srx.prometheus/prometheus-metrics

log.error(TOO_MANY_REQUESTS_ERROR,
    SafeArg.of("current", currentRequests.get()),
    SafeArg.of("max", COLLECTION_REQUESTS_MAX.get())
);
throw TOO_MANY_REQUESTS;

相关文章