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

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

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

Gauge.set介绍

[英]Set the gauge with no labels to the given value.
[中]将不带标签的仪表设置为给定值。

代码示例

代码示例来源:origin: zalando/zalenium

/**
 * @see GridRegistry#clearNewSessionRequests()
 */
public void clearNewSessionRequests() {
  newSessionQueue.clearNewSessionRequests();
  seleniumTestSessionsWaiting.set(0);
}

代码示例来源:origin: prometheus/client_java

@Benchmark
@BenchmarkMode({Mode.AverageTime})
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void prometheusSimpleGaugeNoLabelsSetBenchmark() {
 prometheusSimpleGaugeNoLabels.set(42); 
}

代码示例来源:origin: GruppoFilippetti/vertx-mqtt-broker

@Override
public void putAll(Map<? extends K, ? extends V> map) {
  super.putAll(map);
  PromMetrics.mqtt_sessions.set(this.size());
}

代码示例来源:origin: GruppoFilippetti/vertx-mqtt-broker

@Override
public V put(K k, V v) {
  V ret = super.put(k, v);
  PromMetrics.mqtt_sessions.set(this.size());
  return ret;
}

代码示例来源:origin: GruppoFilippetti/vertx-mqtt-broker

@Override
  public V remove(Object k) {
    V ret = super.remove(k);
    PromMetrics.mqtt_sessions.set(this.size());
    return ret;
  }
}

代码示例来源: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: avaire/avaire

@Override
  public void run() {
    handleTask((Task) avaire -> {
      Metrics.musicPlaying.set(AudioHandler.getDefaultAudioHandler().getTotalListenersSize());
    });
  }
}

代码示例来源:origin: marcelmay/hadoop-hdfs-fsimage-exporter

METRIC_LOAD_SIZE.set(fsImageFile.length());
FSImageLoader loader;
try (RandomAccessFile raFile = new RandomAccessFile(fsImageFile, "r")) {

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

@Override
  public void handle(AvaIre avaire) {
    if (!avaire.areWeReadyYet()) {
      return;
    }

    int validVotes = 0;

    for (VoteCacheEntity cacheEntity : avaire.getVoteManager().getVoteLog().values()) {
      if (cacheEntity.getCarbon().isFuture()) {
        validVotes++;
      }
    }

    Metrics.validVotes.set(validVotes);
  }
}

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

try {
  log.debug("Collecting metrics...");
  COLLECTION_REQUESTS.set(currentRequests.get());
  TextFormat.write004(writer, registry.metricFamilySamples());
} catch (IOException e) {

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

@Override
public void handle(AvaIre avaire) {
  Metrics.uptime.labels("dynamic").set(ManagementFactory.getRuntimeMXBean().getUptime());
  Metrics.memoryTotal.set(Runtime.getRuntime().totalMemory());
  Metrics.memoryUsed.set(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
  if (!avaire.areWeReadyYet() || !hasLoadedGuilds(avaire)) {
    return;
  }
  Metrics.guilds.set(avaire.getShardEntityCounter().getGuilds());
  Metrics.users.set(avaire.getShardEntityCounter().getUsers());
  Metrics.channels.labels("text").set(avaire.getShardEntityCounter().getTextChannels());
  Metrics.channels.labels("voice").set(avaire.getShardEntityCounter().getVoiceChannels());
  for (Region region : Region.values()) {
    Metrics.geoTracker.labels(region.getName()).set(0);
  }
  for (JDA shard : avaire.getShardManager().getShards()) {
    for (Guild guild : shard.getGuilds()) {
      Metrics.geoTracker.labels(guild.getRegion().getName()).inc();
    }
  }
}

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

/**
 * Creates the vote manager instance with the given AvaIre
 * application instance, the vote manager will setup all
 * the vote metrics, and then sync the vote entities
 * from the database into memory.
 *
 * @param avaire The main AvaIre instance.
 */
public VoteManager(AvaIre avaire) {
  this.avaire = avaire;
  for (VoteMetricType type : VoteMetricType.values()) {
    Metrics.dblVotes.labels(type.getName()).inc(0);
  }
  Metrics.validVotes.set(0D);
  this.syncWithDatabase();
}

代码示例来源:origin: marcelmay/hadoop-hdfs-fsimage-exporter

private void setMetricsFromReport() {
  METRIC_SUM_DIRS.set(overallStats.sumDirectories.longValue());
  METRIC_SUM_LINKS.set(overallStats.sumSymLinks.longValue());
  METRIC_SUM_BLOCKS.set(overallStats.sumBlocks.longValue());

代码示例来源:origin: johrstrom/jmeter-prometheus-plugin

threadCollector.set(JMeterContextService.getContext().getThreadGroup().getNumberOfThreads());

相关文章