Source:
public void metricSet(String prefix, MetricSet set, TopologyContext context) { TaskMetricDimensions taskMetricDimensions = new TaskMetricDimensions(context.getThisTaskId(), context.getThisComponentId(), null, this); for (Map.Entry<String, Metric> entry : set.getMetrics().entrySet()) { MetricNames metricNames = topologyMetricName(prefix + "." + entry.getKey(), context); Metric metric = entry.getValue(); if (metric instanceof Gauge) { registerGauge(metricNames, (Gauge) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Gauge) metric, taskIdGauges); } else if (metric instanceof Meter) { registerMeter(metricNames, (Meter) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Meter) metric, taskIdMeters); } else if (metric instanceof Counter) { registerCounter(metricNames, (Counter) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Counter) metric, taskIdCounters); } else if (metric instanceof Timer) { registerTimer(metricNames, (Timer) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Timer) metric, taskIdTimers); } else if (metric instanceof Histogram) { registerHistogram(metricNames, (Histogram) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Histogram) metric, taskIdHistograms); } else { LOG.error("Unable to save taskId mapping for metric named {}", metric, metricNames.getLongName()); } } }

Target:
public void metricSet(String prefix, MetricSet set, TopologyContext context) { for (Map.Entry<String, Metric> entry : set.getMetrics().entrySet()) { MetricNames metricNames = topologyMetricName(prefix + "." + entry.getKey(), context); Metric metric = entry.getValue(); if (metric instanceof Gauge) { registerGauge(metricNames, (Gauge) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Gauge) metric, taskIdGauges); } else if (metric instanceof Meter) { registerMeter(metricNames, (Meter) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Meter) metric, taskIdMeters); } else if (metric instanceof Counter) { registerCounter(metricNames, (Counter) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Counter) metric, taskIdCounters); } else if (metric instanceof Timer) { registerTimer(metricNames, (Timer) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Timer) metric, taskIdTimers); } else if (metric instanceof Histogram) { registerHistogram(metricNames, (Histogram) metric, context.getThisTaskId(), context.getThisComponentId(), null); saveMetricTaskIdMapping(context.getThisTaskId(), metricNames, (Histogram) metric, taskIdHistograms); } else { LOG.error("Unable to save taskId mapping for metric named {}", metric, metricNames.getLongName()); } } }