本文整理了Java中com.codahale.metrics.Counter.<init>()
方法的一些代码示例,展示了Counter.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.<init>()
方法的具体详情如下:
包路径:com.codahale.metrics.Counter
类名称:Counter
方法名:<init>
暂无
代码示例来源:origin: alibaba/jstorm
@Override
public Counter mkInstance() {
return new Counter();
}
代码示例来源:origin: stagemonitor/stagemonitor
@Override
public Counter newMetric() {
return new Counter();
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
@Override
public Counter newMetric() {
return new Counter();
}
代码示例来源:origin: alibaba/jstorm
public AsmCounter() {
super();
for (int win : windowSeconds) {
counterMap.put(win, new Counter());
}
}
代码示例来源:origin: apache/hive
@Override
public Counter load(String key) {
Counter counter = new Counter();
metricRegistry.register(key, counter);
return counter;
}
}
代码示例来源:origin: apache/kylin
@Override
public Counter load(String key) {
Counter counter = new Counter();
metricRegistry.register(key, counter);
return counter;
}
});
代码示例来源:origin: stackoverflow.com
Counter c = new Counter() {
public int count() {
super.count();
return super.count();
}
}
c.count(); // now count 2
代码示例来源:origin: stackoverflow.com
Counter c = new Counter() {
public int count() {
int lastCount = 0;
for (int i = super.count(); --i >= 0; ) {
lastCount = super.count();
}
return lastCount;
}
}
c.count(); // Now double count
代码示例来源:origin: apache/kylin
@Test
public void testCounterReporting() {
final Counter counter = new Counter();
TreeMap<String, Counter> counters = new TreeMap<>();
counters.put("my_counter", counter);
// Add the metrics objects to the internal "queues" by hand
metrics2Reporter.setDropwizardCounters(counters);
// Set some values
counter.inc(5L);
MetricsCollector collector = mock(MetricsCollector.class);
MetricsRecordBuilder recordBuilder = mock(MetricsRecordBuilder.class);
Mockito.when(collector.addRecord(recordName)).thenReturn(recordBuilder);
metrics2Reporter.getMetrics(collector, true);
verify(recordBuilder).addCounter(Interns.info("my_counter", ""), 5L);
verifyRecordBuilderUnits(recordBuilder);
// Should not be the same instance we gave before. Our map should have gotten swapped out.
assertTrue("Should not be the same map instance after collection",
counters != metrics2Reporter.getDropwizardCounters());
}
代码示例来源:origin: sixt/ja-micro
public GoCounter(String name) {
this.name = name;
successCounter = new Counter();
failureCounter = new Counter();
}
代码示例来源:origin: stackoverflow.com
var Counter = function(initialValue){
var value = initialValue;
// product is a JSON object
Counter.prototype.get = function() {
return value++;
}
};
var c1 = new Counter(0);
var c2 = new Counter(10);
console.log(c1.get()); // outputs 10, should output 0
代码示例来源:origin: sixt/ja-micro
public void reset() {
successCounter = new Counter();
failureCounter = new Counter();
}
代码示例来源:origin: apache/incubator-gobblin
Counter recordsProcessedCounter = new Counter();
recordsProcessedCounter.inc(10l);
代码示例来源:origin: apache/incubator-gobblin
com.codahale.metrics.Counter recordsProcessedCounter = new com.codahale.metrics.Counter();
recordsProcessedCounter.inc(10l);
代码示例来源:origin: uber/chaperone
private synchronized void updatePerWorkerISMetrics(
Map<String, Integer> topicPartitionMapForIdealState) {
for (String worker : topicPartitionMapForIdealState.keySet()) {
if (!_idealStatePerWorkerTopicPartitionCounter.containsKey(worker)) {
Counter workCounter = new Counter();
try {
HelixKafkaMirrorMakerMetricsReporter.get().getRegistry().register(
getIdealStatePerWorkMetricName(worker), workCounter);
} catch (Exception e) {
LOGGER.error("Error registering metrics!", e);
}
_idealStatePerWorkerTopicPartitionCounter.put(worker, workCounter);
}
Counter counter = _idealStatePerWorkerTopicPartitionCounter.get(worker);
counter.inc(topicPartitionMapForIdealState.get(worker) -
counter.getCount());
}
for (String worker : _idealStatePerWorkerTopicPartitionCounter.keySet()) {
if (!topicPartitionMapForIdealState.containsKey(worker)) {
Counter counter = _idealStatePerWorkerTopicPartitionCounter.get(worker);
counter.dec(counter.getCount());
}
}
}
代码示例来源:origin: uber/chaperone
private synchronized void updatePerWorkerEVMetrics(
Map<String, Integer> topicPartitionMapForExternalView) {
for (String worker : topicPartitionMapForExternalView.keySet()) {
if (!_externalViewPerWorkerTopicPartitionCounter.containsKey(worker)) {
Counter workCounter = new Counter();
try {
HelixKafkaMirrorMakerMetricsReporter.get().getRegistry().register(
getExternalViewPerWorkMetricName(worker), workCounter);
} catch (Exception e) {
LOGGER.error("Error registering metrics!", e);
}
_externalViewPerWorkerTopicPartitionCounter.put(worker, workCounter);
}
Counter counter = _externalViewPerWorkerTopicPartitionCounter.get(worker);
counter.inc(topicPartitionMapForExternalView.get(worker) -
counter.getCount());
}
for (String worker : _externalViewPerWorkerTopicPartitionCounter.keySet()) {
if (!topicPartitionMapForExternalView.containsKey(worker)) {
Counter counter = _externalViewPerWorkerTopicPartitionCounter.get(worker);
counter.dec(counter.getCount());
}
}
}
代码示例来源:origin: uber/chaperone
private synchronized void updateMetrics(int numMissingTopics, int numMismatchedTopics,
int numMismatchedTopicPartitions, Map<String, Integer> misMatchedPartitionNumberTopics) {
_numMissingTopics.inc(numMissingTopics - _numMissingTopics.getCount());
_numMismatchedTopics.inc(numMismatchedTopics - _numMismatchedTopics.getCount());
_numMismatchedTopicPartitions
.inc(numMismatchedTopicPartitions - _numMismatchedTopicPartitions.getCount());
for (String topic : misMatchedPartitionNumberTopics.keySet()) {
if (!_mismatchedTopicPartitionsCounter.containsKey(topic)) {
Counter topicPartitionCounter = new Counter();
try {
HelixKafkaMirrorMakerMetricsReporter.get().getRegistry().register(
getMismatchedTopicMetricName(topic), topicPartitionCounter);
} catch (Exception e) {
LOGGER.error("Error registering metrics!", e);
}
_mismatchedTopicPartitionsCounter.put(topic, topicPartitionCounter);
}
}
for (String topic : _mismatchedTopicPartitionsCounter.keySet()) {
Counter counter = _mismatchedTopicPartitionsCounter.get(topic);
if (!misMatchedPartitionNumberTopics.containsKey(topic)) {
counter.dec(counter.getCount());
} else {
counter.inc(misMatchedPartitionNumberTopics.get(topic) - counter.getCount());
}
}
}
代码示例来源:origin: uber/chaperone
Object secondInitInstance = HelixKafkaMirrorMakerMetricsReporter.get();
Assert.assertTrue(firstInitInstance == secondInitInstance);
Counter testCounter0 = new Counter();
Meter testMeter0 = new Meter();
Timer testTimer0 = new Timer();
代码示例来源:origin: census-instrumentation/opencensus-java
@Test
public void generateFullMetricDescription() {
assertThat(DropWizardUtils.generateFullMetricDescription("Counter", new Counter()))
.isEqualTo("Collected from codahale (metric=Counter, type=com.codahale.metrics.Counter)");
}
}
代码示例来源:origin: kite-sdk/kite
@Test
public void testCompletelyEmpty() throws Exception {
String str = "{}";
Config config = ConfigFactory.parseString(str);
MetricFilter filter = PatternMetricFilter.parse(new Configs(), config);
assertSame(filter, MetricFilter.ALL);
assertTrue(filter.matches("foo", new Counter()));
}
内容来源于网络,如有侵权,请联系作者删除!