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.
---
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.
---