[
https://issues.apache.org/jira/browse/FLINK-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14620819#comment-14620819
]
ASF GitHub Bot commented on FLINK-2292:
---------------------------------------
Github user StephanEwen commented on the pull request:
https://github.com/apache/flink/pull/896#issuecomment-120065197
This pattern seems to repeat in many places:
```java
AccumulatorRegistry accumulatorRegistry =
getEnvironment().getAccumulatorRegistry();
AccumulatorRegistry.Internal internalRegistry =
accumulatorRegistry.getInternal();
this.recordsOutCounter =
internalRegistry.createLongCounter(AccumulatorRegistry.Internal.NUM_RECORDS_OUT);
this.bytesOutCounter =
internalRegistry.createLongCounter(AccumulatorRegistry.Internal.NUM_BYTES_OUT);
AccumulatorRegistry.External externalRegistry =
accumulatorRegistry.getExternal();
this.accumulatorMap = new HashMap<String, Accumulator<?, ?>>();
externalRegistry.setMap(this.accumulatorMap);
```
I think the code would be simpler is the registry simply always had a
created map for internal and external accumulators. Also, a "reporter" object
would help. The code would then look like:
```java
AccumulatorRegistry accumulatos = getEnvironment().getAccumulatorRegistry();
ReadWriteReporter reporter = accumulatos.getReadWriteReporter();
writer.setStatsReporter(reporter);
this.accumulatorMap = accumulatos.getUserMap();
```
> Report accumulators periodically while job is running
> -----------------------------------------------------
>
> Key: FLINK-2292
> URL: https://issues.apache.org/jira/browse/FLINK-2292
> Project: Flink
> Issue Type: Sub-task
> Components: JobManager, TaskManager
> Reporter: Maximilian Michels
> Assignee: Maximilian Michels
> Fix For: 0.10
>
>
> Accumulators should be sent periodically, as part of the heartbeat that sends
> metrics. This allows them to be updated in real time.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)