org.apache.samza.metrics.Gauge类的使用及代码示例

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

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

Gauge介绍

[英]A Gauge is a org.apache.samza.metrics.Metric that wraps some instance of T in a thread-safe reference and allows it to be set or retrieved. Gauges record specific values over time. For example, the current length of a queue or the size of a buffer.
[中]量具是一个组织。阿帕奇。萨姆萨。韵律学。在线程安全引用中封装T的某个实例并允许对其进行设置或检索的度量。仪表记录随时间变化的特定值。例如,队列的当前长度或缓冲区的大小。

代码示例

代码示例来源:origin: apache/samza

public void setNoMoreMessages(SystemStreamPartition systemStreamPartition, boolean noMoreMessages) {
 this.noMoreMessageGaugeMap.get(systemStreamPartition).set(noMoreMessages);
}

代码示例来源:origin: apache/samza

@Override
public <T> Gauge<T> newGauge(String group, String name, T value) {
 return new Gauge<T>(name, value);
}

代码示例来源:origin: apache/samza

counter3.inc(4);
gauge1.set("5");
gauge2.set("6");
gauge3.set("7");
gauge4.set("8");
assertEquals(2, counter2.getCount());
assertEquals(4, counter3.getCount());
assertEquals("5", gauge1.getValue());
assertEquals("6", gauge2.getValue());
assertEquals("7", gauge3.getValue());
assertEquals("8", gauge4.getValue());
assertEquals(1, timer1.getSnapshot().getAverage(), 0);
assertEquals(2, timer2.getSnapshot().getAverage(), 0);

代码示例来源:origin: apache/samza

expectedValues.put(metrics.highWatermark().get(tp2).getName(), "1001");
expectedValues.put(metrics.lag().get(tp1).getName(), "201");
expectedValues.put(metrics.topicPartitions().get(clientName).getName(), "3");

代码示例来源:origin: org.apache.samza/samza-api

public void setNoMoreMessages(SystemStreamPartition systemStreamPartition, boolean noMoreMessages) {
 this.noMoreMessageGaugeMap.get(systemStreamPartition).set(noMoreMessages);
}

代码示例来源:origin: org.apache.samza/samza-api

@Override
public <T> Gauge<T> newGauge(String group, String name, T value) {
 return new Gauge<T>(name, value);
}

代码示例来源:origin: apache/samza

/**
 * Insert an PendingEnvelope into the pending envelope queue.
 * The function will be called in the run loop thread so no synchronization.
 * @param pendingEnvelope
 */
private void insertEnvelope(PendingEnvelope pendingEnvelope) {
 pendingEnvelopeQueue.add(pendingEnvelope);
 int queueSize = pendingEnvelopeQueue.size();
 taskMetrics.pendingMessages().set(queueSize);
 log.trace("Insert envelope to task {} queue.", taskName);
 log.debug("Task {} pending envelope count is {} after insertion.", taskName, queueSize);
}

代码示例来源:origin: apache/samza

public <T> Gauge<T> newGauge(String name, T value) {
 return registry.newGauge(groupName, new Gauge<T>((prefix + name).toLowerCase(), value));
}

代码示例来源:origin: org.apache.samza/samza-core_2.11

/**
 * Insert an PendingEnvelope into the pending envelope queue.
 * The function will be called in the run loop thread so no synchronization.
 * @param pendingEnvelope
 */
private void insertEnvelope(PendingEnvelope pendingEnvelope) {
 pendingEnvelopeQueue.add(pendingEnvelope);
 int queueSize = pendingEnvelopeQueue.size();
 taskMetrics.pendingMessages().set(queueSize);
 log.trace("Insert envelope to task {} queue.", taskName);
 log.debug("Task {} pending envelope count is {} after insertion.", taskName, queueSize);
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

public <T> Gauge<T> newGauge(String name, T value) {
 return registry.newGauge(groupName, new Gauge<T>((prefix + name).toLowerCase(), value));
}

代码示例来源:origin: org.apache.samza/samza-core

/**
 * Insert an PendingEnvelope into the pending envelope queue.
 * The function will be called in the run loop thread so no synchronization.
 * @param pendingEnvelope
 */
private void insertEnvelope(PendingEnvelope pendingEnvelope) {
 pendingEnvelopeQueue.add(pendingEnvelope);
 int queueSize = pendingEnvelopeQueue.size();
 taskMetrics.pendingMessages().set(queueSize);
 log.trace("Insert envelope to task {} queue.", taskName);
 log.debug("Task {} pending envelope count is {} after insertion.", taskName, queueSize);
}

代码示例来源:origin: org.apache.samza/samza-core

public <T> Gauge<T> newGauge(String name, T value) {
 return registry.newGauge(groupName, new Gauge<T>((prefix + name).toLowerCase(), value));
}

代码示例来源:origin: apache/samza

private void startProcess() {
 int count = messagesInFlight.incrementAndGet();
 taskMetrics.messagesInFlight().set(count);
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

public <T> Gauge<T> newGauge(String name, T value) {
 return registry.newGauge(groupName, new Gauge<T>((prefix + name).toLowerCase(), value));
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

/**
 * Insert an PendingEnvelope into the pending envelope queue.
 * The function will be called in the run loop thread so no synchronization.
 * @param pendingEnvelope
 */
private void insertEnvelope(PendingEnvelope pendingEnvelope) {
 pendingEnvelopeQueue.add(pendingEnvelope);
 int queueSize = pendingEnvelopeQueue.size();
 taskMetrics.pendingMessages().set(queueSize);
 log.trace("Insert envelope to task {} queue.", taskName);
 log.debug("Task {} pending envelope count is {} after insertion.", taskName, queueSize);
}

代码示例来源:origin: org.apache.samza/samza-core_2.11

public <T> Gauge<T> newGauge(String name, T value) {
 return registry.newGauge(groupName, new Gauge<T>((prefix + name).toLowerCase(), value));
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

/**
 * Insert an PendingEnvelope into the pending envelope queue.
 * The function will be called in the run loop thread so no synchronization.
 * @param pendingEnvelope
 */
private void insertEnvelope(PendingEnvelope pendingEnvelope) {
 pendingEnvelopeQueue.add(pendingEnvelope);
 int queueSize = pendingEnvelopeQueue.size();
 taskMetrics.pendingMessages().set(queueSize);
 log.trace("Insert envelope to task {} queue.", taskName);
 log.debug("Task {} pending envelope count is {} after insertion.", taskName, queueSize);
}

代码示例来源:origin: apache/samza

public <T> Gauge<T> newGauge(String name, final ValueFunction<T> valueFunc) {
 return registry.newGauge(groupName, new Gauge<T>((prefix + name).toLowerCase(), valueFunc.getValue()) {
  @Override
  public T getValue() {
   return valueFunc.getValue();
  }
 });
}

代码示例来源:origin: apache/samza

private void doneProcess() {
 int count = messagesInFlight.decrementAndGet();
 taskMetrics.messagesInFlight().set(count);
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

public <T> Gauge<T> newGauge(String name, final ValueFunction<T> valueFunc) {
 return registry.newGauge(groupName, new Gauge<T>((prefix + name).toLowerCase(), valueFunc.getValue()) {
  @Override
  public T getValue() {
   return valueFunc.getValue();
  }
 });
}

相关文章