[ https://issues.apache.org/jira/browse/STORM-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15132572#comment-15132572 ]
ASF GitHub Bot commented on STORM-1524: --------------------------------------- Github user d2r commented on a diff in the pull request: https://github.com/apache/storm/pull/1075#discussion_r51901735 --- Diff: storm-core/src/jvm/org/apache/storm/daemon/metrics/StatisticsUtils.java --- @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.storm.daemon.metrics; + +import org.apache.storm.Config; +import org.apache.storm.daemon.metrics.reporters.JmxPreparableReporter; +import org.apache.storm.daemon.metrics.reporters.PreparableReporter; +import org.apache.storm.utils.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class StatisticsUtils { + private final static Logger LOG = LoggerFactory.getLogger(StatisticsUtils.class); + + public static List<PreparableReporter> getPreparableReporters(Map stormConf) { + PreparableReporter reporter = new JmxPreparableReporter(); + List<String> clazzes = (List<String>) stormConf.get(Config.STORM_STATISTICS_PREPARABLE_REPORTER_PLUGINS); + List<PreparableReporter> reporterList = new ArrayList<>(); + + if (clazzes != null) { + for(String clazz: clazzes ) { + reporterList.add(getPreparableReporter(clazz)); + } + } + if(reporterList.isEmpty()) { + reporterList.add(new JmxPreparableReporter()); + } + return reporterList; + } + + private static PreparableReporter getPreparableReporter(String clazz) { + PreparableReporter reporter = null; + LOG.info("Using statistics reporter plugin:" + clazz); --- End diff -- s/statistics/metrics > Make Storm daemon function statistics reporter pluggable > -------------------------------------------------------- > > Key: STORM-1524 > URL: https://issues.apache.org/jira/browse/STORM-1524 > Project: Apache Storm > Issue Type: New Feature > Components: storm-core > Affects Versions: 0.10.0, 1.0.0, 0.10.1 > Reporter: Kishor Patil > Assignee: Kishor Patil > > We use codahale, metrics-clojure to gather daemon side stats, but currently > the we have only three reporters available which use builder pattern. So it > would be useful to have ability to plugin different reporters that can use > configuration instead of builder pattern. -- This message was sent by Atlassian JIRA (v6.3.4#6332)