add translated java files
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/52d3b587 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/52d3b587 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/52d3b587 Branch: refs/heads/master Commit: 52d3b587f07db7dcf66b774531e2face7247c7b6 Parents: afd2d52 Author: å«ä¹ <[email protected]> Authored: Wed Feb 24 21:12:53 2016 +0800 Committer: å«ä¹ <[email protected]> Committed: Wed Feb 24 21:12:53 2016 +0800 ---------------------------------------------------------------------- .../apache/storm/stats/BoltExecutorStats.java | 62 + .../jvm/org/apache/storm/stats/CommonStats.java | 65 + .../apache/storm/stats/SpoutExecutorStats.java | 49 + .../jvm/org/apache/storm/stats/StatsUtil.java | 2178 ++++++++++++++++++ 4 files changed, 2354 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/52d3b587/storm-core/src/jvm/org/apache/storm/stats/BoltExecutorStats.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/stats/BoltExecutorStats.java b/storm-core/src/jvm/org/apache/storm/stats/BoltExecutorStats.java new file mode 100644 index 0000000..7909a08 --- /dev/null +++ b/storm-core/src/jvm/org/apache/storm/stats/BoltExecutorStats.java @@ -0,0 +1,62 @@ +/** + * 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.stats; + +import org.apache.storm.metric.internal.MultiCountStatAndMetric; +import org.apache.storm.metric.internal.MultiLatencyStatAndMetric; + +public class BoltExecutorStats extends CommonStats { + + public static final String ACKED = "acked"; + public static final String FAILED = "failed"; + public static final String EXECUTED = "executed"; + public static final String PROCESS_LATENCIES = "process-latencies"; + public static final String EXECUTE_LATENCIES = "execute-latencies"; + + public static final String[] BOLT_FIELDS = {ACKED, FAILED, EXECUTED, PROCESS_LATENCIES, EXECUTE_LATENCIES}; + + public BoltExecutorStats() { + super(); + + put(ACKED, new MultiCountStatAndMetric(NUM_STAT_BUCKETS)); + put(FAILED, new MultiCountStatAndMetric(NUM_STAT_BUCKETS)); + put(EXECUTED, new MultiCountStatAndMetric(NUM_STAT_BUCKETS)); + put(PROCESS_LATENCIES, new MultiLatencyStatAndMetric(NUM_STAT_BUCKETS)); + put(EXECUTE_LATENCIES, new MultiLatencyStatAndMetric(NUM_STAT_BUCKETS)); + } + + public MultiCountStatAndMetric getAcked() { + return (MultiCountStatAndMetric) this.get(ACKED); + } + + public MultiCountStatAndMetric getFailed() { + return (MultiCountStatAndMetric) this.get(FAILED); + } + + public MultiCountStatAndMetric getExecuted() { + return (MultiCountStatAndMetric) this.get(EXECUTED); + } + + public MultiLatencyStatAndMetric getProcessLatencies() { + return (MultiLatencyStatAndMetric) this.get(PROCESS_LATENCIES); + } + + public MultiLatencyStatAndMetric getExecuteLatencies() { + return (MultiLatencyStatAndMetric) this.get(EXECUTE_LATENCIES); + } +} http://git-wip-us.apache.org/repos/asf/storm/blob/52d3b587/storm-core/src/jvm/org/apache/storm/stats/CommonStats.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/stats/CommonStats.java b/storm-core/src/jvm/org/apache/storm/stats/CommonStats.java new file mode 100644 index 0000000..a8bf706 --- /dev/null +++ b/storm-core/src/jvm/org/apache/storm/stats/CommonStats.java @@ -0,0 +1,65 @@ +/** + * 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.stats; + +import java.util.HashMap; +import java.util.Map; +import org.apache.storm.metric.api.IMetric; +import org.apache.storm.metric.internal.MultiCountStatAndMetric; + +public class CommonStats { + public static final int NUM_STAT_BUCKETS = 20; + + public static final String RATE = "rate"; + + public static final String EMITTED = "emitted"; + public static final String TRANSFERRED = "transferred"; + public static final String[] COMMON_FIELDS = {EMITTED, TRANSFERRED}; + + protected int rate; + protected final Map metricMap = new HashMap(); + + public CommonStats() { + put(EMITTED, new MultiCountStatAndMetric(NUM_STAT_BUCKETS)); + put(TRANSFERRED, new MultiCountStatAndMetric(NUM_STAT_BUCKETS)); + } + + public int getRate() { + return this.rate; + } + + public void setRate(int rate) { + this.rate = rate; + } + + public MultiCountStatAndMetric getEmitted() { + return (MultiCountStatAndMetric) get(EMITTED); + } + + public MultiCountStatAndMetric getTransferred() { + return (MultiCountStatAndMetric) get(TRANSFERRED); + } + + public IMetric get(String field) { + return (IMetric) StatsUtil.getByKeyword(metricMap, field); + } + + protected void put(String field, Object value) { + StatsUtil.putRawKV(metricMap, field, value); + } +} http://git-wip-us.apache.org/repos/asf/storm/blob/52d3b587/storm-core/src/jvm/org/apache/storm/stats/SpoutExecutorStats.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/stats/SpoutExecutorStats.java b/storm-core/src/jvm/org/apache/storm/stats/SpoutExecutorStats.java new file mode 100644 index 0000000..621ac24 --- /dev/null +++ b/storm-core/src/jvm/org/apache/storm/stats/SpoutExecutorStats.java @@ -0,0 +1,49 @@ +/** + * 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.stats; + +import org.apache.storm.metric.internal.MultiCountStatAndMetric; +import org.apache.storm.metric.internal.MultiLatencyStatAndMetric; + +public class SpoutExecutorStats extends CommonStats { + + public static final String ACKED = "acked"; + public static final String FAILED = "failed"; + public static final String COMPLETE_LATENCIES = "complete-latencies"; + + public static final String[] SPOUT_FIELDS = {ACKED, FAILED, COMPLETE_LATENCIES}; + + public SpoutExecutorStats() { + super(); + this.put(ACKED, new MultiCountStatAndMetric(NUM_STAT_BUCKETS)); + this.put(FAILED, new MultiCountStatAndMetric(NUM_STAT_BUCKETS)); + this.put(COMPLETE_LATENCIES, new MultiLatencyStatAndMetric(NUM_STAT_BUCKETS)); + } + + public MultiCountStatAndMetric getAcked() { + return (MultiCountStatAndMetric) this.get(ACKED); + } + + public MultiCountStatAndMetric getFailed() { + return (MultiCountStatAndMetric) this.get(FAILED); + } + + public MultiLatencyStatAndMetric getCompleteLatencies() { + return (MultiLatencyStatAndMetric) this.get(COMPLETE_LATENCIES); + } +}
