http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css new file mode 100644 index 0000000..271ac74 --- /dev/null +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css @@ -0,0 +1,60 @@ +/** + * 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. +*/ +body { + padding: 40px; + padding-top: 60px; +} +.starter-template { + padding: 40px 15px; + text-align: center; +} + + +.btn { + border: 0 none; + font-weight: 700; + letter-spacing: 1px; + text-transform: uppercase; +} + +.btn:focus, .btn:active:focus, .btn.active:focus { + outline: 0 none; +} + +.table-striped > tbody > tr:nth-child(2n+1).selectedtag > td:hover { + background-color: #3276b1; +} +.table-striped > tbody > tr:nth-child(2n+1).selectedtag > td { + background-color: #3276b1; +} +.tagPanel tr.selectedtag td { + background-color: #3276b1; +} +.top-buffer { margin-top:4px; } + + +.sortorder:after { + content: '\25b2'; // BLACK UP-POINTING TRIANGLE +} +.sortorder.reverse:after { + content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE +} + +.wrap-table{ + word-wrap: break-word; + table-layout: fixed; +}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js new file mode 100644 index 0000000..37cafef --- /dev/null +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.js @@ -0,0 +1,355 @@ +/** + * 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. + */ +(function () { + "use strict"; + + var isIgnoredJmxKeys = function (key) { + return key == 'name' || key == 'modelerType' || key == "$$hashKey" || + key.match(/tag.*/); + }; + angular.module('ozone', ['nvd3', 'ngRoute']); + angular.module('ozone').config(function ($routeProvider) { + $routeProvider + .when("/", { + templateUrl: "main.html" + }) + .when("/metrics/rpc", { + template: "<rpc-metrics></rpc-metrics>" + }) + .when("/config", { + template: "<config></config>" + }) + }); + angular.module('ozone').component('overview', { + templateUrl: 'static/templates/overview.html', + transclude: true, + controller: function ($http) { + var ctrl = this; + $http.get("jmx?qry=Hadoop:service=*,name=*,component=ServerRuntime") + .then(function (result) { + ctrl.jmx = result.data.beans[0] + }) + } + }); + angular.module('ozone').component('jvmParameters', { + templateUrl: 'static/templates/jvm.html', + controller: function ($http) { + var ctrl = this; + $http.get("jmx?qry=java.lang:type=Runtime") + .then(function (result) { + ctrl.jmx = result.data.beans[0]; + + //convert array to a map + var systemProperties = {}; + for (var idx in ctrl.jmx.SystemProperties) { + var item = ctrl.jmx.SystemProperties[idx]; + systemProperties[item.key.replace(/\./g, "_")] = item.value; + } + ctrl.jmx.SystemProperties = systemProperties; + }) + } + }); + + angular.module('ozone').component('rpcMetrics', { + template: '<h1>Rpc metrics</h1><tabs>' + + '<pane ng-repeat="metric in $ctrl.metrics" ' + + 'title="{{metric[\'tag.serverName\']}} ({{metric[\'tag.port\']}})">' + + '<rpc-metric jmxdata="metric"></rpc-metric></pane>' + + '</tabs>', + controller: function ($http) { + var ctrl = this; + $http.get("jmx?qry=Hadoop:service=*,name=RpcActivityForPort*") + .then(function (result) { + ctrl.metrics = result.data.beans; + }) + } + }); + angular.module('ozone').component('rpcMetric', { + bindings: { + jmxdata: '<' + }, + templateUrl: 'static/templates/rpc-metrics.html', + controller: function () { + var ctrl = this; + + + ctrl.percentileGraphOptions = { + chart: { + type: 'discreteBarChart', + height: 450, + margin: { + top: 20, + right: 20, + bottom: 50, + left: 55 + }, + x: function (d) { + return d.label; + }, + y: function (d) { + return d.value; + }, + showValues: true, + valueFormat: function (d) { + return d3.format(',.1f')(d); + }, + duration: 500, + xAxis: { + axisLabel: 'Percentage' + }, + yAxis: { + axisLabel: 'Latency (ms)', + axisLabelDistance: -10 + } + } + }; + + ctrl.$onChanges = function (data) { + var groupedMetrics = {} + + var createPercentageMetrics = function (metricName, window) { + groupedMetrics.percentiles = groupedMetrics['percentiles'] || {} + groupedMetrics.percentiles[window] = groupedMetrics.percentiles[window] || {}; + groupedMetrics.percentiles[window][metricName] = groupedMetrics.percentiles[window][metricName] || { + graphdata: [{ + key: window, + values: [] + }], numOps: 0 + }; + + }; + var metrics = ctrl.jmxdata; + for (var key in metrics) { + var percentile = key.match(/(.*Time)(\d+s)(\d+th)PercentileLatency/); + var percentileNumOps = key.match(/(.*Time)(\d+s)NumOps/); + var successFailures = key.match(/(.*)(Success|Failures)/); + var numAverages = key.match(/(.*Time)(NumOps|AvgTime)/); + if (percentile) { + var metricName = percentile[1]; + var window = percentile[2]; + var percentage = percentile[3] + createPercentageMetrics(metricName, window); + + + groupedMetrics.percentiles[window][metricName].graphdata[0] + .values.push({ + label: percentage, + value: metrics[key] + }) + } else if (successFailures) { + var metricName = successFailures[1]; + groupedMetrics.successfailures = groupedMetrics['successfailures'] || {} + groupedMetrics.successfailures[metricName] = groupedMetrics.successfailures[metricName] || { + success: 0, + failures: 0 + }; + if (successFailures[2] == 'Success') { + groupedMetrics.successfailures[metricName].success = metrics[key]; + } else { + groupedMetrics.successfailures[metricName].failures = metrics[key]; + } + + } else if (numAverages) { + var metricName = numAverages[1]; + groupedMetrics.numavgs = groupedMetrics['numavgs'] || {} + groupedMetrics.numavgs[metricName] = groupedMetrics.numavgs[metricName] || { + numOps: 0, + avgTime: 0 + }; + if (numAverages[2] == 'NumOps') { + groupedMetrics.numavgs[metricName].numOps = metrics[key]; + } else { + groupedMetrics.numavgs[metricName].avgTime = metrics[key]; + } + + } else if (percentileNumOps) { + var metricName = percentileNumOps[1]; + var window = percentileNumOps[2]; + createPercentageMetrics(metricName, window); + groupedMetrics.percentiles[window][metricName].numOps = metrics[key]; + } else if (isIgnoredJmxKeys(key)) { + //ignore + } else { + groupedMetrics.others = groupedMetrics.others || []; + groupedMetrics.others.push({ + 'key': key, + 'value': metrics[key] + }); + } + + } + ctrl.metrics = groupedMetrics; + }; + + } + }); + angular.module('ozone') + .component('tabs', { + transclude: true, + controller: function ($scope) { + var ctrl = this; + var panes = this.panes = []; + this.select = function (pane) { + angular.forEach(panes, function (pane) { + pane.selected = false; + }); + pane.selected = true; + }; + this.addPane = function (pane) { + if (panes.length === 0) { + this.select(pane); + } + panes.push(pane); + }; + this.click = function(pane) { + ctrl.select(pane); + } + }, + template: '<div class="nav navtabs"><div class="row"><ul' + + ' class="nav nav-pills">' + + '<li ng-repeat="pane in $ctrl.panes" ng-class="{active:pane.selected}">' + + '<a href="" ng-click="$ctrl.click(pane)">{{pane.title}}</a> ' + + '</li> </ul></div><br/><div class="tab-content" ng-transclude></div> </div>' + }) + .component('pane', { + transclude: true, + require: { + tabsCtrl: '^tabs' + }, + bindings: { + title: '@' + }, + controller: function () { + this.$onInit = function () { + this.tabsCtrl.addPane(this); + }; + }, + template: '<div class="tab-pane" ng-if="$ctrl.selected" ng-transclude></div>' + }); + + angular.module('ozone').component('navmenu', { + bindings: { + metrics: '<' + }, + templateUrl: 'static/templates/menu.html', + controller: function ($http) { + var ctrl = this; + ctrl.docs = false; + $http.head("docs/index.html") + .then(function (result) { + ctrl.docs = true; + },function(){ + ctrl.docs = false; + }); + } + }); + + angular.module('ozone').component('config', { + templateUrl: 'static/templates/config.html', + controller: function ($scope, $http) { + var ctrl = this; + ctrl.selectedTags = []; + + $http.get("conf?cmd=getOzoneTags&group=ozone") + .then(function (response) { + ctrl.tags = response.data; + + var excludedTags = ['CBLOCK', 'KSM', 'SCM']; + for (var i = 0; i < excludedTags.length; i++) { + var idx = ctrl.tags.indexOf(excludedTags[i]); + // Remove CBLOCK related properties + if (idx > -1) { + ctrl.tags.splice(idx, 1); + } + } + ctrl.loadAll(); + }); + + + + ctrl.loadAll = function () { + console.log("Displaying all configs"); + $http.get("conf?cmd=getPropertyByTag&tags=" + ctrl.tags + "&group=ozone").then(function (response) { + ctrl.configs = response.data; + console.log(ctrl.configs) + for (var idx in ctrl.configs) { + var tags = [] + var parsedTags = ctrl.configs[idx].tag.split(","); + for (var t in parsedTags) { + tags.push(parsedTags[t].trim()) + } + ctrl.configs[idx].tag = tags; + + }; + ctrl.sortBy('name'); + }); + }; + + ctrl.tagFilter = function (value, index, array) { + if (!ctrl.selectedTags) { + return true; + } + var selected = true; + for (var idx in ctrl.selectedTags) { + selected = selected && (value.tag.indexOf(ctrl.selectedTags[idx]) > -1); + } + return selected; + }; + ctrl.configFilter = function (config) { + return false; + }; + ctrl.selected = function (tag) { + return ctrl.selectedTags.includes(tag); + }; + + ctrl.allSelected = function () { + return ctrl.selectedTags.indexOf('SCM') == -1 + && ctrl.selectedTags.indexOf('KSM') == -1 + }; + + ctrl.switchto = function (tag) { + var tags = ctrl.selectedTags.filter(function (item) { + return item != 'KSM' && item != 'SCM'; + }); + if (tag) { + tags.push(tag); + } + ctrl.selectedTags = tags; + }; + + ctrl.select = function (tag) { + var tagIdx = ctrl.selectedTags.indexOf(tag); + if (tagIdx > -1) { + ctrl.selectedTags = ctrl.selectedTags.filter(function (item) { + return item != tag; + }); + } else { + ctrl.selectedTags.push(tag); + } + console.log("Tags selected:" + ctrl.selectedTags); + }; + + ctrl.sortBy = function (propertyName) { + ctrl.reverse = (ctrl.propertyName === propertyName) ? !ctrl.reverse : false; + ctrl.propertyName = propertyName; + }; + + } + }); + +})(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/main/resources/webapps/static/templates/config.html ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/templates/config.html b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/config.html new file mode 100644 index 0000000..7ca0713 --- /dev/null +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/config.html @@ -0,0 +1,91 @@ +<!-- + 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. + --> + +<div class="row top-buffer"> + <div class="col-md-2"> + <input type="text" class="form-control" placeholder="Search Properties" + name="search" ng-model="search.$"> + </div> + <div class="col-md-10"> + <div class="btn-group btn-group-justified"> + <a class="btn" + ng-class="$ctrl.allSelected() ? 'btn-primary' :'btn-secondary'" + ng-click="$ctrl.switchto('')">All + </a> + <a class="btn" + ng-class="$ctrl.selected('KSM') ? 'btn-primary' :'btn-secondary'" + ng-click="$ctrl.switchto('KSM')">KSM</a> + <a class="btn" + ng-class="$ctrl.selected('SCM') ? 'btn-primary' :'btn-secondary'" + ng-click="$ctrl.switchto('SCM')">SCM</a> + </div> + </div> +</div> +<div class="row"> + <div class="col-md-2"> + + <table class="table table-striped table-condensed tagPanel"> + <colgroup> + <col class="col-md-12"> + </colgroup> + <thead> + <tr> + <th>Tag</th> + </tr> + </thead> + <tbody> + <tr ng-click="$ctrl.select(tag)" + ng-class="$ctrl.selected(tag) ? 'selectedtag':''" + ng-repeat="tag in $ctrl.tags"> + <td>{{tag}}</td> + </tr> + </tbody> + </table> + </div> + <div class="col-md-10"> + <table class="table table-striped table-condensed table-hover wrap-table"> + <thead> + <tr> + <th class="col-md-3" > + <a href="#" ng-click="$ctrl.sortBy('name')">Property</a> + <span class="sortorder" ng-show="propertyName === 'name'" + ng-class="{reverse: reverse}"> + + </span> + </th> + <th class="col-md-2" style="word-wrap: break-word;"> + <a ng-click="$ctrl.sortBy('value')">Value</a> + <span class="sortorder" ng-show="propertyName === 'value'" + ng-class="{reverse: reverse}"></span> + </th> + <th class="col-md-7"> + <a href="#" ng-click="$ctrl.sortBy('description')">Description</a> + <span class="sortorder" ng-show="propertyName === 'description'" + ng-class="{reverse: reverse}"></span> + </th> + </tr> + </thead> + <tbody> + <tr ng-repeat="config in $ctrl.configs | filter:$ctrl.tagFilter | filter:search | orderBy:propertyName:reverse"> + <td style="word-wrap: break-word;">{{config.name}}</td> + <td style="word-wrap: break-word;">{{config.value}}</td> + <td style="word-wrap: break-word;">{{config.description}}</td> + </tr> + </tbody> + </table> + </div> +</div> http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/main/resources/webapps/static/templates/jvm.html ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/templates/jvm.html b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/jvm.html new file mode 100644 index 0000000..c1f7d16 --- /dev/null +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/jvm.html @@ -0,0 +1,26 @@ +<!-- + 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. +--> +<table class="table table-bordered table-striped"> + <tr> + <th>JVM:</th> + <td>{{$ctrl.jmx.SystemProperties.java_vm_name}} {{$ctrl.jmx.SystemProperties.java_vm_version}}</td> + </tr> + <tr> + <th>Input arguments:</th> + <td>{{$ctrl.jmx.InputArguments}}</td> + </tr> +</table> http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/main/resources/webapps/static/templates/menu.html ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/templates/menu.html b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/menu.html new file mode 100644 index 0000000..95f1b48 --- /dev/null +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/menu.html @@ -0,0 +1,60 @@ +<!-- + 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. +--> +<div id="navbar" class="collapse navbar-collapse"> + <ul class="nav navbar-nav" id="ui-tabs"> + <li> + <a class="dropdown-toggle" + id="metricsMenu" + data-toggle="dropdown" + aria-haspopup="true" + aria-expanded="true"> + Metrics + <span class="caret"></span> + </a> + <ul + class="dropdown-menu" + aria-labelledby="metricsMenu"> + <li ng-repeat="(name, url) in $ctrl.metrics"> + <a ng-href="{{url}}">{{name}}<span + aria-hidden="true"></span></a></li> + </ul> + </li> + <li><a href="#!/config">Configuration</a></li> + <li ng-show="$ctrl.docs"><a href="/docs">Documentation</a></li> + <li> + <a class="dropdown-toggle" + id="toolsMenu" + data-toggle="dropdown" + aria-haspopup="true" + aria-expanded="true" + > + Common tools + <span class="caret"></span> + </a> + <ul class="dropdown-menu" aria-labelledby="toolsMenu"> + <li><a href="jmx">JMX <span + aria-hidden="true"></span></a></li> + <li><a href="conf">Config <span + aria-hidden="true"></a></li> + <li><a href="stacks">Stacks <span + aria-hidden="true"></a></li> + <li><a href="logLevel">Log levels <span + aria-hidden="true"></a></li> + </ul> + </li> + </ul> +</div><!--/.nav-collapse --> http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/main/resources/webapps/static/templates/overview.html ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/templates/overview.html b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/overview.html new file mode 100644 index 0000000..30e2d26 --- /dev/null +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/overview.html @@ -0,0 +1,39 @@ +<!-- + 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. +--> +<h1>Overview</h1> +<table class="table table-bordered table-striped"> + <tbody> + <tr> + <th>Started:</th> + <td>{{$ctrl.jmx.StartedTimeInMillis | date : 'medium'}}</td> + </tr> + <tr> + <th>Version:</th> + <td>{{$ctrl.jmx.Version}}</td> + </tr> + <tr> + <th>Compiled:</th> + <td>{{$ctrl.jmx.CompileInfo}}</td> + </tr> + </tbody> +</table> + +<h2>JVM parameters</h2> + +<jvm-parameters></jvm-parameters> + +<div ng-transclude></div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/main/resources/webapps/static/templates/rpc-metrics.html ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/templates/rpc-metrics.html b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/rpc-metrics.html new file mode 100644 index 0000000..facb152 --- /dev/null +++ b/hadoop-hdds/framework/src/main/resources/webapps/static/templates/rpc-metrics.html @@ -0,0 +1,87 @@ +<!-- + 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. +--> +<div ng-hide="$ctrl.metrics.percentiles" class="alert alert-info"> + Please set <b>rpc.metrics.quantile.enable</b> to <b>true</b> and define the + intervals in seconds with setting <b>rpc.metrics.percentiles.intervals</b> + (eg. set to <b>60,300</b>) in your hdfs-site.xml + to display Hadoop RPC related graphs. +</div> +<div ng-repeat="(window,windowed) in $ctrl.metrics.percentiles"> + <h2>{{window}} window</h2> + <p>Quantiles based on a fixed {{window}} window. Calculated once at every + {{window}}</p> + + <div class="row"> + <div class="col-md-6 col-lg-4" + ng-repeat="(metric,percentiles) in windowed"> + <h3>{{metric}}</h3> + <p>{{percentiles.numOps}} sample</p> + <nvd3 options="$ctrl.percentileGraphOptions" + data="percentiles.graphdata"></nvd3> + </div> + </div> + +</div> +<div class="row"> + <div ng-show="$ctrl.metrics.numavgs" class="col-md-6"> + <h2>Number of ops / Averages</h2> + + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th>Metric name</th> + <th>Number of ops</th> + <th>Average time (ms)</th> + </tr> + </thead> + <tr ng-repeat="(key,metric) in $ctrl.metrics.numavgs"> + <td>{{key}}</td> + <td>{{metric.numOps | number}}</td> + <td>{{metric.avgTime | number:2}}</td> + </tr> + </table> + </div> + <div ng-show="$ctrl.metrics.successfailures" class="col-md-6"> + <h2>Success / Failures</h2> + + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th>Metric name</th> + <th>Success</th> + <th>Failures</th> + </tr> + </thead> + + <tr ng-repeat="(key,metric) in $ctrl.metrics.successfailures"> + <td>{{key}}</td> + <td>{{metric.success}}</td> + <td>{{metric.failures}}</td> + </tr> + </table> + </div> +</div> +<div ng-show="$ctrl.metrics.others"> + <h2>Other JMX Metrics</h2> + + <table class="table"> + <tr ng-repeat="metric in $ctrl.metrics.others"> + <td>{{metric.key}}</td> + <td>{{metric.value}}</td> + </tr> + </table> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdsl/server/TestBaseHttpServer.java ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdsl/server/TestBaseHttpServer.java b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdsl/server/TestBaseHttpServer.java new file mode 100644 index 0000000..c6eae0e --- /dev/null +++ b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdsl/server/TestBaseHttpServer.java @@ -0,0 +1,98 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hdds.server; + +import org.apache.hadoop.conf.Configuration; +import org.junit.Assert; +import org.junit.Test; + +/** + * Test Common ozone/hdds web methods. + */ +public class TestBaseHttpServer { + @Test + public void getBindAddress() throws Exception { + Configuration conf = new Configuration(); + conf.set("enabled", "false"); + + BaseHttpServer baseHttpServer = new BaseHttpServer(conf, "test") { + @Override + protected String getHttpAddressKey() { + return null; + } + + @Override + protected String getHttpsAddressKey() { + return null; + } + + @Override + protected String getHttpBindHostKey() { + return null; + } + + @Override + protected String getHttpsBindHostKey() { + return null; + } + + @Override + protected String getBindHostDefault() { + return null; + } + + @Override + protected int getHttpBindPortDefault() { + return 0; + } + + @Override + protected int getHttpsBindPortDefault() { + return 0; + } + + @Override + protected String getKeytabFile() { + return null; + } + + @Override + protected String getSpnegoPrincipal() { + return null; + } + + @Override + protected String getEnabledKey() { + return "enabled"; + } + }; + + conf.set("addresskey", "0.0.0.0:1234"); + + Assert.assertEquals("/0.0.0.0:1234", baseHttpServer + .getBindAddress("bindhostkey", "addresskey", + "default", 65).toString()); + + conf.set("bindhostkey", "1.2.3.4"); + + Assert.assertEquals("/1.2.3.4:1234", baseHttpServer + .getBindAddress("bindhostkey", "addresskey", + "default", 65).toString()); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/framework/src/test/resources/ozone-site.xml ---------------------------------------------------------------------- diff --git a/hadoop-hdds/framework/src/test/resources/ozone-site.xml b/hadoop-hdds/framework/src/test/resources/ozone-site.xml new file mode 100644 index 0000000..77dd7ef --- /dev/null +++ b/hadoop-hdds/framework/src/test/resources/ozone-site.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> +<!-- + 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. +--> + +<!-- Put site-specific property overrides in this file. --> + +<configuration> + +</configuration> http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-hdds/pom.xml b/hadoop-hdds/pom.xml new file mode 100644 index 0000000..01b696c --- /dev/null +++ b/hadoop-hdds/pom.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed 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. See accompanying LICENSE file. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 +http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-project-dist</artifactId> + <version>3.2.0-SNAPSHOT</version> + <relativePath>../hadoop-project-dist</relativePath> + </parent> + + <artifactId>hadoop-hdds</artifactId> + <version>3.2.0-SNAPSHOT</version> + <description>Apache Hadoop Distributed Data Store Parent project</description> + <name>Apache Hdds</name> + <packaging>pom</packaging> + + <modules> + <module>client</module> + <module>common</module> + <module>framework</module> + <module>container-service</module> + <module>server-scm</module> + <module>tools</module> + + </modules> + + <dependencies> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-common</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdfs</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdfs-client</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-common</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdfs</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <configuration> + <excludeFilterFile combine.self="override"></excludeFilterFile> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/server-scm/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-hdds/server-scm/pom.xml b/hadoop-hdds/server-scm/pom.xml new file mode 100644 index 0000000..35975f4 --- /dev/null +++ b/hadoop-hdds/server-scm/pom.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed 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. See accompanying LICENSE file. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 +http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdds</artifactId> + <version>3.2.0-SNAPSHOT</version> + </parent> + <artifactId>hadoop-hdds-server-scm</artifactId> + <version>3.2.0-SNAPSHOT</version> + <description>Apache HDDS SCM server</description> + <name>Apache Hadoop HDDS SCM server</name> + <packaging>jar</packaging> + + <properties> + <hadoop.component>hdds</hadoop.component> + <is.hadoop.component>true</is.hadoop.component> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdds-common</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdds-container-service</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdds-client</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdds-server-framework</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdds-container-service</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-core</artifactId> + <version>1.3</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.dropwizard.metrics</groupId> + <artifactId>metrics-core</artifactId> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-generator-annprocess</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-all</artifactId> + <version>1.3</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>copy web resources</id> + <phase>compile</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <target> + <copy toDir="${project.build.directory}/webapps"> + <fileset dir="${basedir}/src/main/webapps"> + <exclude name="**/proto-web.xml"/> + </fileset> + </copy> + </target> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-common-html</id> + <phase>prepare-package</phase> + <goals> + <goal>unpack</goal> + </goals> + </execution> + </executions> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-hdds-server-framework</artifactId> + <outputDirectory>${project.build.directory}/</outputDirectory> + <includes>webapps/static/**/*.*</includes> + </artifactItem> + </artifactItems> + <overWriteSnapshots>true</overWriteSnapshots> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMMXBean.java ---------------------------------------------------------------------- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMMXBean.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMMXBean.java new file mode 100644 index 0000000..17b6814 --- /dev/null +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMMXBean.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hdds.scm; + +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.hdds.server.ServiceRuntimeInfo; + +import java.util.Map; + +/** + * + * This is the JMX management interface for scm information. + */ [email protected] +public interface SCMMXBean extends ServiceRuntimeInfo { + + /** + * Get the SCM RPC server port that used to listen to datanode requests. + * @return SCM datanode RPC server port + */ + String getDatanodeRpcPort(); + + /** + * Get the SCM RPC server port that used to listen to client requests. + * @return SCM client RPC server port + */ + String getClientRpcPort(); + + /** + * Get container report info that includes container IO stats of nodes. + * @return The datanodeUUid to report json string mapping + */ + Map<String, String> getContainerReport(); +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/651a05a1/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMStorage.java ---------------------------------------------------------------------- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMStorage.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMStorage.java new file mode 100644 index 0000000..27e9363 --- /dev/null +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMStorage.java @@ -0,0 +1,73 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hdds.scm; + +import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType; +import org.apache.hadoop.ozone.common.Storage; + +import java.io.IOException; +import java.util.Properties; +import java.util.UUID; + +import static org.apache.hadoop.hdds.server.ServerUtils.getOzoneMetaDirPath; +import static org.apache.hadoop.ozone.OzoneConsts.SCM_ID; +import static org.apache.hadoop.ozone.OzoneConsts.STORAGE_DIR; + +/** + * SCMStorage is responsible for management of the StorageDirectories used by + * the SCM. + */ +public class SCMStorage extends Storage { + + /** + * Construct SCMStorage. + * @throws IOException if any directories are inaccessible. + */ + public SCMStorage(OzoneConfiguration conf) throws IOException { + super(NodeType.SCM, getOzoneMetaDirPath(conf), STORAGE_DIR); + } + + public void setScmId(String scmId) throws IOException { + if (getState() == StorageState.INITIALIZED) { + throw new IOException("SCM is already initialized."); + } else { + getStorageInfo().setProperty(SCM_ID, scmId); + } + } + + /** + * Retrieves the SCM ID from the version file. + * @return SCM_ID + */ + public String getScmId() { + return getStorageInfo().getProperty(SCM_ID); + } + + @Override + protected Properties getNodeProperties() { + String scmId = getScmId(); + if (scmId == null) { + scmId = UUID.randomUUID().toString(); + } + Properties scmProperties = new Properties(); + scmProperties.setProperty(SCM_ID, scmId); + return scmProperties; + } + +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
