Return-Path: X-Original-To: apmail-flink-issues-archive@minotaur.apache.org Delivered-To: apmail-flink-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E400182A8 for ; Thu, 9 Jul 2015 16:44:48 +0000 (UTC) Received: (qmail 98888 invoked by uid 500); 9 Jul 2015 16:44:48 -0000 Delivered-To: apmail-flink-issues-archive@flink.apache.org Received: (qmail 98844 invoked by uid 500); 9 Jul 2015 16:44:48 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 98835 invoked by uid 99); 9 Jul 2015 16:44:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jul 2015 16:44:48 +0000 X-ASF-Spam-Status: No, hits=-2000.6 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 09 Jul 2015 16:42:38 +0000 Received: (qmail 98446 invoked by uid 99); 9 Jul 2015 16:44:24 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jul 2015 16:44:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B4F00E6837; Thu, 9 Jul 2015 16:44:24 +0000 (UTC) From: StephanEwen To: issues@flink.incubator.apache.org Reply-To: issues@flink.incubator.apache.org References: In-Reply-To: Subject: [GitHub] flink pull request: [FLINK-2292][FLINK-1573] add live per-task acc... Content-Type: text/plain Message-Id: <20150709164424.B4F00E6837@git1-us-west.apache.org> Date: Thu, 9 Jul 2015 16:44:24 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org 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>(); 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(); ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---