Skip to content
Permalink
Browse files
AMBARI-22077 : Create maven module and package structure for the anom…
…aly detection engine. (avijayan)
  • Loading branch information
Aravindan Vijayan committed Apr 1, 2018
1 parent 4b549fc commit 0d3f9b6feb775b7f5c09831b0c94cf58effd6114
Showing 51 changed files with 301 additions and 483 deletions.
@@ -26,8 +26,29 @@
<version>2.0.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ambari-metrics-alertservice</artifactId>
<artifactId>ambari-metrics-anomaly-detector</artifactId>
<version>2.0.0.0-SNAPSHOT</version>
<properties>
<scala.version>2.10.4</scala.version>
<scala.binary.version>2.11</scala.binary.version>
</properties>

<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>

<build>
<plugins>
<plugin>
@@ -37,9 +58,27 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-target:jvm-1.5</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
<name>Ambari Metrics Alert Service</name>
<name>Ambari Metrics Anomaly Detector</name>
<packaging>jar</packaging>

<dependencies>
@@ -122,7 +161,7 @@
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-spark</artifactId>
<version>4.7.0-HBase-1.0</version>
<version>4.10.0-HBase-1.1</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
@@ -145,5 +184,22 @@
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.binary.version}</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_${scala.binary.version}</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -15,12 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.ambari.metrics.alertservice.prototype.methods.MetricAnomaly;
import org.apache.ambari.metrics.alertservice.prototype.methods.ema.EmaTechnique;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
@@ -40,7 +39,6 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;

import org.apache.ambari.metrics.alertservice.prototype.methods.MetricAnomaly;
import org.apache.commons.collections.CollectionUtils;
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;

import org.apache.ambari.metrics.alertservice.prototype.common.DataSeries;
import org.apache.ambari.metrics.alertservice.prototype.common.ResultSet;
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;


import org.apache.ambari.metrics.alertservice.prototype.common.ResultSet;
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;

import org.apache.ambari.metrics.alertservice.prototype.common.DataSeries;
import org.apache.ambari.metrics.alertservice.prototype.methods.MetricAnomaly;
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.core;

import java.io.Serializable;

@@ -18,7 +18,7 @@

package org.apache.ambari.metrics.alertservice.prototype.methods.kstest;

import org.apache.ambari.metrics.alertservice.prototype.RFunctionInvoker;
import org.apache.ambari.metrics.alertservice.prototype.core.RFunctionInvoker;
import org.apache.ambari.metrics.alertservice.prototype.common.DataSeries;
import org.apache.ambari.metrics.alertservice.prototype.common.ResultSet;
import org.apache.ambari.metrics.alertservice.prototype.methods.MetricAnomaly;
@@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.testing.utilities;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@@ -15,8 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;

package org.apache.ambari.metrics.alertservice.prototype.testing.utilities;

import org.apache.ambari.metrics.alertservice.prototype.core.MetricsCollectorInterface;
import org.apache.ambari.metrics.alertservice.prototype.core.RFunctionInvoker;
import org.apache.ambari.metrics.alertservice.prototype.common.DataSeries;
import org.apache.ambari.metrics.alertservice.prototype.common.ResultSet;
import org.apache.ambari.metrics.alertservice.seriesgenerator.MetricSeriesGeneratorFactory;
@@ -0,0 +1,92 @@
/**
* 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.ambari.metrics.alertservice.prototype.testing.utilities;

/**
* Class which was originally used to send test series from AMS to Spark through Kafka.
*/

public class TestMetricSeriesGenerator {
//implements Runnable {

// private Map<TestSeriesInputRequest, AbstractMetricSeries> configuredSeries = new HashMap<>();
// private static final Log LOG = LogFactory.getLog(TestMetricSeriesGenerator.class);
// private TimelineMetricStore metricStore;
// private String hostname;
//
// public TestMetricSeriesGenerator(TimelineMetricStore metricStore) {
// this.metricStore = metricStore;
// try {
// this.hostname = InetAddress.getLocalHost().getHostName();
// } catch (UnknownHostException e) {
// e.printStackTrace();
// }
// }
//
// public void addSeries(TestSeriesInputRequest inputRequest) {
// if (!configuredSeries.containsKey(inputRequest)) {
// AbstractMetricSeries metricSeries = MetricSeriesGeneratorFactory.generateSeries(inputRequest.getSeriesType(), inputRequest.getConfigs());
// configuredSeries.put(inputRequest, metricSeries);
// LOG.info("Added series " + inputRequest.getSeriesName());
// }
// }
//
// public void removeSeries(String seriesName) {
// boolean isPresent = false;
// TestSeriesInputRequest tbd = null;
// for (TestSeriesInputRequest inputRequest : configuredSeries.keySet()) {
// if (inputRequest.getSeriesName().equals(seriesName)) {
// isPresent = true;
// tbd = inputRequest;
// }
// }
// if (isPresent) {
// LOG.info("Removing series " + seriesName);
// configuredSeries.remove(tbd);
// } else {
// LOG.info("Series not found : " + seriesName);
// }
// }
//
// @Override
// public void run() {
// long currentTime = System.currentTimeMillis();
// TimelineMetrics timelineMetrics = new TimelineMetrics();
//
// for (TestSeriesInputRequest input : configuredSeries.keySet()) {
// AbstractMetricSeries metricSeries = configuredSeries.get(input);
// TimelineMetric timelineMetric = new TimelineMetric();
// timelineMetric.setMetricName(input.getSeriesName());
// timelineMetric.setAppId("anomaly-engine-test-metric");
// timelineMetric.setInstanceId(null);
// timelineMetric.setStartTime(currentTime);
// timelineMetric.setHostName(hostname);
// TreeMap<Long, Double> metricValues = new TreeMap();
// metricValues.put(currentTime, metricSeries.nextValue());
// timelineMetric.setMetricValues(metricValues);
// timelineMetrics.addOrMergeTimelineMetric(timelineMetric);
// LOG.info("Emitting metric with appId = " + timelineMetric.getAppId());
// }
// try {
// LOG.info("Publishing test metrics for " + timelineMetrics.getMetrics().size() + " series.");
// metricStore.putMetrics(timelineMetrics);
// } catch (Exception e) {
// LOG.error(e);
// }
// }
}
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.metrics.alertservice.prototype;
package org.apache.ambari.metrics.alertservice.prototype.testing.utilities;

import org.apache.htrace.fasterxml.jackson.core.JsonProcessingException;
import org.apache.htrace.fasterxml.jackson.databind.ObjectMapper;

0 comments on commit 0d3f9b6

Please sign in to comment.