[ 
https://issues.apache.org/jira/browse/STORM-2006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15400055#comment-15400055
 ] 

ASF GitHub Bot commented on STORM-2006:
---------------------------------------

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

    https://github.com/apache/storm/pull/1595#discussion_r72865762
  
    --- 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 --
    
    It is intended behavior. If the data point for same task on same interval 
is received and it overwrites the old value, it means old value is not 
aggregated in time. If we want to keep also the old value then it's more 
confusing that what values we want to aggregate together. 
    
    This is due to design issue on current metrics feature (late metrics) and 
if it occurs, metric value would be flawed anyway (I mean value is not measured 
for given interval) so we can't take good care of them. Fixing this issue 
should be a one of the requirements for new metrics feature.


> Storm metrics feature improvement: support per-worker level metrics 
> aggregation
> -------------------------------------------------------------------------------
>
>                 Key: STORM-2006
>                 URL: https://issues.apache.org/jira/browse/STORM-2006
>             Project: Apache Storm
>          Issue Type: Improvement
>          Components: storm-core
>    Affects Versions: 1.1.0
>            Reporter: Jungtaek Lim
>            Assignee: Jungtaek Lim
>
> Storm provides per-task level metrics which could be huge when topology has a 
> number of tasks. 
> Task level metric is useful for determining load balance between tasks, but 
> it doesn't need to be time-series fashion.
> Before introducing topology level component like TopologyMaster for JStorm, 
> we can utilize SystemBolt to aggregate task level metrics to per-worker level 
> metrics.
> We should provide options and this feature should be turned off by default to 
> keep backward compatibility. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to