/** {@inheritDoc} */ @Override public Counter addCounter(String name, String displayName, long value) { final Counter counter = cntrs.findCounter(this.name, name); counter.setValue(value); return counter; }
@Override protected void reportValue(MetricContext context, String name, long value) { this.hadoopContext.getCounter(context.getName(), name).setValue(value); }
private void updateCounters(Task task, MetricGroupFilter filter) { Map<String, Counter> counters = JobMetrics.get(null, task.getJobId()).getMetricContext().getCounters(filter); if (counters != null) { for (Map.Entry<String, Counter> entry : counters.entrySet()) { this.context.getCounter(filter.getGroupName(), entry.getKey()).setValue(entry.getValue().getCount()); } } }
Mockito.verify(this.recordSizeDistributionCount).increment(3l); Mockito.verify(this.totalDurationCount).increment(3l); Mockito.verify(this.queueSize).setValue(1000);
private static Counters createDeprecatedCounters() { Counters counters = new Counters(); // Deprecated counter: make sure it is only printed once counters.findCounter("org.apache.hadoop.mapred.Task$Counter", "MAP_INPUT_RECORDS").setValue(1); counters.findCounter("File System Counters", "FILE: Number of bytes read").setValue(1); return counters; }
@Override public void setValue(long value) { counter.setValue(value); } };
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } return counter; }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } return counter; }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } else { LOG.warn(name + "is not a known counter."); } return counter; }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } return counter; }
private Counters getCounters() { Counters c = new Counters(); Map<String, Map<String, Long>> values = counters.value(); for (Map.Entry<String, Map<String, Long>> e : values.entrySet()) { CounterGroup cg = c.getGroup(e.getKey()); for (Map.Entry<String, Long> f : e.getValue().entrySet()) { cg.findCounter(f.getKey()).setValue(f.getValue()); } } return c; }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } else { LOG.warn(name + "is not a known counter."); } return counter; }
private void updateCounters(Task task, MetricGroupFilter filter) { Map<String, Counter> counters = JobMetrics.get(null, task.getJobId()).getMetricContext().getCounters(filter); if (counters != null) { for (Map.Entry<String, Counter> entry : counters.entrySet()) { this.context.getCounter(filter.getGroupName(), entry.getKey()).setValue(entry.getValue().getCount()); } } }
@Override public synchronized T addCounter(String counterName, String displayName, long value) { String saveName = Limits.filterCounterName(counterName); T counter = findCounterImpl(saveName, false); if (counter == null) { return addCounterImpl(saveName, displayName, value); } counter.setValue(value); return counter; }
@Override public void addCounter(C counter) { C ours = findCounter(counter.getName()); if (ours != null) { ours.setValue(counter.getValue()); } else { LOG.warn(counter.getName() + "is not a known counter."); } }
@Override public synchronized T addCounter(String counterName, String displayName, long value) { String saveName = Limits.filterCounterName(counterName); T counter = findCounterImpl(saveName, false); if (counter == null) { return addCounterImpl(saveName, displayName, value); } counter.setValue(value); return counter; }
@Override public void addCounter(C counter) { C ours = findCounter(counter.getName()); if (ours != null) { ours.setValue(counter.getValue()); } else { LOG.warn(counter.getName() + "is not a known counter."); } }
@Override public synchronized T addCounter(String counterName, String displayName, long value) { String saveName = Limits.filterCounterName(counterName); T counter = findCounterImpl(saveName, false); if (counter == null) { return addCounterImpl(saveName, displayName, value); } counter.setValue(value); return counter; }
@Override public void readFields(DataInput in) throws IOException { clear(); int len = WritableUtils.readVInt(in); T[] enums = enumClass.getEnumConstants(); for (int i = 0; i < len; ++i) { int ord = WritableUtils.readVInt(in); Counter counter = newCounter(enums[ord]); counter.setValue(WritableUtils.readVLong(in)); counters[ord] = counter; } }