com.codahale.metrics.graphite.Graphite.connect()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(279)

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

Graphite.connect介绍

暂无

代码示例

代码示例来源:origin: com.opentable.components/otj-metrics-core

@Override
public synchronized void connect() throws IllegalStateException, IOException {
  try {
    maybeRecycle().connect(); // either we are connected or we throw
  } catch (IllegalStateException | IOException e){
    connectionFailures.inc();
    throw e;
  }
}

代码示例来源:origin: ru.yandex.qatools.camelot.utils/plugin-utils

@Processor
  public void process(GraphiteValue event) {
    if (isBlank(host)) {
      return;
    }

    logger.info(format("Sending %s to graphite at %s:%d", event, host, port));
    try {
      Graphite graphite = new Graphite(new InetSocketAddress(host, port));
      graphite.connect();
      graphite.send(event.getName(), event.getValue(), event.getTimestamp());
      graphite.close();
    } catch (IOException e) {
      logger.error("Failed to stream value to graphite:", e);
    }
  }
}

代码示例来源:origin: OpenSOC/opensoc-streaming

port));
graphite.connect();
graphite.close();

代码示例来源:origin: aseigneurin/kafka-sandbox

public void send(CounterMetric metric) {
  try {
    if (!graphite.isConnected()) {
      graphite.connect();
    }
    graphite.send(metric.getName() + ".count", Long.toString(metric.getValue()), metric.getTimestampInMillis());
    graphite.flush();
  } catch (IOException e) {
    LOGGER.warn("Unable to report to Graphite", graphite, e);
    try {
      graphite.close();
    } catch (IOException e1) {
      LOGGER.warn("Error closing Graphite", graphite, e);
    }
  }
}

相关文章