agresch commented on a change in pull request #3251:
URL: https://github.com/apache/storm/pull/3251#discussion_r412318374
##########
File path: storm-client/src/jvm/org/apache/storm/executor/Executor.java
##########
@@ -339,47 +342,106 @@ private void
addV2Metrics(List<IMetricsConsumer.DataPoint> dataPoints) {
return;
}
StormMetricRegistry stormMetricRegistry =
workerData.getMetricRegistry();
- for (Map.Entry<String, Gauge> entry :
stormMetricRegistry.registry().getGauges().entrySet()) {
- String name = entry.getKey();
- Object v = entry.getValue().getValue();
- if (v instanceof Number) {
- IMetricsConsumer.DataPoint dataPoint = new
IMetricsConsumer.DataPoint(name, v);
- dataPoints.add(dataPoint);
- } else {
- LOG.warn("Cannot report {}, its value is not a Number {}",
name, v);
+ Map<String, Metric> metrics =
stormMetricRegistry.getExecutorMetrics(this);
+ processGauges(metrics, dataPoints);
+ processCounters(metrics, dataPoints);
+ processHistograms(metrics, dataPoints);
+ processMeters(metrics, dataPoints);
+ processTimers(metrics, dataPoints);
+
+ // at this point, we should have no metrics left to process
+ if (!metrics.isEmpty()) {
+ for (Map.Entry<String, Metric> entry : metrics.entrySet()) {
+ LOG.warn("Unable to process metric {} {}", entry.getKey(),
entry.getValue());
}
}
- for (Map.Entry<String, Counter> entry :
stormMetricRegistry.registry().getCounters().entrySet()) {
- Object value = entry.getValue().getCount();
- IMetricsConsumer.DataPoint dataPoint = new
IMetricsConsumer.DataPoint(entry.getKey(), value);
- dataPoints.add(dataPoint);
+ }
+
+ private void processGauges(Map<String, Metric> metrics,
List<IMetricsConsumer.DataPoint> dataPoints) {
+ Set<String> processedMetrics = new HashSet<>();
Review comment:
Will add API for getGauges() etc. with a taskId filter.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]