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

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

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

Gauge.dec介绍

[英]Decrement the gauge with no labels by 1.
[中]将没有标签的仪表减量1。

代码示例

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

/**
 * @see GridRegistry#removeNewSessionRequest(RequestHandler)
 */
public boolean removeNewSessionRequest(RequestHandler request) {
  boolean wasRemoved = newSessionQueue.removeNewSessionRequest(request);
  if (wasRemoved) {
    seleniumTestSessionsWaiting.dec();
  }
  return wasRemoved;
}

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

private boolean takeRequestHandler(RequestHandler handler) {
  final TestSession session = proxies.getNewSession(handler.getRequest().getDesiredCapabilities());
  final boolean sessionCreated = session != null;
  if (sessionCreated) {
    String remoteName = session.getSlot().getProxy().getId();
    long timeToAssignProxy = System.currentTimeMillis() - handler.getRequest().getCreationTime();
    LOG.info("Test session with internal key {} assigned to remote ({}) after {} seconds ({} ms).",
               session.getInternalKey(),
               remoteName,
               timeToAssignProxy / 1000,
               timeToAssignProxy);
    seleniumTestSessionStartLatency.observe(timeToAssignProxy / Collector.MILLISECONDS_PER_SECOND);
    seleniumTestSessionsWaiting.dec();
    activeTestSessions.add(session);
    handler.bindSession(session);
  }
  return sessionCreated;
}

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

/**
 * Decrement the gauge with no labels by 1.
 */
public void dec() {
 dec(1);
}
/**

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

@Benchmark
@BenchmarkMode({Mode.AverageTime})
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void prometheusSimpleGaugeNoLabelsDecBenchmark() {
 prometheusSimpleGaugeNoLabels.dec(); 
}

代码示例来源:origin: io.prometheus/simpleclient

/**
 * Decrement the gauge with no labels by 1.
 */
public void dec() {
 dec(1);
}
/**

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

@Override
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
  super.channelUnregistered(ctx);
  activeConnections.dec();
}

代码示例来源:origin: dabbotorg/java-music-bot

public void closeConnection() {
    final Guild guild = shardManager.getGuildById(guildId);

    if (guild == null) {
      // todo handle if guild no longer exists
      LOGGER.error("Error getting guild with ID {} from shard manager", guildId);
      return;
    }

    executorService.submit(() -> {
      lock.lock();
      try {
        boolean dec = guild.getAudioManager().isConnected();
        guild.getAudioManager().closeAudioConnection();
        if (dec) {
          audioStreams.dec();
        }
        state.setVoiceConnectionClosed();
      } finally {
        lock.unlock();
      }
    });
  }
}

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

private void handleSendGuildLeaveWebhook(Guild guild) {
  AvaIre.getLogger().info(ConsoleColor.format(
    "%redLeft guild with an ID of " + guild.getId() + " called: " + guild.getName() + "%reset"
  ));
  if (!avaire.areWeReadyYet()) {
    return;
  }
  Metrics.guilds.dec();
  Metrics.geoTracker.labels(guild.getRegion().getName()).dec();
  TextChannel channel = avaire.getShardManager().getTextChannelById(DiscordConstants.ACTIVITY_LOG_CHANNEL_ID);
  if (channel == null) {
    return;
  }
  channel.sendMessage(
    new EmbedBuilder()
      .setColor(Color.decode("#EF5350"))
      .setTimestamp(Instant.now())
      .addField("Removed", String.format("%s (ID: %s)",
        guild.getName(), guild.getId()
      ), false)
      .build()
  ).queue(null, RestActionUtil.ignore);
}

相关文章