[
https://issues.apache.org/jira/browse/STORM-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15132612#comment-15132612
]
ASF GitHub Bot commented on STORM-1524:
---------------------------------------
Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/1075#discussion_r51904548
--- Diff:
storm-core/src/jvm/org/apache/storm/daemon/metrics/reporters/CsvPreparableReporter.java
---
@@ -0,0 +1,97 @@
+/**
+ * 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.reporters;
+
+import com.codahale.metrics.CsvReporter;
+import com.codahale.metrics.MetricFilter;
+import com.codahale.metrics.MetricRegistry;
+import org.apache.storm.Config;
+import org.apache.storm.utils.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+public class CsvPreparableReporter implements
PreparableReporter<CsvReporter> {
+ private final static Logger LOG =
LoggerFactory.getLogger(CsvPreparableReporter.class);
+ CsvReporter reporter = null;
+
+ @Override
+ public void prepare(MetricRegistry metricsRegistry, Map stormConf) {
+ LOG.info("Preparing...");
+ CsvReporter.Builder builder =
CsvReporter.forRegistry(metricsRegistry);
+
+ Locale locale = (Locale) stormConf.get(":locale");
+ if (locale != null) {
+ builder.formatFor(locale);
+ }
+ String rateUnit = Utils.getString(stormConf.get(":rate-unit"),
null);
+ if (rateUnit != null) {
+ builder.convertRatesTo(TimeUnit.valueOf(rateUnit));
+ }
+ String durationUnit =
Utils.getString(stormConf.get(":duration-unit"), null);
+ if (durationUnit != null) {
+ builder.convertDurationsTo(TimeUnit.valueOf(durationUnit));
+ }
+ MetricFilter filter = (MetricFilter) stormConf.get(":filter");
+ if (filter != null) {
+ builder.filter(filter);
+ }
+ String localStormDirLocation =
Utils.getString(stormConf.get(Config.STORM_LOCAL_DIR), ".");
+ File logDir = new File(localStormDirLocation + "csvmetrics" );
--- End diff --
minor nit I'm not sure if we want this configurable or not.
> 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)