Github user abhishekagarwal87 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1595#discussion_r72780835
  
    --- Diff: storm-core/src/jvm/org/apache/storm/metric/SystemBolt.java ---
    @@ -156,7 +219,103 @@ private void registerMetrics(TopologyContext context, 
Map<String, String> metric
     
         @Override
         public void execute(Tuple input) {
    -        throw new RuntimeException("Non-system tuples should never be sent 
to __system bolt.");
    +        IMetricsConsumer.TaskInfo taskInfo = (IMetricsConsumer.TaskInfo) 
input.getValue(0);
    +        Collection<IMetricsConsumer.DataPoint> dataPoints = (Collection) 
input.getValue(1);
    +        Collection<IMetricsConsumer.DataPoint> expandedDataPoints = 
expander.expandDataPoints(dataPoints);
    +
    +        if (aggregateMode) {
    +            handleMetricTupleInAggregateMode(taskInfo, expandedDataPoints);
    +        } else {
    +            collector.emit(Constants.METRICS_AGGREGATE_STREAM_ID, new 
Values(taskInfo, expandedDataPoints));
    +        }
    +    }
    +
    +    private void 
handleMetricTupleInAggregateMode(IMetricsConsumer.TaskInfo taskInfo, 
Collection<IMetricsConsumer.DataPoint> expandedDataPoints) {
    +        Map<Integer, TaskInfoToDataPointsPair> taskToMetricTupleMap = 
intervalToTaskToMetricTupleMap.get(taskInfo.updateIntervalSecs);
    +        if (taskToMetricTupleMap == null) {
    +            taskToMetricTupleMap = new HashMap<>();
    +            
intervalToTaskToMetricTupleMap.put(taskInfo.updateIntervalSecs, 
taskToMetricTupleMap);
    +        }
    +
    +        taskToMetricTupleMap.put(taskInfo.srcTaskId, new 
TaskInfoToDataPointsPair(taskInfo, expandedDataPoints));
    --- End diff --
    
    I didn't get this. It overrides the older information with newer one. what 
if the data point for same task is received before 
'isOKtoAggregateMetricsTuples` is true. 


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to