ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-11114. Verify metrics for HDFS, YARN, HBASE are supported. (jaimin)
Date Sun, 17 May 2015 20:29:55 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 421770b27 -> 6b873569d


AMBARI-11114. Verify metrics for HDFS, YARN, HBASE are supported. (jaimin)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6b873569
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6b873569
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6b873569

Branch: refs/heads/trunk
Commit: 6b873569d1808c5aca7f60ab3aac913e3b50960a
Parents: 421770b
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Sun May 17 13:29:26 2015 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Sun May 17 13:29:26 2015 -0700

----------------------------------------------------------------------
 .../HBASE/0.96.0.2.0/metrics.json               | 100 +++++++++++++++
 .../common-services/HDFS/2.1.0.2.0/metrics.json | 127 ++++++++-----------
 .../YARN/2.1.0.2.0/YARN_metrics.json            |  40 ++++++
 .../ambari/server/stack/StackManagerTest.java   |  46 +++++++
 4 files changed, 242 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6b873569/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
index 8d08d9b..efaca33 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
@@ -1379,6 +1379,56 @@
               "pointInTime": true,
               "temporal": false
             },
+            "metrics/hbase/regionserver/ScanNext_num_ops": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.ScanNext_num_ops",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Increment_num_ops": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Increment_num_ops",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Append_num_ops": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Append_num_ops",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/ScanNext_95th_percentile": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.ScanNext_95th_percentile",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Append_95th_percentile": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Append_95th_percentile",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Increment_95th_percentile": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Increment_95th_percentile",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/updatesBlockedTime": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.updatesBlockedTime",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/IPC/numActiveHandler": {
+              "metric": "Hadoop:service=HBase,name=IPC,sub=IPC.numActiveHandler",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/IPC/numCallsInGeneralQueue": {
+              "metric": "Hadoop:service=HBase,name=IPC,sub=IPC.numCallsInGeneralQueue",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/IPC/numOpenConnections": {
+              "metric": "Hadoop:service=HBase,name=IPC,sub=IPC.numOpenConnections",
+              "pointInTime": true,
+              "temporal": false
+            },
             "metrics/hbase/regionserver/slowAppendCount": {
               "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.slowAppendCount",
               "pointInTime": true,
@@ -3023,6 +3073,56 @@
               "pointInTime": true,
               "temporal": false
             },
+            "metrics/hbase/regionserver/ScanNext_num_ops": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.ScanNext_num_ops",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Increment_num_ops": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Increment_num_ops",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Append_num_ops": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Append_num_ops",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/ScanNext_95th_percentile": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.ScanNext_95th_percentile",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Append_95th_percentile": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Append_95th_percentile",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/Increment_95th_percentile": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.Increment_95th_percentile",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/regionserver/updatesBlockedTime": {
+              "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.updatesBlockedTime",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/IPC/numActiveHandler": {
+              "metric": "Hadoop:service=HBase,name=IPC,sub=IPC.numActiveHandler",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/IPC/numCallsInGeneralQueue": {
+              "metric": "Hadoop:service=HBase,name=IPC,sub=IPC.numCallsInGeneralQueue",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/hbase/IPC/numOpenConnections": {
+              "metric": "Hadoop:service=HBase,name=IPC,sub=IPC.numOpenConnections",
+              "pointInTime": true,
+              "temporal": false
+            },
             "metrics/hbase/regionserver/slowAppendCount": {
               "metric": "Hadoop:service=HBase,name=RegionServer,sub=Server.slowAppendCount",
               "pointInTime": true,

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b873569/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metrics.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metrics.json
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metrics.json
index 19ba890..d155e7e 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metrics.json
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metrics.json
@@ -1156,7 +1156,7 @@
               "temporal": false
             },
             "metrics/rpc/NumOpenConnections": {
-              "metric": "Hadoop:service=NameNode,name=RpcActivity.NumOpenConnections",
+              "metric": "Hadoop:service=NameNode,name=RpcActivityForPort8020.NumOpenConnections",
               "pointInTime": true,
               "temporal": false
             },
@@ -1355,6 +1355,31 @@
               "metric": "Hadoop:service=NameNode,name=FSNamesystem.CapacityNonDFSUsed",
               "pointInTime": true,
               "temporal": false
+            },
+            "metrics/jvm/GcTimeMillisConcurrentMarkSweep": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcTimeMillisConcurrentMarkSweep",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/GcCountConcurrentMarkSweep": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcCountConcurrentMarkSweep",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/rpc/RpcQueueTimeAvgTime": {
+              "metric": "Hadoop:service=NameNode,name=RpcActivityForPort8020.RpcQueueTimeAvgTime",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/rpc/RpcProcessingTimeAvgTime": {
+              "metric": "Hadoop:service=NameNode,name=RpcActivityForPort8020.RpcProcessingTimeAvgTime",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/namenode/CorruptFiles": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.CorruptFiles",
+              "pointInTime": true,
+              "temporal": false
             }
           }
         }
@@ -2430,7 +2455,7 @@
               "temporal": false
             },
             "metrics/rpc/RpcProcessingTime_avg_time": {
-              "metric": "Hadoop:service=NameNode,name=RpcActivity.RpcProcessingTimeAvgTime",
+              "metric": "Hadoop:service=NameNode,name=RpcActivityForPort8020.RpcProcessingTimeAvgTime",
               "pointInTime": true,
               "temporal": false
             },
@@ -2515,7 +2540,7 @@
               "temporal": false
             },
             "metrics/rpc/RpcQueueTime_avg_time": {
-              "metric": "Hadoop:service=NameNode,name=RpcActivity.RpcQueueTimeAvgTime",
+              "metric": "Hadoop:service=NameNode,name=RpcActivityForPort8020.RpcQueueTimeAvgTime",
               "pointInTime": true,
               "temporal": false
             },
@@ -2585,7 +2610,7 @@
               "temporal": false
             },
             "metrics/rpc/NumOpenConnections": {
-              "metric": "Hadoop:service=NameNode,name=RpcActivity.NumOpenConnections",
+              "metric": "Hadoop:service=NameNode,name=RpcActivityForPort8020.NumOpenConnections",
               "pointInTime": true,
               "temporal": false
             },
@@ -2769,6 +2794,21 @@
               "metric": "Hadoop:service=NameNode,name=NameNodeInfo.TotalBlocks",
               "pointInTime": true,
               "temporal": false
+            },
+            "metrics/jvm/GcTimeMillisConcurrentMarkSweep": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcTimeMillisConcurrentMarkSweep",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/GcCountConcurrentMarkSweep": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcCountConcurrentMarkSweep",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/namenode/CorruptFiles": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.CorruptFiles",
+              "pointInTime": true,
+              "temporal": false
             }
           }
         }
@@ -6107,11 +6147,6 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/TotalLoad": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.TotalLoad",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/jvm/memHeapCommittedM": {
               "metric": "Hadoop:service=DataNode,name=JvmMetrics.MemHeapCommittedM",
               "pointInTime": true,
@@ -6122,11 +6157,6 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/BlockCapacity": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.BlockCapacity",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/jvm/threadsRunnable": {
               "metric": "Hadoop:service=DataNode,name=JvmMetrics.ThreadsRunnable",
               "pointInTime": true,
@@ -6202,11 +6232,6 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/FilesTotal": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.FilesTotal",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/jvm/memNonHeapUsedM": {
               "metric": "Hadoop:service=DataNode,name=JvmMetrics.MemNonHeapUsedM",
               "unit": "MB",
@@ -6228,16 +6253,6 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/CapacityTotalGB": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.CapacityTotalGB",
-              "pointInTime": true,
-              "temporal": false
-            },
-            "metrics/dfs/FSNamesystem/ExcessBlocks": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.ExcessBlocks",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/rpcdetailed/getBlockLocations_num_ops": {
               "metric": "Hadoop:service=DataNode,name=RpcDetailedActivity.getBlockLocations_num_ops",
               "pointInTime": true,
@@ -6258,11 +6273,6 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/CapacityUsedGB": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.CapacityUsedGB",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/rpc/ReceivedBytes": {
               "metric": "Hadoop:service=DataNode,name=RpcActivity.ReceivedBytes",
               "pointInTime": true,
@@ -6314,21 +6324,11 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/ScheduledReplicationBlocks": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.ScheduledReplicationBlocks",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/jvm/threadsWaiting": {
               "metric": "Hadoop:service=DataNode,name=JvmMetrics.ThreadsWaiting",
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/BlocksTotal": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.BlocksTotal",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/ugi/loginSuccess_num_ops": {
               "metric": "Hadoop:service=NameNode,name=UgiMetrics.LoginSuccessNumOps",
               "pointInTime": true,
@@ -6369,16 +6369,6 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/CapacityRemainingGB": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.CapacityRemainingGB",
-              "pointInTime": true,
-              "temporal": false
-            },
-            "metrics/dfs/FSNamesystem/MissingBlocks": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.MissingBlocks",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/jvm/memNonHeapCommittedM": {
               "metric": "Hadoop:service=DataNode,name=JvmMetrics.MemNonHeapCommittedM",
               "pointInTime": true,
@@ -6389,11 +6379,6 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/CorruptBlocks": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.CorruptBlocks",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/dfs/FSNamesystem/Version": {
               "metric": "Hadoop:service=DataNode,name=DataNodeInfo.Version",
               "pointInTime": true,
@@ -6444,21 +6429,11 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/UnderReplicatedBlocks": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.UnderReplicatedBlocks",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/jvm/NonHeapMemoryMax": {
               "metric": "java.lang:type=Memory.NonHeapMemoryUsage[max]",
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/PendingReplicationBlocks": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.PendingReplicationBlocks",
-              "pointInTime": true,
-              "temporal": false
-            },
             "metrics/rpcdetailed/create_avg_time": {
               "metric": "Hadoop:service=DataNode,name=RpcDetailedActivity.create_avg_time",
               "pointInTime": true,
@@ -6529,8 +6504,18 @@
               "pointInTime": true,
               "temporal": false
             },
-            "metrics/dfs/FSNamesystem/PendingDeletionBlocks": {
-              "metric": "Hadoop:service=DataNode,name=DataNode.PendingDeletionBlocks",
+            "metrics/dfs/FSDatasetState/DfsUsed": {
+              "metric": "Hadoop:service=DataNode,name=FSDatasetState.DfsUsed",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSDatasetState/Capacity": {
+              "metric": "Hadoop:service=DataNode,name=FSDatasetState.Capacity",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSDatasetState/NumFailedVolumes": {
+              "metric": "Hadoop:service=DataNode,name=FSDatasetState.NumFailedVolumes",
               "pointInTime": true,
               "temporal": false
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b873569/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/YARN_metrics.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/YARN_metrics.json
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/YARN_metrics.json
index 15f2026..c856141 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/YARN_metrics.json
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/YARN_metrics.json
@@ -1061,6 +1061,46 @@
               "metric": "Hadoop:service=NodeManager,name=JvmMetrics.ThreadsTerminated",
               "pointInTime": true,
               "temporal": false
+            },
+            "metrics/nodemanager/GoodLocalDirsDiskUtilizationPerc": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.GoodLocalDirsDiskUtilizationPerc",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/nodemanager/GoodLogDirsDiskUtilizationPerc": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.GoodLogDirsDiskUtilizationPerc",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/nodemanager/AllocatedGB": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.AllocatedGB",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/nodemanager/AllocatedVCores": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.AllocatedVCores",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/nodemanager/BadLocalDirs": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.BadLocalDirs",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/nodemanager/BadLogDirs": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.BadLogDirs",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/nodemanager/ContainersFailed": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.ContainersFailed",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/nodemanager/AllocatedContainers": {
+              "metric": "Hadoop:service=NodeManager,name=NodeManagerMetrics.AllocatedContainers",
+              "pointInTime": true,
+              "temporal": false
             }
           }
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b873569/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
index 4fbd736..1e76b6b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
@@ -29,6 +29,8 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
+import java.io.FileReader;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -36,6 +38,9 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.metadata.ActionMetadata;
 import org.apache.ambari.server.orm.dao.MetainfoDAO;
@@ -47,6 +52,7 @@ import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.ServiceOsSpecific;
 import org.apache.ambari.server.state.StackInfo;
+import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.commons.lang.StringUtils;
 import org.junit.BeforeClass;
@@ -610,5 +616,45 @@ public class StackManagerTest {
         stack.getKerberosDescriptorFileLocation());
   }
 
+  @Test
+  public void testMetricsLoaded() throws Exception {
+
+    String stackRoot = ClassLoader.getSystemClassLoader().getResource("stacks").getPath().replace("test-classes","classes");
+    String commonServices = ClassLoader.getSystemClassLoader().getResource("common-services").getPath().replace("test-classes","classes");
+
+    MetainfoDAO metaInfoDao = createNiceMock(MetainfoDAO.class);
+    StackDAO stackDao = createNiceMock(StackDAO.class);
+    ActionMetadata actionMetadata = createNiceMock(ActionMetadata.class);
+    Configuration config = createNiceMock(Configuration.class);
+
+    expect(config.getSharedResourcesDirPath()).andReturn(
+            ClassLoader.getSystemClassLoader().getResource("").getPath()).anyTimes();
+
+    replay(config, metaInfoDao, stackDao, actionMetadata);
+
+    OsFamily osFamily = new OsFamily(config);
+
+    StackManager stackManager = new StackManager(new File(stackRoot), new File(commonServices),
+            osFamily, metaInfoDao, actionMetadata, stackDao);
+
+    for (StackInfo stackInfo : stackManager.getStacks()) {
+      for (ServiceInfo serviceInfo : stackInfo.getServices()) {
+        Type type = new TypeToken<Map<String, Map<String, List<MetricDefinition>>>>()
{
+        }.getType();
+
+        Gson gson = new Gson();
+        Map<String, Map<String, List<MetricDefinition>>> map = null;
+        if (serviceInfo.getMetricsFile() != null) {
+          try {
+            map = gson.fromJson(new FileReader(serviceInfo.getMetricsFile()), type);
+          } catch (Exception e) {
+            e.printStackTrace();
+            throw new AmbariException("Failed to load metrics from file " + serviceInfo.getMetricsFile().getAbsolutePath());
+          }
+        }
+      }
+    }
+  }
+
   //todo: component override assertions
 }


Mime
View raw message