Thanks Chandni. >From my understanding, Aggregators can be set from populateDAG of the StreamingApplication. I was wondering if there is a way to make AutoMetrics available from Operator itself? Or at the module level?
Thanks in advance, Pradeep A. Dalvi On Tue, Jan 5, 2016 at 11:28 AM, Chandni Singh <[email protected]> wrote: > Hi Pradeep, > > Adding dev@apex. > > In an operator defines these Metrics > 1. total tuples > 2. special tuples > > The percentage metric aggregator can be written like this > > public class PercentageAggregator implements AutoMetric.Aggregator > { > > @Override > public Map<String, Object> aggregate(long l, > Collection<AutoMetric.PhysicalMetricsContext> collection) > { > long total = 0; > long special = 0; > for (AutoMetric.PhysicalMetricsContext context : collection) { > total += (Long)context.getMetrics().get("total"); > special += (Long)context.getMetrics().get("special"); > } > > Map<String, Object> result = Maps.newHashMap(); > result.put("specials_percent", (special / (total * 1.0)) * 100); > return result; > } > } > > Chandni > > > > > On Wed, Dec 30, 2015 at 9:16 PM, Pradeep Dalvi < > [email protected]> wrote: > >> Has anyone used or have an idea about percentage aggregator of >> autometrics? >> Any pointer would be useful. >> >> Thanks, >> Pradeep A. Dalvi >> >> >> -- >> Pradeep A. Dalvi >> >> Software Engineer >> DataTorrent (India) >> >> > -- Pradeep A. Dalvi Software Engineer DataTorrent (India)
