You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by av...@apache.org on 2018/01/02 21:59:40 UTC
[2/7] ambari git commit: AMBARI-22717 : Remove Anomaly Detection code
from branch-3.0-ams. (avijayan)
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDataSourceTest.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDataSourceTest.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDataSourceTest.scala
deleted file mode 100644
index 9757d76..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDataSourceTest.scala
+++ /dev/null
@@ -1,57 +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.ambari.metrics.adservice.leveldb
-
-import java.io.File
-
-import org.apache.ambari.metrics.adservice.app.AnomalyDetectionAppConfig
-import org.apache.ambari.metrics.adservice.configuration.MetricDefinitionDBConfiguration
-import org.iq80.leveldb.util.FileUtils
-import org.mockito.Mockito.when
-import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
-import org.scalatest.mockito.MockitoSugar
-
-class LevelDBDataSourceTest extends FunSuite with BeforeAndAfter with Matchers with MockitoSugar {
-
- var db: LevelDBDataSource = _
- var file : File = FileUtils.createTempDir("adservice-leveldb-test")
-
- before {
- val appConfig: AnomalyDetectionAppConfig = mock[AnomalyDetectionAppConfig]
- val mdConfig : MetricDefinitionDBConfiguration = mock[MetricDefinitionDBConfiguration]
-
- when(appConfig.getMetricDefinitionDBConfiguration).thenReturn(mdConfig)
- when(mdConfig.getVerifyChecksums).thenReturn(true)
- when(mdConfig.getPerformParanoidChecks).thenReturn(false)
- when(mdConfig.getDbDirPath).thenReturn(file.getAbsolutePath)
-
- db = new LevelDBDataSource(appConfig)
- db.initialize()
- }
-
- test("testOperations") {
- db.put("Hello".getBytes(), "World".getBytes())
- assert(db.get("Hello".getBytes()).get.sameElements("World".getBytes()))
- db.update(Seq("Hello".getBytes()), Seq(("Hello".getBytes(), "Mars".getBytes())))
- assert(db.get("Hello".getBytes()).get.sameElements("Mars".getBytes()))
- }
-
- after {
- FileUtils.deleteRecursively(file)
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/AMSMetadataProviderTest.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/AMSMetadataProviderTest.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/AMSMetadataProviderTest.scala
deleted file mode 100644
index 79366b1..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/AMSMetadataProviderTest.scala
+++ /dev/null
@@ -1,49 +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.ambari.metrics.adservice.metadata
-
-import java.util
-
-import org.apache.ambari.metrics.adservice.configuration.MetricCollectorConfiguration
-import org.scalatest.FunSuite
-
-class AMSMetadataProviderTest extends FunSuite {
-
- test("testFromTimelineMetricKey") {
- val timelineMetricKeys: java.util.Set[java.util.Map[String, String]] = new java.util.HashSet[java.util.Map[String, String]]()
-
- val uuid: Array[Byte] = Array.empty[Byte]
-
- for (i <- 1 to 3) {
- val keyMap: java.util.Map[String, String] = new util.HashMap[String, String]()
- keyMap.put("metricName", "M" + i)
- keyMap.put("appId", "App")
- keyMap.put("hostname", "H")
- keyMap.put("uuid", new String(uuid))
- timelineMetricKeys.add(keyMap)
- }
-
- val aMSMetadataProvider : ADMetadataProvider = new ADMetadataProvider(new MetricCollectorConfiguration)
-
- val metricKeys : Set[MetricKey] = aMSMetadataProvider.getMetricKeys(timelineMetricKeys)
- assert(metricKeys.size == 3)
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricDefinitionServiceTest.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricDefinitionServiceTest.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricDefinitionServiceTest.scala
deleted file mode 100644
index d3454f2..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricDefinitionServiceTest.scala
+++ /dev/null
@@ -1,130 +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.ambari.metrics.adservice.metadata
-
-import org.apache.ambari.metrics.adservice.app.AnomalyDetectionAppConfig
-import org.apache.ambari.metrics.adservice.db.AdMetadataStoreAccessor
-import org.easymock.EasyMock.{anyObject, expect, expectLastCall, replay}
-import org.scalatest.FunSuite
-import org.scalatest.easymock.EasyMockSugar
-
-class MetricDefinitionServiceTest extends FunSuite {
-
- test("testAddDefinition") {
-
- val definitions : scala.collection.mutable.MutableList[MetricSourceDefinition] = scala.collection.mutable.MutableList.empty[MetricSourceDefinition]
-
- for (i <- 1 to 3) {
- val msd1 : MetricSourceDefinition = new MetricSourceDefinition("TestDefinition" + i, "testAppId", MetricSourceDefinitionType.API)
- definitions.+=(msd1)
- }
-
- val newDef : MetricSourceDefinition = new MetricSourceDefinition("NewDefinition", "testAppId", MetricSourceDefinitionType.API)
-
- val adMetadataStoreAccessor: AdMetadataStoreAccessor = EasyMockSugar.niceMock[AdMetadataStoreAccessor]
- expect(adMetadataStoreAccessor.getSavedInputDefinitions).andReturn(definitions.toList).once()
- expect(adMetadataStoreAccessor.saveInputDefinition(newDef)).andReturn(true).once()
- replay(adMetadataStoreAccessor)
-
- val metricDefinitionService: MetricDefinitionServiceImpl = new MetricDefinitionServiceImpl(new AnomalyDetectionAppConfig, adMetadataStoreAccessor)
-
- metricDefinitionService.setAdMetadataStoreAccessor(adMetadataStoreAccessor)
-
- metricDefinitionService.addDefinition(newDef)
-
- assert(metricDefinitionService.metricSourceDefinitionMap.size == 4)
- assert(metricDefinitionService.metricSourceDefinitionMap.get("testDefinition") != null)
- }
-
- test("testGetDefinitionByName") {
- val definitions : scala.collection.mutable.MutableList[MetricSourceDefinition] = scala.collection.mutable.MutableList.empty[MetricSourceDefinition]
-
- for (i <- 1 to 3) {
- val msd1 : MetricSourceDefinition = new MetricSourceDefinition("TestDefinition" + i, "testAppId", MetricSourceDefinitionType.API)
- definitions.+=(msd1)
- }
-
- val adMetadataStoreAccessor: AdMetadataStoreAccessor = EasyMockSugar.niceMock[AdMetadataStoreAccessor]
- expect(adMetadataStoreAccessor.getSavedInputDefinitions).andReturn(definitions.toList).once()
- replay(adMetadataStoreAccessor)
-
- val metricDefinitionService: MetricDefinitionServiceImpl = new MetricDefinitionServiceImpl(new AnomalyDetectionAppConfig, adMetadataStoreAccessor)
-
- metricDefinitionService.setAdMetadataStoreAccessor(adMetadataStoreAccessor)
- for (i <- 1 to 3) {
- val definition: MetricSourceDefinition = metricDefinitionService.getDefinitionByName("TestDefinition" + i)
- assert(definition != null)
- }
- }
-
- test("testGetDefinitionByAppId") {
- val definitions : scala.collection.mutable.MutableList[MetricSourceDefinition] = scala.collection.mutable.MutableList.empty[MetricSourceDefinition]
-
- for (i <- 1 to 3) {
- var msd1 : MetricSourceDefinition = null
- if (i == 2) {
- msd1 = new MetricSourceDefinition("TestDefinition" + i, null, MetricSourceDefinitionType.API)
- } else {
- msd1 = new MetricSourceDefinition("TestDefinition" + i, "testAppId", MetricSourceDefinitionType.API)
- }
- definitions.+=(msd1)
- }
-
- val adMetadataStoreAccessor: AdMetadataStoreAccessor = EasyMockSugar.niceMock[AdMetadataStoreAccessor]
- expect(adMetadataStoreAccessor.getSavedInputDefinitions).andReturn(definitions.toList).once()
- replay(adMetadataStoreAccessor)
-
- val metricDefinitionService: MetricDefinitionServiceImpl = new MetricDefinitionServiceImpl(new AnomalyDetectionAppConfig, adMetadataStoreAccessor)
-
- metricDefinitionService.setAdMetadataStoreAccessor(adMetadataStoreAccessor)
- val definitionsByAppId: List[MetricSourceDefinition] = metricDefinitionService.getDefinitionByAppId("testAppId")
- assert(definitionsByAppId.size == 2)
- }
-
- test("testDeleteDefinitionByName") {
- val definitions : scala.collection.mutable.MutableList[MetricSourceDefinition] = scala.collection.mutable.MutableList.empty[MetricSourceDefinition]
-
- for (i <- 1 to 3) {
- var msd1 : MetricSourceDefinition = null
- if (i == 2) {
- msd1 = new MetricSourceDefinition("TestDefinition" + i, null, MetricSourceDefinitionType.CONFIG)
- } else {
- msd1 = new MetricSourceDefinition("TestDefinition" + i, "testAppId", MetricSourceDefinitionType.API)
- }
- definitions.+=(msd1)
- }
-
- val adMetadataStoreAccessor: AdMetadataStoreAccessor = EasyMockSugar.niceMock[AdMetadataStoreAccessor]
- expect(adMetadataStoreAccessor.getSavedInputDefinitions).andReturn(definitions.toList).once()
- expect(adMetadataStoreAccessor.removeInputDefinition(anyObject[String])).andReturn(true).times(2)
- replay(adMetadataStoreAccessor)
-
- val metricDefinitionService: MetricDefinitionServiceImpl = new MetricDefinitionServiceImpl(new AnomalyDetectionAppConfig, adMetadataStoreAccessor)
-
- metricDefinitionService.setAdMetadataStoreAccessor(adMetadataStoreAccessor)
-
- var success: Boolean = metricDefinitionService.deleteDefinitionByName("TestDefinition1")
- assert(success)
- success = metricDefinitionService.deleteDefinitionByName("TestDefinition2")
- assert(!success)
- success = metricDefinitionService.deleteDefinitionByName("TestDefinition3")
- assert(success)
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricSourceDefinitionTest.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricSourceDefinitionTest.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricSourceDefinitionTest.scala
deleted file mode 100644
index c4d4dbc..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/metadata/MetricSourceDefinitionTest.scala
+++ /dev/null
@@ -1,91 +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.ambari.metrics.adservice.metadata
-
-import org.apache.commons.lang.SerializationUtils
-import org.scalatest.FunSuite
-
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.module.scala.DefaultScalaModule
-import org.apache.ambari.metrics.adservice.app.ADServiceScalaModule
-
-class MetricSourceDefinitionTest extends FunSuite {
-
- test("createNewMetricSourceDefinition") {
- val msd : MetricSourceDefinition = new MetricSourceDefinition("testDefinition", "testAppId", MetricSourceDefinitionType.API)
-
- assert(msd.definitionName == "testDefinition")
- assert(msd.appId == "testAppId")
- assert(msd.definitionSource == MetricSourceDefinitionType.API)
-
- assert(msd.hosts.isEmpty)
- assert(msd.metricDefinitions.isEmpty)
- assert(msd.associatedAnomalySubsystems.isEmpty)
- assert(msd.relatedDefinitions.isEmpty)
- }
-
- test("testAddMetricDefinition") {
- val msd : MetricSourceDefinition = new MetricSourceDefinition("testDefinition", "testAppId", MetricSourceDefinitionType.API)
- assert(msd.metricDefinitions.isEmpty)
-
- msd.addMetricDefinition(MetricDefinition("TestMetric", "TestApp", List.empty[String]))
- assert(msd.metricDefinitions.nonEmpty)
- }
-
- test("testEquals") {
- val msd1 : MetricSourceDefinition = new MetricSourceDefinition("testDefinition", "testAppId", MetricSourceDefinitionType.API)
- val msd2 : MetricSourceDefinition = new MetricSourceDefinition("testDefinition", "testAppId2", MetricSourceDefinitionType.API)
- assert(msd1 == msd2)
-
- val msd3 : MetricSourceDefinition = new MetricSourceDefinition("testDefinition1", "testAppId", MetricSourceDefinitionType.API)
- val msd4 : MetricSourceDefinition = new MetricSourceDefinition("testDefinition2", "testAppId2", MetricSourceDefinitionType.API)
- assert(msd3 != msd4)
- }
-
- test("testRemoveMetricDefinition") {
- val msd : MetricSourceDefinition = new MetricSourceDefinition("testDefinition", "testAppId", MetricSourceDefinitionType.API)
- assert(msd.metricDefinitions.isEmpty)
-
- msd.addMetricDefinition(MetricDefinition("TestMetric", "TestApp", List.empty[String]))
- assert(msd.metricDefinitions.nonEmpty)
-
- msd.removeMetricDefinition(MetricDefinition("TestMetric", "TestApp", List.empty[String]))
- assert(msd.metricDefinitions.isEmpty)
- }
-
- test("serializeDeserialize") {
-
- val msd : MetricSourceDefinition = new MetricSourceDefinition("testDefinition", "A1", MetricSourceDefinitionType.API)
- msd.hosts = List("h1")
- msd.addMetricDefinition(MetricDefinition("M1", null, List("h2")))
- msd.addMetricDefinition(MetricDefinition("M1", "A2", null))
-
- val msdByteArray: Array[Byte] = SerializationUtils.serialize(msd)
- assert(msdByteArray.nonEmpty)
-
- val msd2: MetricSourceDefinition = SerializationUtils.deserialize(msdByteArray).asInstanceOf[MetricSourceDefinition]
- assert(msd2 != null)
- assert(msd == msd2)
-
- val mapper : ObjectMapper = new ObjectMapper()
- mapper.registerModule(new ADServiceScalaModule)
-
- System.out.print(mapper.writeValueAsString(msd))
-
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/RangeTest.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/RangeTest.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/RangeTest.scala
deleted file mode 100644
index 16f4951..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/RangeTest.scala
+++ /dev/null
@@ -1,38 +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.ambari.metrics.adservice.model
-
-import org.apache.ambari.metrics.adservice.model
-import org.scalatest.FlatSpec
-
-class RangeTest extends FlatSpec {
-
- "A Range " should " return true for inner and boundary values" in {
- val range : model.Range = model.Range(4,6)
- assert(range.withinRange(5))
- assert(range.withinRange(6))
- assert(range.withinRange(4))
- assert(!range.withinRange(7))
- }
-
- it should "accept same lower and higher range values" in {
- val range : model.Range = model.Range(4,4)
- assert(range.withinRange(4))
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/SeasonTest.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/SeasonTest.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/SeasonTest.scala
deleted file mode 100644
index a661c05..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/test/scala/org/apache/ambari/metrics/adservice/model/SeasonTest.scala
+++ /dev/null
@@ -1,92 +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.ambari.metrics.adservice.model
-
-import java.util.Calendar
-
-import org.apache.ambari.metrics.adservice.model
-import org.scalatest.FunSuite
-
-class SeasonTest extends FunSuite {
-
- test("testBelongsTo") {
-
- //Create Season for weekdays. Mon to Friday and 9AM - 5PM
- var season : Season = Season(model.Range(Calendar.MONDAY,Calendar.FRIDAY), model.Range(9,17))
-
- //Try with a timestamp on a Monday, @ 9AM.
- val c = Calendar.getInstance
- c.set(2017, Calendar.OCTOBER, 30, 9, 0, 0)
- assert(season.belongsTo(c.getTimeInMillis))
-
- c.set(2017, Calendar.OCTOBER, 30, 18, 0, 0)
- assert(!season.belongsTo(c.getTimeInMillis))
-
- //Try with a timestamp on a Sunday, @ 9AM.
- c.set(2017, Calendar.OCTOBER, 29, 9, 0, 0)
- assert(!season.belongsTo(c.getTimeInMillis))
-
- //Create Season for Monday 11AM - 12Noon.
- season = Season(model.Range(Calendar.MONDAY,Calendar.MONDAY), model.Range(11,12))
- c.set(2017, Calendar.OCTOBER, 30, 9, 0, 0)
- assert(!season.belongsTo(c.getTimeInMillis))
-
- c.set(2017, Calendar.OCTOBER, 30, 11, 30, 0)
- assert(season.belongsTo(c.getTimeInMillis))
-
-
- //Create Season from Friday to Monday and 9AM - 5PM
- season = Season(model.Range(Calendar.FRIDAY,Calendar.MONDAY), model.Range(9,17))
-
- //Try with a timestamp on a Monday, @ 9AM.
- c.set(2017, Calendar.OCTOBER, 30, 9, 0, 0)
- assert(season.belongsTo(c.getTimeInMillis))
-
- //Try with a timestamp on a Sunday, @ 3PM.
- c.set(2017, Calendar.OCTOBER, 29, 15, 0, 0)
- assert(season.belongsTo(c.getTimeInMillis))
-
- //Try with a timestamp on a Wednesday, @ 9AM.
- c.set(2017, Calendar.NOVEMBER, 1, 9, 0, 0)
- assert(!season.belongsTo(c.getTimeInMillis))
- }
-
- test("testEquals") {
-
- var season1: Season = Season(model.Range(4,5), model.Range(2,3))
- var season2: Season = Season(model.Range(4,5), model.Range(2,3))
- assert(season1 == season2)
-
- var season3: Season = Season(model.Range(4,4), model.Range(2,3))
- assert(!(season1 == season3))
- }
-
- test("testSerialize") {
- val season1 : Season = Season(model.Range(Calendar.MONDAY,Calendar.FRIDAY), model.Range(9,17))
-
- val seasonString = Season.toJson(season1)
-
- val season2 : Season = Season.fromJson(seasonString)
- assert(season1 == season2)
-
- val season3 : Season = Season(model.Range(Calendar.MONDAY,Calendar.THURSDAY), model.Range(9,17))
- assert(!(season2 == season3))
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/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 b1a6430..557b218 100644
--- a/ambari-metrics/ambari-metrics-assembly/pom.xml
+++ b/ambari-metrics/ambari-metrics-assembly/pom.xml
@@ -42,7 +42,6 @@
<storm-sink-legacy.dir>${project.basedir}/../ambari-metrics-storm-sink-legacy</storm-sink-legacy.dir>
<flume-sink.dir>${project.basedir}/../ambari-metrics-flume-sink</flume-sink.dir>
<kafka-sink.dir>${project.basedir}/../ambari-metrics-kafka-sink</kafka-sink.dir>
- <anomaly-detection.dir>${project.basedir}/../ambari-metrics-anomaly-detection-service</anomaly-detection.dir>
<python.ver>python >= 2.6</python.ver>
<python.devel>python-devel</python.devel>
<deb.publisher>Apache</deb.publisher>
@@ -57,7 +56,6 @@
<storm.sink.legacy.jar>ambari-metrics-storm-sink-legacy-with-common-${project.version}.jar</storm.sink.legacy.jar>
<flume.sink.jar>ambari-metrics-flume-sink-with-common-${project.version}.jar</flume.sink.jar>
<kafka.sink.jar>ambari-metrics-kafka-sink-with-common-${project.version}.jar</kafka.sink.jar>
- <anomaly.detection.jar>ambari-metrics-anomaly-detection-service-${project.version}.jar</anomaly.detection.jar>
</properties>
<build>
@@ -141,22 +139,6 @@
</configuration>
</execution>
<execution>
- <id>anomaly-detection</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <attach>false</attach>
- <finalName>ambari-metrics-anomaly-detection-${project.version}</finalName>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>${assemblydescriptor.anomaly-detection}</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- </configuration>
- </execution>
- <execution>
<id>hadoop-sink</id>
<phase>prepare-package</phase>
<goals>
@@ -656,82 +638,6 @@
</configuration>
</execution>
- <!--ambari-metrics-anomaly-detection-->
- <execution>
- <id>ambari-metrics-anomaly-detection</id>
- <phase>package</phase>
- <goals>
- <goal>rpm</goal>
- </goals>
- <configuration>
- <name>ambari-metrics-anomaly-detection</name>
- <copyright>2012, Apache Software Foundation</copyright>
- <group>Development</group>
- <description>Maven Recipe: RPM Package.</description>
- <autoRequires>false</autoRequires>
-
-
- <defaultFilemode>644</defaultFilemode>
- <defaultDirmode>755</defaultDirmode>
- <defaultUsername>root</defaultUsername>
- <defaultGroupname>root</defaultGroupname>
-
- <postinstallScriptlet>
- <scriptFile>${project.build.directory}/resources/rpm/anomaly-detection/postinstall.sh</scriptFile>
- <fileEncoding>utf-8</fileEncoding>
- </postinstallScriptlet>
-
- <mappings>
- <mapping>
- <!--jars-->
- <directory>/usr/lib/ambari-metrics-anomaly-detection/</directory>
- <sources>
- <source>
- <location>
- ${anomaly-detection.dir}/target/ambari-metrics-anomaly-detection-service-${project.version}.jar
- </location>
- </source>
- </sources>
- </mapping>
- <mapping>
- <directory>/usr/lib/ambari-metrics-anomaly-detection/spark</directory>
- <sources>
- <source>
- <location>
- ${anomaly-detection.dir}/target/embedded/spark
- </location>
- </source>
- </sources>
- </mapping>
- <mapping>
- <directory>/usr/sbin</directory>
- <filemode>755</filemode>
- <username>root</username>
- <groupname>root</groupname>
- <directoryIncluded>false</directoryIncluded>
- <sources>
- <source>
- <location>${anomaly-detection.dir}/conf/unix/ambari-metrics-admanager</location>
- <filter>false</filter>
- </source>
- </sources>
- </mapping>
- <mapping>
- <directory>/etc/ambari-metrics-anomaly-detection/conf</directory>
- <configuration>true</configuration>
- <sources>
- <source>
- <location>${anomaly-detection.dir}/conf/unix/config.yaml</location>
- </source>
- <source>
- <location>${anomaly-detection.dir}/conf/unix/log4j.properties</location>
- </source>
- </sources>
- </mapping>
- </mappings>
- </configuration>
- </execution>
-
</executions>
</plugin>
</plugins>
@@ -850,13 +756,10 @@
<path>/etc/ambari-metrics-collector/conf</path>
<path>/etc/ambari-metrics-grafana/conf</path>
<path>/etc/ams-hbase/conf</path>
- <path>/etc/ambari-metrics-anomaly-detection/conf</path>
<path>/var/run/ams-hbase</path>
<path>/var/run/ambari-metrics-grafana</path>
<path>/var/log/ambari-metrics-grafana</path>
<path>/var/lib/ambari-metrics-collector</path>
- <path>/usr/lib/ambari-metrics-anomaly-detection</path>
- <path>/var/lib/ambari-metrics-anomaly-detection</path>
<path>/var/lib/ambari-metrics-monitor/lib</path>
<path>/var/lib/ambari-metrics-grafana</path>
<path>/usr/lib/ambari-metrics-hadoop-sink</path>
@@ -1075,49 +978,6 @@
</mapper>
</data>
- <!-- Anomaly Detection -->
- <data>
- <src>${anomaly-detection.dir}/target/${anomaly.detection.jar}</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <dirmode>644</dirmode>
- <prefix>/usr/lib/ambari-metrics-anomaly-detection</prefix>
- </mapper>
- </data>
- <data>
- <type>link</type>
- <linkName>/usr/lib/ambari-metrics-anomaly-detection/ambari-metrics-anomaly-detection-service.jar</linkName>
- <linkTarget>/usr/lib/ambari-metrics-anomaly-detection/${anomaly.detection.jar}</linkTarget>
- <symlink>true</symlink>
- </data>
- <data>
- <src>${anomaly-detection.dir}/target/embedded/spark</src>
- <type>directory</type>
- <mapper>
- <type>perm</type>
- <prefix>/usr/lib/ambari-metrics-anomaly-detection/spark</prefix>
- <filemode>644</filemode>
- </mapper>
- </data>
- <data>
- <src>${anomaly-detection.dir}/conf/unix/config.yaml</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <filemode>755</filemode>
- <prefix>/etc/ambari-metrics-anomaly-detection/conf</prefix>
- </mapper>
- </data>
- <data>
- <src>${anomaly-detection.dir}/conf/unix/log4j.properties</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <filemode>755</filemode>
- <prefix>/etc/ambari-metrics-anomaly-detection/conf</prefix>
- </mapper>
- </data>
<!-- hadoop sink -->
<data>
@@ -1214,7 +1074,6 @@
<assemblydescriptor.monitor>src/main/assembly/monitor.xml</assemblydescriptor.monitor>
<assemblydescriptor.sink>src/main/assembly/sink.xml</assemblydescriptor.sink>
<assemblydescriptor.grafana>src/main/assembly/grafana.xml</assemblydescriptor.grafana>
- <assemblydescriptor.anomaly-detection>src/main/assembly/anomaly-detection.xml</assemblydescriptor.anomaly-detection>
<packagingFormat>jar</packagingFormat>
</properties>
@@ -1495,13 +1354,6 @@
<artifactId>ambari-metrics-host-aggregator</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.ambari</groupId>
- <artifactId>ambari-metrics-anomaly-detection-service</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <optional>true</optional>
- </dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-assembly/src/main/assembly/anomaly-detection.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/src/main/assembly/anomaly-detection.xml b/ambari-metrics/ambari-metrics-assembly/src/main/assembly/anomaly-detection.xml
deleted file mode 100644
index b05aaf3..0000000
--- a/ambari-metrics/ambari-metrics-assembly/src/main/assembly/anomaly-detection.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.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.
- -->
-
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
- <id>anomaly-detection</id>
- <formats>
- <format>dir</format>
- <format>tar.gz</format>
- </formats>
-
- <fileSets>
- <fileSet>
- <directory>${anomaly-detection.dir}/target/embedded/spark</directory>
- <outputDirectory>anomaly-detection/spark</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>${anomaly-detection.dir}/conf/unix</directory>
- <outputDirectory>anomaly-detection/bin</outputDirectory>
- <includes>
- <include>ambari-metrics-admanager</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${anomaly-detection.dir}/conf/unix</directory>
- <outputDirectory>anomaly-detection/conf</outputDirectory>
- <includes>
- <include>config.yaml</include>
- <include>log4j.properties</include>
- </includes>
- </fileSet>
- </fileSets>
-
- <files>
- <file>
- <fileMode>644</fileMode>
- <source>${anomaly-detection.dir}/target/ambari-metrics-anomaly-detection-service-${project.version}.jar
- </source>
- <outputDirectory>anomaly-detection</outputDirectory>
- </file>
- </files>
-</assembly>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-assembly/src/main/package/rpm/anomaly-detection/postinstall.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/src/main/package/rpm/anomaly-detection/postinstall.sh b/ambari-metrics/ambari-metrics-assembly/src/main/package/rpm/anomaly-detection/postinstall.sh
deleted file mode 100644
index 399c439..0000000
--- a/ambari-metrics/ambari-metrics-assembly/src/main/package/rpm/anomaly-detection/postinstall.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/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
-
-
-ANOMALY_DETECTION_LINK_NAME="/usr/lib/ambari-metrics-anomaly-detection/ambari-metrics-anomaly-detection-service.jar"
-ANOMALY_DETECTION_JAR="/usr/lib/ambari-metrics-anomaly-detection/${anomaly.detection.jar}"
-
-JARS=(${ANOMALY_DETECTION_JAR})
-LINKS=(${ANOMALY_DETECTION_LINK_NAME})
-
-for index in ${!LINKS[*]}
-do
- rm -f ${LINKS[$index]} ; ln -s ${JARS[$index]} ${LINKS[$index]}
-done
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-grafana/src/main/scripted.js
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/src/main/scripted.js b/ambari-metrics/ambari-metrics-grafana/src/main/scripted.js
deleted file mode 100644
index 298535f..0000000
--- a/ambari-metrics/ambari-metrics-grafana/src/main/scripted.js
+++ /dev/null
@@ -1,118 +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.
- */
-
-/* global _ */
-
-/*
- * Complex scripted dashboard
- * This script generates a dashboard object that Grafana can load. It also takes a number of user
- * supplied URL parameters (in the ARGS variable)
- *
- * Return a dashboard object, or a function
- *
- * For async scripts, return a function, this function must take a single callback function as argument,
- * call this callback function with the dashboard object (look at scripted_async.js for an example)
- */
-
-'use strict';
-
-// accessible variables in this scope
-var window, document, ARGS, $, jQuery, moment, kbn;
-
-// Setup some variables
-var dashboard;
-
-// All url parameters are available via the ARGS object
-var ARGS;
-
-// Intialize a skeleton with nothing but a rows array and service object
-dashboard = {
- rows : [],
-};
-
-// Set a title
-dashboard.title = 'Scripted dash';
-
-// Set default time
-// time can be overriden in the url using from/to parameters, but this is
-// handled automatically in grafana core during dashboard initialization
-
-
-var obj = JSON.parse(ARGS.anomalies);
-var metrics = obj.metrics;
-var rows = metrics.length
-
-dashboard.time = {
- from: "now-1h",
- to: "now"
-};
-
-var metricSet = new Set();
-
-for (var i = 0; i < rows; i++) {
-
- var key = metrics[i].metricname;
- if (metricSet.has(key)) {
- continue;
- }
- metricSet.add(key)
- var metricKeyElements = key.split(":");
- var metricName = metricKeyElements[0];
- var appId = metricKeyElements[1];
- var hostname = metricKeyElements[2];
-
- dashboard.rows.push({
- title: 'Chart',
- height: '300px',
- panels: [
- {
- title: metricName,
- type: 'graph',
- span: 12,
- fill: 1,
- linewidth: 2,
- targets: [
- {
- "aggregator": "none",
- "alias": metricName,
- "app": appId,
- "errors": {},
- "metric": metricName,
- "precision": "default",
- "refId": "A",
- "hosts": hostname
- }
- ],
- seriesOverrides: [
- {
- alias: '/random/',
- yaxis: 2,
- fill: 0,
- linewidth: 5
- }
- ],
- tooltip: {
- shared: true
- }
- }
- ]
- });
-}
-
-
-return dashboard;
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/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 b26927e..d3a976b 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/pom.xml
+++ b/ambari-metrics/ambari-metrics-timelineservice/pom.xml
@@ -348,7 +348,7 @@
<dependency>
<groupId>org.apache.ambari</groupId>
<artifactId>ambari-metrics-common</artifactId>
- <version>2.0.0.0-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricsService.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricsService.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricsService.java
index 20b344f..d557974 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricsService.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricsService.java
@@ -161,10 +161,6 @@ public class HBaseTimelineMetricsService extends AbstractService implements Time
"start cache node", e);
}
}
-// String kafkaServers = configuration.getKafkaServers();
-// if (kafkaServers != null) {
-// metricKafkaProducer = new MetricKafkaProducer(kafkaServers);
-// }
defaultTopNHostsLimit = Integer.parseInt(metricsConf.get(DEFAULT_TOPN_HOSTS_LIMIT, "20"));
if (Boolean.parseBoolean(metricsConf.get(USE_GROUPBY_AGGREGATOR_QUERIES, "true"))) {
@@ -243,11 +239,6 @@ public class HBaseTimelineMetricsService extends AbstractService implements Time
}
@Override
- public TimelineMetrics getAnomalyMetrics(String method, long startTime, long endTime, Integer limit) throws SQLException {
- return hBaseAccessor.getAnomalyMetricRecords(method, startTime, endTime, limit);
- }
-
- @Override
public TimelineMetrics getTimelineMetrics(List<String> metricNames,
List<String> hostnames, String applicationId, String instanceId,
Long startTime, Long endTime, Precision precision, Integer limit,
@@ -416,14 +407,6 @@ public class HBaseTimelineMetricsService extends AbstractService implements Time
cache.putMetrics(metrics.getMetrics(), metricMetadataManager);
}
-// try {
-// metricKafkaProducer.sendMetrics(metrics);
-//// if (metrics.getMetrics().size() != 0 && metrics.getMetrics().get(0).getAppId().equals("anomaly-engine-test-metric")) {
-//// }
-// } catch (Exception e) {
-// LOG.error(e);
-// }
-
return response;
}
@@ -490,54 +473,6 @@ public class HBaseTimelineMetricsService extends AbstractService implements Time
return metricMetadataManager.getUuid(metricName, appId, instanceId, hostname);
}
- /**
- * Given a metricName, appId, instanceId and optional hostname parameter, return a set of TimelineMetricKey objects
- * that will have all the unique metric instances for the above parameter filter.
- *
- * @param metricName
- * @param appId
- * @param instanceId
- * @param hosts
- * @return
- * @throws SQLException
- * @throws IOException
- */
- @Override
- public Set<Map<String, String>> getTimelineMetricKeys(String metricName, String appId, String instanceId, List<String> hosts)
- throws SQLException, IOException {
- Set<Map<String, String>> timelineMetricKeys = new HashSet<>();
-
- if (CollectionUtils.isEmpty(hosts)) {
- Set<String> hostsFromMetadata = new HashSet<>();
- for (String host : metricMetadataManager.getHostedAppsCache().keySet()) {
- if (metricMetadataManager.getHostedAppsCache().get(host).getHostedApps().contains(appId)) {
- hostsFromMetadata.add(host);
- }
- }
- for (String host : hostsFromMetadata) {
- byte[] uuid = metricMetadataManager.getUuid(metricName, appId, instanceId, host);
- Map<String, String> keyMap = new HashMap<>();
- keyMap.put("metricName", metricName);
- keyMap.put("appId", appId);
- keyMap.put("hostname", host);
- keyMap.put("uuid", new String(uuid));
- timelineMetricKeys.add(keyMap);
- }
- return timelineMetricKeys;
- } else {
- for (String host : hosts) {
- byte[] uuid = metricMetadataManager.getUuid(metricName, appId, instanceId, host);
- Map<String, String> keyMap = new HashMap<>();
- keyMap.put("metricName", metricName);
- keyMap.put("appId", appId);
- keyMap.put("hostname", host);
- keyMap.put("uuid", new String(uuid));
- timelineMetricKeys.add(keyMap);
- }
- return timelineMetricKeys;
- }
- }
-
@Override
public Map<String, Set<String>> getHostAppsMetadata() throws SQLException, IOException {
Map<String, TimelineMetricHostMetadata> hostsMetadata = metricMetadataManager.getHostedAppsCache();
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index 4db2612..5b04c37 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -48,9 +48,7 @@ import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.ti
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration.TIMELINE_METRICS_PRECISION_TABLE_HBASE_BLOCKING_STORE_FILES;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration.TIMELINE_METRIC_AGGREGATOR_SINK_CLASS;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.ALTER_METRICS_METADATA_TABLE;
-import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.ANOMALY_METRICS_TABLE_NAME;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CONTAINER_METRICS_TABLE_NAME;
-import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_ANOMALY_METRICS_TABLE_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_CONTAINER_METRICS_TABLE_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_HOSTED_APPS_METADATA_TABLE_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_INSTANCE_HOST_TABLE_SQL;
@@ -59,7 +57,6 @@ import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.ti
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_METRICS_CLUSTER_AGGREGATE_TABLE_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_METRICS_METADATA_TABLE_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_METRICS_TABLE_SQL;
-import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.CREATE_TREND_ANOMALY_METRICS_TABLE_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.DEFAULT_ENCODING;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.DEFAULT_TABLE_COMPRESSION;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.GET_HOSTED_APPS_METADATA_SQL;
@@ -75,9 +72,7 @@ import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.ti
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.METRICS_RECORD_TABLE_NAME;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.PHOENIX_TABLES;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.PHOENIX_TABLES_REGEX_PATTERN;
-import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.TREND_ANOMALY_METRICS_TABLE_NAME;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_AGGREGATE_RECORD_SQL;
-import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_ANOMALY_METRICS_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_CLUSTER_AGGREGATE_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_CLUSTER_AGGREGATE_TIME_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_CONTAINER_METRICS_SQL;
@@ -85,7 +80,6 @@ import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.ti
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_INSTANCE_HOST_METADATA_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_METADATA_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_METRICS_SQL;
-import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.UPSERT_TREND_ANOMALY_METRICS_SQL;
import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.source.InternalSourceProvider.SOURCE_NAME.RAW_METRICS;
import java.io.IOException;
@@ -322,57 +316,6 @@ public class PhoenixHBaseAccessor {
commitMetrics(Collections.singletonList(timelineMetrics));
}
- private void commitAnomalyMetric(Connection conn, TimelineMetric metric) {
- PreparedStatement metricRecordStmt = null;
- try {
- Map<String, String> metricMetadata = metric.getMetadata();
-
- byte[] uuid = metadataManagerInstance.getUuid(metric);
- if (uuid == null) {
- LOG.error("Error computing UUID for metric. Cannot write metrics : " + metric.toString());
- return;
- }
-
- if (metric.getAppId().equals("anomaly-engine-ks") || metric.getAppId().equals("anomaly-engine-hsdev")) {
- metricRecordStmt = conn.prepareStatement(String.format(UPSERT_TREND_ANOMALY_METRICS_SQL,
- TREND_ANOMALY_METRICS_TABLE_NAME));
-
- metricRecordStmt.setBytes(1, uuid);
- metricRecordStmt.setLong(2, metric.getStartTime());
- metricRecordStmt.setLong(3, Long.parseLong(metricMetadata.get("test-start-time")));
- metricRecordStmt.setLong(4, Long.parseLong(metricMetadata.get("train-start-time")));
- metricRecordStmt.setLong(5, Long.parseLong(metricMetadata.get("train-end-time")));
- String json = TimelineUtils.dumpTimelineRecordtoJSON(metric.getMetricValues());
- metricRecordStmt.setString(6, json);
- metricRecordStmt.setString(7, metric.getMetadata().get("method"));
- double anomalyScore = metric.getMetadata().containsKey("anomaly-score") ? Double.parseDouble(metric.getMetadata().get("anomaly-score")) : 0.0;
- metricRecordStmt.setDouble(8, anomalyScore);
-
- } else {
- metricRecordStmt = conn.prepareStatement(String.format(
- UPSERT_ANOMALY_METRICS_SQL, ANOMALY_METRICS_TABLE_NAME));
-
- metricRecordStmt.setBytes(1, uuid);
- metricRecordStmt.setLong(2, metric.getStartTime());
- String json = TimelineUtils.dumpTimelineRecordtoJSON(metric.getMetricValues());
- metricRecordStmt.setString(3, json);
- metricRecordStmt.setString(4, metric.getMetadata().get("method"));
- double anomalyScore = metric.getMetadata().containsKey("anomaly-score") ? Double.parseDouble(metric.getMetadata().get("anomaly-score")) : 0.0;
- metricRecordStmt.setDouble(5, anomalyScore);
- }
-
- try {
- metricRecordStmt.executeUpdate();
- } catch (SQLException sql) {
- LOG.error("Failed on insert records to store.", sql);
- }
-
- } catch (Exception e) {
- LOG.error("Failed on insert records to anomaly table.", e);
- }
-
- }
-
public void commitMetrics(Collection<TimelineMetrics> timelineMetricsCollection) {
LOG.debug("Committing metrics to store");
Connection conn = null;
@@ -384,9 +327,6 @@ public class PhoenixHBaseAccessor {
UPSERT_METRICS_SQL, METRICS_RECORD_TABLE_NAME));
for (TimelineMetrics timelineMetrics : timelineMetricsCollection) {
for (TimelineMetric metric : timelineMetrics.getMetrics()) {
- if (metric.getAppId().startsWith("anomaly-engine") && !metric.getAppId().equals("anomaly-engine-test-metric")) {
- commitAnomalyMetric(conn, metric);
- }
metricRecordStmt.clearParameters();
@@ -536,20 +476,6 @@ public class PhoenixHBaseAccessor {
stmt.executeUpdate( String.format(CREATE_CONTAINER_METRICS_TABLE_SQL,
encoding, tableTTL.get(CONTAINER_METRICS_TABLE_NAME), compression));
- //Anomaly Metrics
- stmt.executeUpdate(String.format(CREATE_ANOMALY_METRICS_TABLE_SQL,
- ANOMALY_METRICS_TABLE_NAME,
- encoding,
- tableTTL.get(METRICS_AGGREGATE_HOURLY_TABLE_NAME),
- compression));
-
- //Trend Anomaly Metrics
- stmt.executeUpdate(String.format(CREATE_TREND_ANOMALY_METRICS_TABLE_SQL,
- TREND_ANOMALY_METRICS_TABLE_NAME,
- encoding,
- tableTTL.get(METRICS_AGGREGATE_HOURLY_TABLE_NAME),
- compression));
-
// Host level
String precisionSql = String.format(CREATE_METRICS_TABLE_SQL,
encoding, tableTTL.get(METRICS_RECORD_TABLE_NAME), compression);
@@ -949,47 +875,6 @@ public class PhoenixHBaseAccessor {
insertMetricRecords(metrics, false);
}
- public TimelineMetrics getAnomalyMetricRecords(String method, long startTime, long endTime, Integer limit) throws SQLException {
- Connection conn = getConnection();
- PreparedStatement stmt = null;
- ResultSet rs = null;
- TimelineMetrics metrics = new TimelineMetrics();
- try {
- stmt = PhoenixTransactSQL.prepareAnomalyMetricsGetSqlStatement(conn, method, startTime, endTime, limit);
- rs = stmt.executeQuery();
- while (rs.next()) {
-
- byte[] uuid = rs.getBytes("UUID");
- TimelineMetric metric = metadataManagerInstance.getMetricFromUuid(uuid);
-
- if (method.equals("ks") || method.equals("hsdev")) {
- metric.setStartTime(rs.getLong("TEST_END_TIME"));
- } else {
- metric.setStartTime(rs.getLong("SERVER_TIME"));
- }
- metric.setInstanceId(null);
-
- HashMap<String, String> metadata = new HashMap<>();
- metadata.put("method", rs.getString("METHOD"));
- metadata.put("anomaly-score", String.valueOf(rs.getDouble("ANOMALY_SCORE")));
- if (method.equals("ks") || method.equals("hsdev")) {
- metadata.put("test-start-time", String.valueOf(rs.getLong("TEST_START_TIME")));
- metadata.put("train-start-time", String.valueOf(rs.getLong("TRAIN_START_TIME")));
- metadata.put("train-end-time", String.valueOf(rs.getLong("TRAIN_END_TIME")));
- }
- metric.setMetadata(metadata);
-
- TreeMap<Long, Double> sortedByTimeMetrics = readMetricFromJSON(rs.getString("METRICS"));
- metric.setMetricValues(sortedByTimeMetrics);
-
- metrics.getMetrics().add(metric);
- }
- } catch (Exception ex) {
- LOG.error(ex);
- }
- return metrics;
- }
-
@SuppressWarnings("unchecked")
public TimelineMetrics getMetricRecords(
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricStore.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricStore.java
index 349ef83..b2cd1c2 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricStore.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricStore.java
@@ -107,9 +107,4 @@ public interface TimelineMetricStore {
* @return [ hostname ]
*/
List<String> getLiveInstances();
-
- TimelineMetrics getAnomalyMetrics(String method, long startTime, long endTime, Integer limit) throws SQLException;
-
- Set<Map<String, String>> getTimelineMetricKeys(String metricName, String appId, String instanceId, List<String> hosts) throws SQLException, IOException;
-
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
index efdf167..1482f7c 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java
@@ -39,27 +39,6 @@ public class PhoenixTransactSQL {
public static final Log LOG = LogFactory.getLog(PhoenixTransactSQL.class);
- public static final String CREATE_ANOMALY_METRICS_TABLE_SQL =
- "CREATE TABLE IF NOT EXISTS %s " +
- "(UUID BINARY(20) NOT NULL, " +
- "SERVER_TIME UNSIGNED_LONG NOT NULL, " +
- "METRICS VARCHAR, " +
- "METHOD VARCHAR, " +
- "ANOMALY_SCORE DOUBLE CONSTRAINT pk " +
- "PRIMARY KEY (UUID, SERVER_TIME)) DATA_BLOCK_ENCODING='%s', IMMUTABLE_ROWS=true, TTL=%s, COMPRESSION='%s'";
-
- public static final String CREATE_TREND_ANOMALY_METRICS_TABLE_SQL =
- "CREATE TABLE IF NOT EXISTS %s " +
- "(UUID BINARY(20) NOT NULL, " +
- "TEST_START_TIME UNSIGNED_LONG NOT NULL, " +
- "TEST_END_TIME UNSIGNED_LONG NOT NULL, " +
- "TRAIN_START_TIME UNSIGNED_LONG, " +
- "TRAIN_END_TIME UNSIGNED_LONG, " +
- "METRICS VARCHAR, " +
- "METHOD VARCHAR, " +
- "ANOMALY_SCORE DOUBLE CONSTRAINT pk " +
- "PRIMARY KEY (UUID, TEST_START_TIME, TEST_END_TIME)) DATA_BLOCK_ENCODING='%s', IMMUTABLE_ROWS=true, TTL=%s, COMPRESSION='%s'";
-
/**
* Create table to store individual metric records.
*/
@@ -169,25 +148,6 @@ public class PhoenixTransactSQL {
*/
public static final String ALTER_SQL = "ALTER TABLE %s SET TTL=%s";
- public static final String UPSERT_ANOMALY_METRICS_SQL = "UPSERT INTO %s " +
- "(UUID, " +
- "SERVER_TIME, " +
- "METRICS, " +
- "METHOD, " +
- "ANOMALY_SCORE) VALUES " +
- "(?, ?, ?, ?, ?)";
-
- public static final String UPSERT_TREND_ANOMALY_METRICS_SQL = "UPSERT INTO %s " +
- "(UUID, " +
- "TEST_START_TIME, " +
- "TEST_END_TIME, " +
- "TRAIN_START_TIME, " +
- "TRAIN_END_TIME, " +
- "METRICS, " +
- "METHOD, " +
- "ANOMALY_SCORE) VALUES " +
- "(?, ?, ?, ?, ?, ?, ?, ?)";
-
/**
* Insert into metric records table.
*/
@@ -263,22 +223,6 @@ public class PhoenixTransactSQL {
public static final String UPSERT_INSTANCE_HOST_METADATA_SQL =
"UPSERT INTO INSTANCE_HOST_METADATA (INSTANCE_ID, HOSTNAME) VALUES (?, ?)";
- public static final String GET_ANOMALY_METRIC_SQL = "SELECT UUID, SERVER_TIME, " +
- "METRICS, " +
- "METHOD, " +
- "ANOMALY_SCORE " +
- "FROM %s " +
- "WHERE METHOD = ? AND SERVER_TIME > ? AND SERVER_TIME <= ? ORDER BY ANOMALY_SCORE DESC";
-
- public static final String GET_TREND_ANOMALY_METRIC_SQL = "SELECT UUID, " +
- "TEST_START_TIME, TEST_END_TIME, " +
- "TRAIN_START_TIME, TRAIN_END_TIME, " +
- "METRICS, " +
- "METHOD, " +
- "ANOMALY_SCORE " +
- "FROM %s " +
- "WHERE METHOD = ? AND TEST_END_TIME > ? AND TEST_END_TIME <= ? ORDER BY ANOMALY_SCORE DESC";
-
/**
* Retrieve a set of rows from metrics records table.
*/
@@ -391,9 +335,6 @@ public class PhoenixTransactSQL {
"%s AS SERVER_TIME, %s, 1, %s, %s FROM %s WHERE UUID IN %s AND SERVER_TIME > %s AND SERVER_TIME <= %s " +
"GROUP BY UUID ORDER BY %s DESC LIMIT %s";
- public static final String ANOMALY_METRICS_TABLE_NAME = "METRIC_ANOMALIES";
- public static final String TREND_ANOMALY_METRICS_TABLE_NAME = "TREND_METRIC_ANOMALIES";
-
public static final String METRICS_RECORD_TABLE_NAME = "METRIC_RECORD";
public static final String CONTAINER_METRICS_TABLE_NAME = "CONTAINER_METRICS";
@@ -458,40 +399,6 @@ public class PhoenixTransactSQL {
PhoenixTransactSQL.sortMergeJoinEnabled = sortMergeJoinEnabled;
}
- public static PreparedStatement prepareAnomalyMetricsGetSqlStatement(Connection connection, String method,
- long startTime, long endTime, Integer limit) throws SQLException {
- StringBuilder sb = new StringBuilder();
- if (method.equals("ema") || method.equals("tukeys")) {
- sb.append(String.format(GET_ANOMALY_METRIC_SQL, ANOMALY_METRICS_TABLE_NAME));
- } else {
- sb.append(String.format(GET_TREND_ANOMALY_METRIC_SQL, TREND_ANOMALY_METRICS_TABLE_NAME));
- }
- if (limit != null) {
- sb.append(" LIMIT " + limit);
- }
- PreparedStatement stmt = null;
- try {
- stmt = connection.prepareStatement(sb.toString());
- int pos = 1;
-
- stmt.setString(pos++, method);
- stmt.setLong(pos++, startTime);
- stmt.setLong(pos, endTime);
- if (limit != null) {
- stmt.setFetchSize(limit);
- }
-
- } catch (SQLException e) {
- if (stmt != null) {
- stmt.close();
- }
- throw e;
- }
-
- return stmt;
- }
-
-
public static PreparedStatement prepareGetMetricsSqlStmt(Connection connection,
Condition condition) throws SQLException {
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
index 2930b33..c09900d 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
@@ -284,26 +284,6 @@ public class TimelineWebServices {
}
@GET
- @Path("/metrics/anomalies")
- @Produces({ MediaType.APPLICATION_JSON })
- public TimelineMetrics getAnomalyMetrics(
- @Context HttpServletRequest req,
- @Context HttpServletResponse res,
- @QueryParam("method") String method,
- @QueryParam("startTime") String startTime,
- @QueryParam("endTime") String endTime,
- @QueryParam("limit") String limit
- ) {
- init(res);
-
- try {
- return timelineMetricStore.getAnomalyMetrics(method, parseLongStr(startTime), parseLongStr(endTime), parseIntStr(limit));
- } catch (Exception e) {
- throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
- }
- }
-
- @GET
@Path("/metrics/metadata")
@Produces({ MediaType.APPLICATION_JSON })
public Map<String, List<TimelineMetricMetadata>> getTimelineMetricMetadata(
@@ -379,30 +359,6 @@ public class TimelineWebServices {
}
}
- @GET
- @Path("/metrics/metadata/key")
- @Produces({ MediaType.APPLICATION_JSON })
- public Set<Map<String, String>> getTimelineMetricKey(
- @Context HttpServletRequest req,
- @Context HttpServletResponse res,
- @QueryParam("metricName") String metricName,
- @QueryParam("appId") String appId,
- @QueryParam("instanceId") String instanceId,
- @QueryParam("hostname") String hostname
- ) {
- init(res);
-
- try {
- if (StringUtils.isEmpty(hostname)) {
- return timelineMetricStore.getTimelineMetricKeys(metricName, appId, instanceId, Collections.EMPTY_LIST);
- } else {
- return timelineMetricStore.getTimelineMetricKeys(metricName, appId, instanceId, Arrays.asList(StringUtils.split(hostname, ",")));
- }
- } catch (Exception e) {
- throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
- }
- }
-
/**
* This is a discovery endpoint that advertises known live collector
* instances. Note: It will always answer with current instance as live.
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestTimelineMetricStore.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestTimelineMetricStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestTimelineMetricStore.java
index 9b79fa9..9ff2e07 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestTimelineMetricStore.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestTimelineMetricStore.java
@@ -119,15 +119,6 @@ public class TestTimelineMetricStore implements TimelineMetricStore {
return null;
}
- @Override
- public TimelineMetrics getAnomalyMetrics(String method, long startTime, long endTime, Integer limit) {
- return null;
- }
-
- @Override
- public Set<Map<String, String>> getTimelineMetricKeys(String metricName, String appId, String instanceId, List<String> hosts) throws SQLException, IOException {
- return Collections.emptySet();
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/pom.xml b/ambari-metrics/pom.xml
index ab3fcc4..6541cec 100644
--- a/ambari-metrics/pom.xml
+++ b/ambari-metrics/pom.xml
@@ -33,7 +33,6 @@
<module>ambari-metrics-host-monitoring</module>
<module>ambari-metrics-grafana</module>
<module>ambari-metrics-host-aggregator</module>
- <module>ambari-metrics-anomaly-detection-service</module>
<module>ambari-metrics-assembly</module>
</modules>
<properties>
@@ -49,8 +48,6 @@
<grafana.tar>https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0.linux-x64.tar.gz</grafana.tar>
<phoenix.tar>http://dev.hortonworks.com.s3.amazonaws.com/HDP/centos7/3.x/BUILDS/3.0.0.0-623/tars/phoenix/phoenix-5.0.0.3.0.0.0-623.tar.gz</phoenix.tar>
<phoenix.folder>phoenix-5.0.0.3.0.0.0-623</phoenix.folder>
- <spark.tar>http://dev.hortonworks.com.s3.amazonaws.com/HDP/centos7/3.x/BUILDS/3.0.0.0-439/tars/spark2/spark-2.1.0.3.0.0.0-439-bin-3.0.0.3.0.0.0-439.tgz</spark.tar>
- <spark.folder>spark-2.1.0.3.0.0.0-439-bin-3.0.0.3.0.0.0-439</spark.folder>
<resmonitor.install.dir>/usr/lib/python2.6/site-packages/resource_monitoring</resmonitor.install.dir>
<powermock.version>1.6.2</powermock.version>
<distMgmtSnapshotsId>apache.snapshots.https</distMgmtSnapshotsId>
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json
index acecb62..e41adb5 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json
@@ -142,76 +142,6 @@
"value": "{0} * 100"
}
}
- },
- {
- "name": "point_in_time_metrics_anomalies",
- "label": "Point in Time metric anomalies",
- "description": "This service-level alert if there are metric anomalies in the last 10 mins or configured interval.",
- "interval": 10,
- "scope": "ANY",
- "enabled": true,
- "source": {
- "type": "SCRIPT",
- "path": "AMBARI_METRICS/0.1.0/package/alerts/alert_point_in_time_metric_anomalies.py",
- "parameters": [
- {
- "name": "num_anomalies",
- "display_name": "Value of N in Top 'N' anomalies to be reported.",
- "value": 5,
- "type": "NUMERIC",
- "description": "Report only this amount of anomalies."
- },
- {
- "name": "interval",
- "display_name": "Query Time interval in minutes",
- "value": 10,
- "type": "NUMERIC",
- "description": "Query Time interval in minutes."
- },
- {
- "name": "sensitivity",
- "display_name": "Alert Sensitivity",
- "value": 50,
- "type": "NUMERIC",
- "description": "Sensitivity of the alert. Scale of 1 - 100. Default = 50."
- }
- ]
- }
- },
- {
- "name": "trend_metrics_anomalies",
- "label": "Trend metric anomalies",
- "description": "This service-level alert if there are metric anomalies in the last 10 mins or configured interval.",
- "interval": 10,
- "scope": "ANY",
- "enabled": true,
- "source": {
- "type": "SCRIPT",
- "path": "AMBARI_METRICS/0.1.0/package/alerts/alert_trend_metric_anomalies.py",
- "parameters": [
- {
- "name": "num_anomalies",
- "display_name": "Value of N in Top 'N' anomalies to be reported.",
- "value": 5,
- "type": "NUMERIC",
- "description": "Report only this amount of anomalies."
- },
- {
- "name": "interval",
- "display_name": "Query Time interval in minutes",
- "value": 10,
- "type": "NUMERIC",
- "description": "Query Time interval in minutes."
- },
- {
- "name": "sensitivity",
- "display_name": "Alert Sensitivity",
- "value": 50,
- "type": "NUMERIC",
- "description": "Sensitivity of the alert. Scale of 1 - 100. Default = 50."
- }
- ]
- }
}
],
"METRICS_MONITOR": [
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-config.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-config.xml
deleted file mode 100644
index 9862f10..0000000
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-config.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.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.
- */
--->
-<configuration>
- <property>
- <name>ambari.metrics.admanager.spark.operation.mode</name>
- <value>stand-alone</value>
- <display-name>Anomaly Detection Service operation mode</display-name>
- <description>
- Service Operation modes:
- 1) stand-alone: Standalone Spark cluster for AD jobs
- 2) spark-on-yarn: Spark running on YARN. (Recommended production setting)
- </description>
- <on-ambari-upgrade add="true"/>
- <value-attributes>
- <overridable>false</overridable>
- <type>value-list</type>
- <entries>
- <entry>
- <value>stand-alone</value>
- <label>Stand Alone</label>
- </entry>
- <entry>
- <value>spark-on-yarn</value>
- <label>Spark on YARN</label>
- </entry>
- </entries>
- <selection-cardinality>1</selection-cardinality>
- </value-attributes>
- </property>
- <property>
- <name>ambari.metrics.admanager.application.port</name>
- <value>9090</value>
- <display-name>AD Manager http port</display-name>
- <description>AMS Anomaly Detection Manager application port</description>
- <value-attributes>
- <type>int</type>
- <overridable>false</overridable>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
- <name>ambari.metrics.admanager.input.definition.directory</name>
- <value></value>
- <display-name>AD Manager Input definition directory</display-name>
- <description>AMS Anomaly Detection Manager definition directory</description>
- <value-attributes>
- <type>directory</type>
- <overridable>false</overridable>
- <empty-value-valid>true</empty-value-valid>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
- <name>content</name>
- <display-name>ams-admanager-config template</display-name>
- <value>
- server:
- applicationConnectors:
- - type: http
- port: {{ams_admanager_port}}
- requestLog:
- type: external
-
- logging:
- type: external
-
- metricDefinitionService:
- inputDefinitionDirectory: {{ams_ad_input_definition_directory}}
-
- metricsCollector:
- hosts: {{ams_collector_hosts}}
- port: {{metric_collector_port}}
- protocol: {{metric_collector_protocol}}
- metadataEndpoint: /v1/timeline/metrics/metadata/keys
-
- adQueryService:
- anomalyDataTtl: 604800
-
- metricDefinitionDB:
- # force checksum verification of all data that is read from the file system on behalf of a particular read
- verifyChecksums: true
- # raise an error as soon as it detects an internal corruption
- performParanoidChecks: false
- # Path to Level DB directory
- dbDirPath: {{ams_ad_data_dir}}
-
- spark:
- mode: {{admanager_spark_op_mode}}
- masterHostPort: {{admanager_spark_hostport}}
- </value>
- <value-attributes>
- <type>content</type>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
-</configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-env.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-env.xml
deleted file mode 100644
index 91073ee..0000000
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-admanager-env.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.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.
- */
--->
-<configuration>
- <property>
- <name>ams_ad_log_dir</name>
- <value>/var/log/ambari-metrics-anomaly-detection</value>
- <display-name>Anomaly Detection Manager log dir</display-name>
- <description>AMS Anomaly Detection Manager log directory.</description>
- <value-attributes>
- <type>directory</type>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
- <name>ams_ad_pid_dir</name>
- <value>/var/run/ambari-metrics-anomaly-detection</value>
- <display-name>Anomaly Detection Manager pid dir</display-name>
- <description>AMS Anomaly Detection Manager pid directory.</description>
- <value-attributes>
- <type>directory</type>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
- <name>ams_ad_data_dir</name>
- <value>/var/lib/ambari-metrics-anomaly-detection</value>
- <display-name>Anomaly Detection Manager data dir</display-name>
- <description>AMS Anomaly Detection Manager data directory.</description>
- <value-attributes>
- <type>directory</type>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
- <name>ams_admanager_heapsize</name>
- <value>1024</value>
- <description>Anomaly Detection Manager Heap Size</description>
- <display-name>Anomaly Detection Manager Heap Size</display-name>
- <value-attributes>
- <type>int</type>
- <unit>MB</unit>
- <minimum>512</minimum>
- <maximum>16384</maximum>
- <increment-step>256</increment-step>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
- <name>content</name>
- <display-name>ams-ad-env template</display-name>
- <value>
- # Set environment variables here.
-
- # The java implementation to use. Java 1.8 required.
- export JAVA_HOME={{java64_home}}
-
- # Anomaly Detection Manager Log directory for log4j
- export AMS_AD_LOG_DIR={{ams_ad_log_dir}}
-
- # Anomaly Detection Manager pid directory
- export AMS_AD_PID_DIR={{ams_ad_pid_dir}}
-
- # Anomaly Detection Manager heapsize
- export AMS_AD_HEAPSIZE={{ams_admanager_heapsize}}
-
- # Anomaly Detection Manager data dir
- export AMS_AD_DATA_DIR={{ams_ad_data_dir}}
-
- # Anomaly Detection Manager options
- export AMS_AD_OPTS=$AMS_AD_OPTS
- {% if security_enabled %}
- export AMS_AD_OPTS="$AMS_AD_OPTS -Djava.security.auth.login.config={{ams_ad_jaas_config_file}}"
- {% endif %}
-
- # Anomaly Detection Manager GC options
- export AMS_AD_GC_OPTS="-XX:+UseConcMarkSweepGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:{{ams_ad_log_dir}}/admanager-gc.log-`date +'%Y%m%d%H%M'`"
- export AMS_AD_OPTS="$AMS_AD_OPTS $AMS_AD_GC_OPTS"
-
- # Anomaly Detection Manager data dir
- export AMS_AD_STANDALONE_SPARK_ENABLED={{ams_ad_standalone_spark_enabled}}
- </value>
- <value-attributes>
- <type>content</type>
- </value-attributes>
- <on-ambari-upgrade add="true"/>
- </property>
-
-</configuration>
\ No newline at end of file