@Override public void markEvent(long n) { this.counter.inc(n); }
@Override public void markEvent() { this.counter.inc(); }
@Override public void onSuccess() { successfulCommits.inc(); }
@Override public void onException(Throwable cause) { LOG.warn("Async Kafka commit failed.", cause); failedCommits.inc(); } };
@Override public void collect(StreamRecord<OUT> record) { numRecordsOut.inc(); output.collect(record); }
@Override public <X> void collect(OutputTag<X> outputTag, StreamRecord<X> record) { numRecordsOut.inc(); output.collect(outputTag, record); }
protected <X> void pushToOperator(StreamRecord<X> record) { try { // we know that the given outputTag matches our OutputTag so the record // must be of the type that our operator expects. @SuppressWarnings("unchecked") StreamRecord<T> castRecord = (StreamRecord<T>) record; numRecordsIn.inc(); operator.setKeyContextElement1(castRecord); operator.processElement(castRecord); } catch (Exception e) { throw new ExceptionInChainedOperatorException(e); } }
@Override protected <X> void pushToOperator(StreamRecord<X> record) { try { // we know that the given outputTag matches our OutputTag so the record // must be of the type that our operator (and Serializer) expects. @SuppressWarnings("unchecked") StreamRecord<T> castRecord = (StreamRecord<T>) record; numRecordsIn.inc(); StreamRecord<T> copy = castRecord.copy(serializer.copy(castRecord.getValue())); operator.setKeyContextElement1(copy); operator.processElement(copy); } catch (ClassCastException e) { if (outputTag != null) { // Enrich error message ClassCastException replace = new ClassCastException( String.format( "%s. Failed to push OutputTag with id '%s' to operator. " + "This can occur when multiple OutputTags with different types " + "but identical names are being used.", e.getMessage(), outputTag.getId())); throw new ExceptionInChainedOperatorException(replace); } else { throw new ExceptionInChainedOperatorException(e); } } catch (Exception e) { throw new ExceptionInChainedOperatorException(e); } } }
completedSplitsCounter.inc();
@Test public void testGetCount() { Counter c = new SimpleCounter(); c.inc(5); Meter m = new MeterView(c, 60); assertEquals(5, m.getCount()); }
numRecordsIn.inc(); streamOperator.setKeyContextElement1(record); streamOperator.processElement(record);
StreamRecord<IN1> record = recordOrWatermark.asRecord(); synchronized (lock) { numRecordsIn.inc(); streamOperator.setKeyContextElement1(record); streamOperator.processElement1(record); StreamRecord<IN2> record = recordOrWatermark.asRecord(); synchronized (lock) { numRecordsIn.inc(); streamOperator.setKeyContextElement2(record); streamOperator.processElement2(record);
sideOutput(element); } else { this.numLateRecordsDropped.inc();
sideOutput(element); } else { this.numLateRecordsDropped.inc();
@Override public IN next() { numRecordsIn.inc(); return this.iterator.next(); }
/** * Marks the current {@link BufferBuilder} as finished and clears the state for next one. */ private void tryFinishCurrentBufferBuilder(int targetChannel) { if (!bufferBuilders[targetChannel].isPresent()) { return; } BufferBuilder bufferBuilder = bufferBuilders[targetChannel].get(); bufferBuilders[targetChannel] = Optional.empty(); numBytesOut.inc(bufferBuilder.finish()); numBuffersOut.inc(); }
/** * Marks the current {@link BufferBuilder} as finished and clears the state for next one. */ private void tryFinishCurrentBufferBuilder(int targetChannel) { if (!bufferBuilders[targetChannel].isPresent()) { return; } BufferBuilder bufferBuilder = bufferBuilders[targetChannel].get(); bufferBuilders[targetChannel] = Optional.empty(); numBytesOut.inc(bufferBuilder.finish()); numBuffersOut.inc(); }
@Override public void collect(IT record) { numRecordsIn.inc(); agg.aggregate(1); }
@Override public void collect(IT record) { try { this.numRecordsIn.inc(); this.outputCollector.collect(record); } catch (Exception ex) { throw new ExceptionInChainedStubException(this.taskName, ex); } }
@Override public void collect(IT record) { try { this.numRecordsIn.inc(); this.mapper.flatMap(record, this.outputCollector); } catch (Exception ex) { throw new ExceptionInChainedStubException(this.taskName, ex); } }