Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B5E65200CC3 for ; Fri, 30 Jun 2017 11:46:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B3549160BF9; Fri, 30 Jun 2017 09:46:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DC47D160BEB for ; Fri, 30 Jun 2017 11:46:18 +0200 (CEST) Received: (qmail 28756 invoked by uid 500); 30 Jun 2017 09:46:18 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 28743 invoked by uid 99); 30 Jun 2017 09:46:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jun 2017 09:46:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8E70EE1154; Fri, 30 Jun 2017 09:46:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rlevas@apache.org To: commits@ambari.apache.org Date: Fri, 30 Jun 2017 09:46:18 -0000 Message-Id: <9a5e88f085624ee8b07a92d0f66754e1@git.apache.org> In-Reply-To: <4bc3cc85431b4d9781f5694490c4d387@git.apache.org> References: <4bc3cc85431b4d9781f5694490c4d387@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/33] ambari git commit: AMBARI-21334 Ability to disable Container metrics in AMS (dsen) archived-at: Fri, 30 Jun 2017 09:46:19 -0000 AMBARI-21334 Ability to disable Container metrics in AMS (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6eaabc12 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6eaabc12 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6eaabc12 Branch: refs/heads/branch-feature-AMBARI-20859 Commit: 6eaabc120a2604b3e15c41f77dd88da52b3f6dd0 Parents: a2464b9 Author: Dmytro Sen Authored: Mon Jun 26 19:52:14 2017 +0300 Committer: Dmytro Sen Committed: Mon Jun 26 19:52:14 2017 +0300 ---------------------------------------------------------------------- .../metrics/timeline/HBaseTimelineMetricStore.java | 9 ++++++++- .../metrics/timeline/TimelineMetricConfiguration.java | 11 +++++++++++ .../metrics/timeline/TestTimelineMetricStore.java | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6eaabc12/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java index 12c27a4..ad1fd67 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java @@ -82,6 +82,7 @@ public class HBaseTimelineMetricStore extends AbstractService implements Timelin private TimelineMetricMetadataManager metricMetadataManager; private Integer defaultTopNHostsLimit; private MetricCollectorHAController haController; + private boolean containerMetricsDisabled = false; /** * Construct the service. @@ -188,7 +189,7 @@ public class HBaseTimelineMetricStore extends AbstractService implements Timelin LOG.info("Started watchdog for timeline metrics store with initial " + "delay = " + initDelay + ", delay = " + delay); } - + containerMetricsDisabled = configuration.isContainerMetricsDisabled(); isInitialized = true; } @@ -363,6 +364,12 @@ public class HBaseTimelineMetricStore extends AbstractService implements Timelin @Override public TimelinePutResponse putContainerMetrics(List metrics) throws SQLException, IOException { + + if (containerMetricsDisabled) { + LOG.debug("Ignoring submitted container metrics according to configuration. Values will not be stored."); + return new TimelinePutResponse(); + } + hBaseAccessor.insertContainerMetrics(metrics); return new TimelinePutResponse(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/6eaabc12/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java index 006a403..44073ab 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java @@ -191,6 +191,9 @@ public class TimelineMetricConfiguration { public static final String TIMELINE_SERVICE_RPC_ADDRESS = "timeline.metrics.service.rpc.address"; + public static final String TIMELINE_SERVICE_DISABLE_CONTAINER_METRICS = + "timeline.metrics.service.container.metrics.disabled"; + public static final String CLUSTER_AGGREGATOR_APP_IDS = "timeline.metrics.service.cluster.aggregator.appIds"; @@ -507,4 +510,12 @@ public class TimelineMetricConfiguration { return whitelist; } + + public boolean isContainerMetricsDisabled() { + try { + return metricsConf != null && Boolean.parseBoolean(metricsConf.get(TIMELINE_SERVICE_DISABLE_CONTAINER_METRICS, "false")); + } catch (Exception e) { + return false; + } + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/6eaabc12/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 ac2f9d7..8abcd83 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 @@ -111,4 +111,5 @@ public class TestTimelineMetricStore implements TimelineMetricStore { public List getLiveInstances() { return Collections.emptyList(); } + }