VI - the type of input valuespublic interface Aggregator<VI>
Aggregator enables arbitrary monitoring in user code.
Aggregators are created by calling DoFn.Context.createAggregator(java.lang.String, com.google.cloud.dataflow.sdk.transforms.Combine.CombineFn<? super AI, AA, AO>),
typically from DoFn.startBundle(com.google.cloud.dataflow.sdk.transforms.DoFn<I, O>.Context). Elements can be added to the
Aggregator by calling addValue(VI).
Aggregators are visible in the monitoring UI, when the pipeline is run using DataflowPipelineRunner or BlockingDataflowPipelineRunner, along with their current value. Aggregators may not become visible until the system begins executing the ParDo transform which created them and/or their initial value is changed.
Example:
class MyDoFn extends DoFn<String, String> {
private Aggregator<Integer> myAggregator;
{@literal @}Override
public void startBundle(Context c) {
myAggregator = c.createAggregator("myCounter", new Sum.SumIntegerFn());
}
{@literal @}Override
public void processElement(ProcessContext c) {
myAggregator.addValue(1);
}
}
void addValue(VI value)