Repository: ambari Updated Branches: refs/heads/branch-2.0.0 68cf17348 -> 17c1a8d52 refs/heads/trunk ef25e4de8 -> da8c9879c
AMBARI-9764. Remove duplicated TimelineMetric datastructures from ambari-server. (mpapyrkovskyy) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/17c1a8d5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/17c1a8d5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/17c1a8d5 Branch: refs/heads/branch-2.0.0 Commit: 17c1a8d522cfad93285a3afb93e50218ab35f0c1 Parents: 68cf173 Author: Myroslav Papirkovskyy <mpapyrkovs...@hortonworks.com> Authored: Tue Feb 24 12:46:55 2015 +0200 Committer: Myroslav Papirkovskyy <mpapyrkovs...@hortonworks.com> Committed: Tue Mar 3 21:05:11 2015 +0200 ---------------------------------------------------------------------- ambari-metrics/ambari-metrics-assembly/pom.xml | 1 + ambari-metrics/ambari-metrics-common/pom.xml | 22 +++ .../ambari-metrics-flume-sink/pom.xml | 1 + .../ambari-metrics-hadoop-sink/pom.xml | 1 + .../ambari-metrics-host-monitoring/pom.xml | 1 + .../ambari-metrics-kafka-sink/pom.xml | 1 + .../ambari-metrics-storm-sink/pom.xml | 1 + .../ambari-metrics-timelineservice/pom.xml | 2 +- ambari-metrics/pom.xml | 45 +++++ .../src/main/package/deb/control/control | 21 +++ .../src/main/package/deb/control/postinst | 15 ++ .../src/main/package/deb/control/postrm | 15 ++ .../src/main/package/deb/control/posttrm | 15 ++ .../src/main/package/deb/control/preinst | 15 ++ .../src/main/package/deb/control/prerm | 15 ++ ambari-server/pom.xml | 5 + .../metrics2/sink/timeline/TimelineMetric.java | 184 ------------------- .../metrics2/sink/timeline/TimelineMetrics.java | 103 ----------- pom.xml | 5 + 19 files changed, 180 insertions(+), 288 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-assembly/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-assembly/pom.xml b/ambari-metrics/ambari-metrics-assembly/pom.xml index de85973..e7054d6 100644 --- a/ambari-metrics/ambari-metrics-assembly/pom.xml +++ b/ambari-metrics/ambari-metrics-assembly/pom.xml @@ -27,6 +27,7 @@ </parent> <modelVersion>4.0.0</modelVersion> <artifactId>ambari-metrics-assembly</artifactId> + <name>Ambari Metrics Assembly</name> <packaging>pom</packaging> <version>2.0.0-SNAPSHOT</version> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-common/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-common/pom.xml b/ambari-metrics/ambari-metrics-common/pom.xml index 9cad5d4..2e32eb4 100644 --- a/ambari-metrics/ambari-metrics-common/pom.xml +++ b/ambari-metrics/ambari-metrics-common/pom.xml @@ -25,12 +25,34 @@ </parent> <modelVersion>4.0.0</modelVersion> <artifactId>ambari-metrics-common</artifactId> + <name>Ambari Metrics Common</name> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> </plugin> + <plugin> + <groupId>org.vafer</groupId> + <artifactId>jdeb</artifactId> + <version>1.0.1</version> + <executions> + <execution> + <!--Stub execution on direct plugin call - workaround for ambari deb build process--> + <id>stub-execution</id> + <phase>none</phase> + <goals> + <goal>jdeb</goal> + </goals> + </execution> + </executions> + <configuration> + <skip>true</skip> + <attach>false</attach> + <submodules>false</submodules> + <controlDir>${project.basedir}/../src/main/package/deb/control</controlDir> + </configuration> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-flume-sink/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-flume-sink/pom.xml b/ambari-metrics/ambari-metrics-flume-sink/pom.xml index a83d7b0..01c2c7f 100644 --- a/ambari-metrics/ambari-metrics-flume-sink/pom.xml +++ b/ambari-metrics/ambari-metrics-flume-sink/pom.xml @@ -27,6 +27,7 @@ limitations under the License. <modelVersion>4.0.0</modelVersion> <artifactId>ambari-metrics-flume-sink</artifactId> <version>2.0.0-SNAPSHOT</version> + <name>Ambari Metrics Flume Sink</name> <packaging>jar</packaging> <build> <plugins> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml b/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml index ee3bcd8..08de87d 100644 --- a/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml +++ b/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml @@ -27,6 +27,7 @@ limitations under the License. <modelVersion>4.0.0</modelVersion> <artifactId>ambari-metrics-hadoop-sink</artifactId> <version>2.0.0-SNAPSHOT</version> + <name>Ambari Metrics Hadoop Sink</name> <packaging>jar</packaging> <properties> <sinkJarName>${project.artifactId}-with-common-${project.version}.jar</sinkJarName> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-host-monitoring/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-host-monitoring/pom.xml b/ambari-metrics/ambari-metrics-host-monitoring/pom.xml index 7461bd6..746949b 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/pom.xml +++ b/ambari-metrics/ambari-metrics-host-monitoring/pom.xml @@ -28,6 +28,7 @@ <packaging>pom</packaging> <version>2.0.0-SNAPSHOT</version> <artifactId>ambari-metrics-host-monitoring</artifactId> + <name>Ambari Metrics Monitor</name> <properties> <resmonitor.install.dir> /usr/lib/python2.6/site-packages/resource_monitoring http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-kafka-sink/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-kafka-sink/pom.xml b/ambari-metrics/ambari-metrics-kafka-sink/pom.xml index 2aefe1d..b41ea8b 100644 --- a/ambari-metrics/ambari-metrics-kafka-sink/pom.xml +++ b/ambari-metrics/ambari-metrics-kafka-sink/pom.xml @@ -27,6 +27,7 @@ limitations under the License. <modelVersion>4.0.0</modelVersion> <artifactId>ambari-metrics-kafka-sink</artifactId> <version>2.0.0-SNAPSHOT</version> + <name>Ambari Metrics Kafka Sink</name> <packaging>jar</packaging> <build> <plugins> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-storm-sink/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-storm-sink/pom.xml b/ambari-metrics/ambari-metrics-storm-sink/pom.xml index 70bdec5..0bd8fba 100644 --- a/ambari-metrics/ambari-metrics-storm-sink/pom.xml +++ b/ambari-metrics/ambari-metrics-storm-sink/pom.xml @@ -27,6 +27,7 @@ limitations under the License. <modelVersion>4.0.0</modelVersion> <artifactId>ambari-metrics-storm-sink</artifactId> <version>2.0.0-SNAPSHOT</version> + <name>Ambari Metrics Storm Sink</name> <packaging>jar</packaging> <properties> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/ambari-metrics-timelineservice/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/pom.xml b/ambari-metrics/ambari-metrics-timelineservice/pom.xml index 97cc6af..4ec730e 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/pom.xml +++ b/ambari-metrics/ambari-metrics-timelineservice/pom.xml @@ -27,7 +27,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>ambari-metrics-timelineservice</artifactId> <version>2.0.0-SNAPSHOT</version> - <name>ambari-metrics-timelineservice</name> + <name>Ambari Metrics Collector</name> <packaging>jar</packaging> <properties> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-metrics/pom.xml b/ambari-metrics/pom.xml index 41ba1fc..6fc0155 100644 --- a/ambari-metrics/pom.xml +++ b/ambari-metrics/pom.xml @@ -164,6 +164,51 @@ </execution> </executions> </plugin> + <plugin> + <!--Stub execution on direct plugin call - workaround for ambari rpm build process--> + <groupId>org.codehaus.mojo</groupId> + <artifactId>rpm-maven-plugin</artifactId> + <version>2.0.1</version> + <executions> + <execution> + <id>stub-execution</id> + <!-- unbinds rpm creation from maven lifecycle --> + <phase>none</phase> + <goals> + <goal>attached-rpm</goal> + </goals> + </execution> + </executions> + <configuration> + <copyright>2012, Apache Software Foundation</copyright> + <group>Development</group> + <description>Maven Recipe: RPM Package.</description> + <release>${package-release}</release> + <version>${package-version}</version> + <mappings/> + </configuration> + </plugin> + <plugin> + <groupId>org.vafer</groupId> + <artifactId>jdeb</artifactId> + <version>1.0.1</version> + <executions> + <execution> + <!--Stub execution on direct plugin call - workaround for ambari deb build process--> + <id>stub-execution</id> + <phase>none</phase> + <goals> + <goal>jdeb</goal> + </goals> + </execution> + </executions> + <configuration> + <skip>true</skip> + <attach>false</attach> + <submodules>true</submodules> + <controlDir>${project.basedir}/src/main/package/deb/control</controlDir> + </configuration> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/src/main/package/deb/control/control ---------------------------------------------------------------------- diff --git a/ambari-metrics/src/main/package/deb/control/control b/ambari-metrics/src/main/package/deb/control/control new file mode 100644 index 0000000..d00c2cd --- /dev/null +++ b/ambari-metrics/src/main/package/deb/control/control @@ -0,0 +1,21 @@ +# 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: [[artifactId]] +Version: [[package-version]]-[[package-release]] +Section: [[deb.section]] +Priority: [[deb.priority]] +Architecture: [[deb.architecture]] +Description: [[description]] +Maintainer: [[deb.publisher]] http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/src/main/package/deb/control/postinst ---------------------------------------------------------------------- diff --git a/ambari-metrics/src/main/package/deb/control/postinst b/ambari-metrics/src/main/package/deb/control/postinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-metrics/src/main/package/deb/control/postinst @@ -0,0 +1,15 @@ +#!/bin/bash +# 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 http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/src/main/package/deb/control/postrm ---------------------------------------------------------------------- diff --git a/ambari-metrics/src/main/package/deb/control/postrm b/ambari-metrics/src/main/package/deb/control/postrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-metrics/src/main/package/deb/control/postrm @@ -0,0 +1,15 @@ +#!/bin/bash +# 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 http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/src/main/package/deb/control/posttrm ---------------------------------------------------------------------- diff --git a/ambari-metrics/src/main/package/deb/control/posttrm b/ambari-metrics/src/main/package/deb/control/posttrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-metrics/src/main/package/deb/control/posttrm @@ -0,0 +1,15 @@ +#!/bin/bash +# 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 http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/src/main/package/deb/control/preinst ---------------------------------------------------------------------- diff --git a/ambari-metrics/src/main/package/deb/control/preinst b/ambari-metrics/src/main/package/deb/control/preinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-metrics/src/main/package/deb/control/preinst @@ -0,0 +1,15 @@ +#!/bin/bash +# 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 http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-metrics/src/main/package/deb/control/prerm ---------------------------------------------------------------------- diff --git a/ambari-metrics/src/main/package/deb/control/prerm b/ambari-metrics/src/main/package/deb/control/prerm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-metrics/src/main/package/deb/control/prerm @@ -0,0 +1,15 @@ +#!/bin/bash +# 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 http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-server/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml index 4c56d78..2bbb0ee 100644 --- a/ambari-server/pom.xml +++ b/ambari-server/pom.xml @@ -1761,6 +1761,11 @@ <artifactId>snmp4j</artifactId> <version>1.10.1</version> </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-metrics-common</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> <pluginRepositories> http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java b/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java deleted file mode 100644 index 843aecd..0000000 --- a/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java +++ /dev/null @@ -1,184 +0,0 @@ -/** - * 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.hadoop.metrics2.sink.timeline; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.text.DecimalFormat; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -@XmlRootElement(name = "metric") -@XmlAccessorType(XmlAccessType.NONE) -public class TimelineMetric implements Comparable<TimelineMetric> { - - private String metricName; - private String appId; - private String instanceId; - private String hostName; - private long timestamp; - private long startTime; - private String type; - private Map<Long, Double> metricValues = new TreeMap<Long, Double>(); - - @XmlElement(name = "metricname") - public String getMetricName() { - return metricName; - } - - public void setMetricName(String metricName) { - this.metricName = metricName; - } - - @XmlElement(name = "appid") - public String getAppId() { - return appId; - } - - public void setAppId(String appId) { - this.appId = appId; - } - - @XmlElement(name = "instanceid") - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - @XmlElement(name = "hostname") - public String getHostName() { - return hostName; - } - - public void setHostName(String hostName) { - this.hostName = hostName; - } - - @XmlElement(name = "timestamp") - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - @XmlElement(name = "starttime") - public long getStartTime() { - return startTime; - } - - public void setStartTime(long startTime) { - this.startTime = startTime; - } - - @XmlElement(name = "type") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - @XmlElement(name = "metrics") - public Map<Long, Double> getMetricValues() { - return metricValues; - } - - public void setMetricValues(Map<Long, Double> metricValues) { - this.metricValues = metricValues; - } - - public void addMetricValues(Map<Long, Double> metricValues) { - this.metricValues.putAll(metricValues); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - TimelineMetric metric = (TimelineMetric) o; - - if (!metricName.equals(metric.metricName)) return false; - if (hostName != null ? !hostName.equals(metric.hostName) : metric.hostName != null) - return false; - if (!appId.equals(metric.appId)) return false; - if (instanceId != null ? !instanceId.equals(metric.instanceId) : metric.instanceId != null) - return false; - if (timestamp != metric.timestamp) return false; - if (startTime != metric.startTime) return false; - - return true; - } - - public boolean equalsExceptTime(TimelineMetric metric) { - if (!metricName.equals(metric.metricName)) return false; - if (hostName != null ? !hostName.equals(metric.hostName) : metric.hostName != null) - return false; - if (!appId.equals(metric.appId)) return false; - if (instanceId != null ? !instanceId.equals(metric.instanceId) : metric.instanceId != null) - return false; - - return true; - } - - @Override - public int hashCode() { - int result = metricName.hashCode(); - result = 31 * result + appId.hashCode(); - result = 31 * result + (instanceId != null ? instanceId.hashCode() : 0); - result = 31 * result + (hostName != null ? hostName.hashCode() : 0); - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - return result; - } - - @Override - public int compareTo(TimelineMetric other) { - if (timestamp > other.timestamp) { - return -1; - } else if (timestamp < other.timestamp) { - return 1; - } else { - return metricName.compareTo(other.metricName); - } - } - - @Override - public String toString() { - return "TimelineMetric{" + - "metricName='" + metricName + '\'' + - ", appId='" + appId + '\'' + - ", instanceId='" + instanceId + '\'' + - ", hostName='" + hostName + '\'' + - ", timestamp=" + timestamp + - ", startTime=" + startTime + - ", type='" + type + '\'' + - ", metricValues=" + metricValues + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetrics.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetrics.java b/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetrics.java deleted file mode 100644 index 0448fdb..0000000 --- a/ambari-server/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetrics.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * 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.hadoop.metrics2.sink.timeline; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * The class that hosts a list of timeline entities. - */ -@XmlRootElement(name = "metrics") -@XmlAccessorType(XmlAccessType.NONE) -public class TimelineMetrics { - - private List<TimelineMetric> allMetrics = new ArrayList<TimelineMetric>(); - - public TimelineMetrics() {} - - @XmlElement(name = "metrics") - public List<TimelineMetric> getMetrics() { - return allMetrics; - } - - public void setMetrics(List<TimelineMetric> allMetrics) { - this.allMetrics = allMetrics; - } - - private boolean isEqualTimelineMetrics(TimelineMetric metric1, - TimelineMetric metric2) { - - boolean isEqual = true; - - if (!metric1.getMetricName().equals(metric2.getMetricName())) { - return false; - } - - if (metric1.getHostName() != null) { - isEqual = metric1.getHostName().equals(metric2.getHostName()); - } - - if (metric1.getAppId() != null) { - isEqual = metric1.getAppId().equals(metric2.getAppId()); - } - - return isEqual; - } - - @Override - public String toString() { - return "TimelineMetrics{" + - "allMetrics=" + allMetrics + - '}'; - } - - /** - * Merge with existing TimelineMetric if everything except startTime is - * the same. - * @param metric {@link TimelineMetric} - */ - public void addOrMergeTimelineMetric(TimelineMetric metric) { - TimelineMetric metricToMerge = null; - - if (!allMetrics.isEmpty()) { - for (TimelineMetric timelineMetric : allMetrics) { - if (timelineMetric.equalsExceptTime(metric)) { - metricToMerge = timelineMetric; - break; - } - } - } - - if (metricToMerge != null) { - metricToMerge.addMetricValues(metric.getMetricValues()); - if (metricToMerge.getTimestamp() > metric.getTimestamp()) { - metricToMerge.setTimestamp(metric.getTimestamp()); - } - if (metricToMerge.getStartTime() > metric.getStartTime()) { - metricToMerge.setStartTime(metric.getStartTime()); - } - } else { - allMetrics.add(metric); - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/17c1a8d5/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index bafff2e..9fc2c90 100644 --- a/pom.xml +++ b/pom.xml @@ -345,6 +345,7 @@ <!-- Metrics module --> <!-- psutil : external lib, Apache 2.0 license included as a source file --> + <exclude>ambari-metrics/target/**</exclude> <exclude>ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil/**</exclude> <exclude>ambari-metrics/target/rpm/ambari-metrics/SPECS/ambari-metrics.spec</exclude> <exclude>ambari-metrics/ambari-metrics-timelineservice/src/test/resources/lib/org/apache/phoenix/phoenix-core-tests/4.2.0/phoenix-core-tests-4.2.0.pom</exclude> @@ -417,6 +418,7 @@ <module>ambari-agent</module> <module>ambari-client</module> <module>ambari-shell</module> + <module>ambari-metrics/ambari-metrics-common</module> </modules> </profile> <profile> @@ -429,6 +431,7 @@ <module>ambari-agent</module> <module>ambari-client</module> <module>ambari-shell</module> + <module>ambari-metrics/ambari-metrics-common</module> </modules> </profile> <profile> @@ -447,6 +450,7 @@ <module>ambari-agent</module> <module>ambari-client</module> <module>ambari-shell</module> + <module>ambari-metrics/ambari-metrics-common</module> </modules> </profile> <profile> @@ -472,6 +476,7 @@ <module>ambari-agent</module> <module>ambari-client</module> <module>ambari-shell</module> + <module>ambari-metrics/ambari-metrics-common</module> </modules> </profile> <profile>