http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSController.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSController.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSController.java new file mode 100644 index 0000000..4e00bc8 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSController.java @@ -0,0 +1,55 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import org.apache.hadoop.yarn.webapp.Controller; + +import com.google.inject.Inject; + +public class AHSController extends Controller { + + @Inject + AHSController(RequestContext ctx) { + super(ctx); + } + + @Override + public void index() { + setTitle("Application History"); + } + + public void app() { + render(AppPage.class); + } + + public void appattempt() { + render(AppAttemptPage.class); + } + + public void container() { + render(ContainerPage.class); + } + + /** + * Render the logs page. + */ + public void logs() { + render(AHSLogsPage.class); + } +}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSLogsPage.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSLogsPage.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSLogsPage.java new file mode 100644 index 0000000..8821bc0 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSLogsPage.java @@ -0,0 +1,55 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import static org.apache.hadoop.yarn.webapp.YarnWebParams.CONTAINER_ID; +import static org.apache.hadoop.yarn.webapp.YarnWebParams.ENTITY_STRING; + +import org.apache.hadoop.yarn.webapp.SubView; +import org.apache.hadoop.yarn.webapp.log.AggregatedLogsBlock; + +public class AHSLogsPage extends AHSView { + /* + * (non-Javadoc) + * + * @see + * org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.AHSView# + * preHead(org.apache.hadoop .yarn.webapp.hamlet.Hamlet.HTML) + */ + @Override + protected void preHead(Page.HTML<_> html) { + String logEntity = $(ENTITY_STRING); + if (logEntity == null || logEntity.isEmpty()) { + logEntity = $(CONTAINER_ID); + } + if (logEntity == null || logEntity.isEmpty()) { + logEntity = "UNKNOWN"; + } + commonPreHead(html); + } + + /** + * The content of this page is the AggregatedLogsBlock + * + * @return AggregatedLogsBlock.class + */ + @Override + protected Class<? extends SubView> content() { + return AggregatedLogsBlock.class; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java new file mode 100644 index 0000000..4baa75d --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java @@ -0,0 +1,90 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import static org.apache.hadoop.yarn.util.StringHelper.sjoin; +import static org.apache.hadoop.yarn.webapp.YarnWebParams.APP_STATE; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION_ID; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit; + +import org.apache.hadoop.yarn.server.webapp.AppsBlock; +import org.apache.hadoop.yarn.webapp.SubView; +import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout; + +// Do NOT rename/refactor this to AHSView as it will wreak havoc +// on Mac OS HFS +public class AHSView extends TwoColumnLayout { + static final int MAX_DISPLAY_ROWS = 100; // direct table rendering + static final int MAX_FAST_ROWS = 1000; // inline js array + + @Override + protected void preHead(Page.HTML<_> html) { + commonPreHead(html); + set(DATATABLES_ID, "apps"); + set(initID(DATATABLES, "apps"), appsTableInit()); + setTableStyles(html, "apps", ".queue {width:6em}", ".ui {width:8em}"); + + // Set the correct title. + String reqState = $(APP_STATE); + reqState = (reqState == null || reqState.isEmpty() ? "All" : reqState); + setTitle(sjoin(reqState, "Applications")); + } + + protected void commonPreHead(Page.HTML<_> html) { + set(ACCORDION_ID, "nav"); + set(initID(ACCORDION, "nav"), "{autoHeight:false, active:0}"); + } + + @Override + protected Class<? extends SubView> nav() { + return NavBlock.class; + } + + @Override + protected Class<? extends SubView> content() { + return AppsBlock.class; + } + + private String appsTableInit() { + // id, user, name, queue, starttime, finishtime, state, status, progress, ui + return tableInit().append(", 'aaData': appsTableData") + .append(", bDeferRender: true").append(", bProcessing: true") + + .append("\n, aoColumnDefs: ").append(getAppsTableColumnDefs()) + + // Sort by id upon page load + .append(", aaSorting: [[0, 'desc']]}").toString(); + } + + protected String getAppsTableColumnDefs() { + StringBuilder sb = new StringBuilder(); + return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]") + .append(", 'mRender': parseHadoopID }") + + .append("\n, {'sType':'numeric', 'aTargets': [5, 6]") + .append(", 'mRender': renderHadoopDate }") + + .append("\n, {'sType':'numeric', bSearchable:false, 'aTargets': [9]") + .append(", 'mRender': parseHadoopProgress }]").toString(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java new file mode 100644 index 0000000..8cff741 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java @@ -0,0 +1,63 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import static org.apache.hadoop.yarn.util.StringHelper.pajoin; + +import org.apache.hadoop.yarn.server.api.ApplicationContext; +import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManager; +import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricStore; +import org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.TimelineStore; +import org.apache.hadoop.yarn.webapp.GenericExceptionHandler; +import org.apache.hadoop.yarn.webapp.WebApp; +import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider; +import org.apache.hadoop.yarn.webapp.YarnWebParams; + +public class AHSWebApp extends WebApp implements YarnWebParams { + + private final ApplicationHistoryManager applicationHistoryManager; + private final TimelineStore timelineStore; + private final TimelineMetricStore timelineMetricStore; + + public AHSWebApp(ApplicationHistoryManager applicationHistoryManager, + TimelineStore timelineStore, TimelineMetricStore timelineMetricStore) { + this.applicationHistoryManager = applicationHistoryManager; + this.timelineStore = timelineStore; + this.timelineMetricStore = timelineMetricStore; + } + + @Override + public void setup() { + bind(YarnJacksonJaxbJsonProvider.class); + bind(AHSWebServices.class); + bind(TimelineWebServices.class); + bind(GenericExceptionHandler.class); + bind(ApplicationContext.class).toInstance(applicationHistoryManager); + bind(TimelineStore.class).toInstance(timelineStore); + bind(TimelineMetricStore.class).toInstance(timelineMetricStore); + route("/", AHSController.class); + route(pajoin("/apps", APP_STATE), AHSController.class); + route(pajoin("/app", APPLICATION_ID), AHSController.class, "app"); + route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), AHSController.class, + "appattempt"); + route(pajoin("/container", CONTAINER_ID), AHSController.class, "container"); + route( + pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER, + CONTAINER_LOG_TYPE), AHSController.class, "logs"); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java new file mode 100644 index 0000000..2040f57 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java @@ -0,0 +1,162 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import java.util.Collections; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; + +import org.apache.hadoop.yarn.api.records.YarnApplicationState; +import org.apache.hadoop.yarn.server.api.ApplicationContext; +import org.apache.hadoop.yarn.server.webapp.WebServices; +import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; +import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo; +import org.apache.hadoop.yarn.server.webapp.dao.AppInfo; +import org.apache.hadoop.yarn.server.webapp.dao.AppsInfo; +import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; +import org.apache.hadoop.yarn.server.webapp.dao.ContainersInfo; +import org.apache.hadoop.yarn.webapp.BadRequestException; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +@Singleton +@Path("/ws/v1/applicationhistory") +public class AHSWebServices extends WebServices { + + @Inject + public AHSWebServices(ApplicationContext appContext) { + super(appContext); + } + + @GET + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public AppsInfo get(@Context HttpServletRequest req, + @Context HttpServletResponse res) { + return getApps(req, res, null, Collections.<String> emptySet(), null, null, + null, null, null, null, null, null, Collections.<String> emptySet()); + } + + @GET + @Path("/apps") + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + @Override + public AppsInfo getApps(@Context HttpServletRequest req, + @Context HttpServletResponse res, @QueryParam("state") String stateQuery, + @QueryParam("states") Set<String> statesQuery, + @QueryParam("finalStatus") String finalStatusQuery, + @QueryParam("user") String userQuery, + @QueryParam("queue") String queueQuery, + @QueryParam("limit") String count, + @QueryParam("startedTimeBegin") String startedBegin, + @QueryParam("startedTimeEnd") String startedEnd, + @QueryParam("finishedTimeBegin") String finishBegin, + @QueryParam("finishedTimeEnd") String finishEnd, + @QueryParam("applicationTypes") Set<String> applicationTypes) { + init(res); + validateStates(stateQuery, statesQuery); + return super.getApps(req, res, stateQuery, statesQuery, finalStatusQuery, + userQuery, queueQuery, count, startedBegin, startedEnd, finishBegin, + finishEnd, applicationTypes); + } + + @GET + @Path("/apps/{appid}") + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + @Override + public AppInfo getApp(@Context HttpServletRequest req, + @Context HttpServletResponse res, @PathParam("appid") String appId) { + init(res); + return super.getApp(req, res, appId); + } + + @GET + @Path("/apps/{appid}/appattempts") + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + @Override + public AppAttemptsInfo getAppAttempts(@Context HttpServletRequest req, + @Context HttpServletResponse res, @PathParam("appid") String appId) { + init(res); + return super.getAppAttempts(req, res, appId); + } + + @GET + @Path("/apps/{appid}/appattempts/{appattemptid}") + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + @Override + public AppAttemptInfo getAppAttempt(@Context HttpServletRequest req, + @Context HttpServletResponse res, @PathParam("appid") String appId, + @PathParam("appattemptid") String appAttemptId) { + init(res); + return super.getAppAttempt(req, res, appId, appAttemptId); + } + + @GET + @Path("/apps/{appid}/appattempts/{appattemptid}/containers") + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + @Override + public ContainersInfo getContainers(@Context HttpServletRequest req, + @Context HttpServletResponse res, @PathParam("appid") String appId, + @PathParam("appattemptid") String appAttemptId) { + init(res); + return super.getContainers(req, res, appId, appAttemptId); + } + + @GET + @Path("/apps/{appid}/appattempts/{appattemptid}/containers/{containerid}") + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + @Override + public ContainerInfo getContainer(@Context HttpServletRequest req, + @Context HttpServletResponse res, @PathParam("appid") String appId, + @PathParam("appattemptid") String appAttemptId, + @PathParam("containerid") String containerId) { + init(res); + return super.getContainer(req, res, appId, appAttemptId, containerId); + } + + private static void + validateStates(String stateQuery, Set<String> statesQuery) { + // stateQuery is deprecated. + if (stateQuery != null && !stateQuery.isEmpty()) { + statesQuery.add(stateQuery); + } + Set<String> appStates = parseQueries(statesQuery, true); + for (String appState : appStates) { + switch (YarnApplicationState.valueOf(appState.toUpperCase())) { + case FINISHED: + case FAILED: + case KILLED: + continue; + default: + throw new BadRequestException("Invalid application-state " + appState + + " specified. It should be a final state"); + } + } + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java new file mode 100644 index 0000000..63b44bd --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java @@ -0,0 +1,69 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import static org.apache.hadoop.yarn.util.StringHelper.join; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit; + +import org.apache.hadoop.yarn.server.webapp.AppAttemptBlock; +import org.apache.hadoop.yarn.webapp.SubView; +import org.apache.hadoop.yarn.webapp.YarnWebParams; + +public class AppAttemptPage extends AHSView { + + @Override + protected void preHead(Page.HTML<_> html) { + commonPreHead(html); + + String appAttemptId = $(YarnWebParams.APPLICATION_ATTEMPT_ID); + set( + TITLE, + appAttemptId.isEmpty() ? "Bad request: missing application attempt ID" + : join("Application Attempt ", + $(YarnWebParams.APPLICATION_ATTEMPT_ID))); + + set(DATATABLES_ID, "containers"); + set(initID(DATATABLES, "containers"), containersTableInit()); + setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}"); + } + + @Override + protected Class<? extends SubView> content() { + return AppAttemptBlock.class; + } + + private String containersTableInit() { + return tableInit().append(", 'aaData': containersTableData") + .append(", bDeferRender: true").append(", bProcessing: true") + + .append("\n, aoColumnDefs: ").append(getContainersTableColumnDefs()) + + // Sort by id upon page load + .append(", aaSorting: [[0, 'desc']]}").toString(); + } + + protected String getContainersTableColumnDefs() { + StringBuilder sb = new StringBuilder(); + return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]") + .append(", 'mRender': parseHadoopID }]").toString(); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java new file mode 100644 index 0000000..96ca659 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java @@ -0,0 +1,71 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import static org.apache.hadoop.yarn.util.StringHelper.join; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit; + +import org.apache.hadoop.yarn.server.webapp.AppBlock; +import org.apache.hadoop.yarn.webapp.SubView; +import org.apache.hadoop.yarn.webapp.YarnWebParams; + +public class AppPage extends AHSView { + + @Override + protected void preHead(Page.HTML<_> html) { + commonPreHead(html); + + String appId = $(YarnWebParams.APPLICATION_ID); + set( + TITLE, + appId.isEmpty() ? "Bad request: missing application ID" : join( + "Application ", $(YarnWebParams.APPLICATION_ID))); + + set(DATATABLES_ID, "attempts"); + set(initID(DATATABLES, "attempts"), attemptsTableInit()); + setTableStyles(html, "attempts", ".queue {width:6em}", ".ui {width:8em}"); + } + + @Override + protected Class<? extends SubView> content() { + return AppBlock.class; + } + + private String attemptsTableInit() { + return tableInit().append(", 'aaData': attemptsTableData") + .append(", bDeferRender: true").append(", bProcessing: true") + + .append("\n, aoColumnDefs: ").append(getAttemptsTableColumnDefs()) + + // Sort by id upon page load + .append(", aaSorting: [[0, 'desc']]}").toString(); + } + + protected String getAttemptsTableColumnDefs() { + StringBuilder sb = new StringBuilder(); + return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]") + .append(", 'mRender': parseHadoopID }") + + .append("\n, {'sType':'numeric', 'aTargets': [1]") + .append(", 'mRender': renderHadoopDate }]").toString(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/ContainerPage.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/ContainerPage.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/ContainerPage.java new file mode 100644 index 0000000..1be8a26 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/ContainerPage.java @@ -0,0 +1,41 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import static org.apache.hadoop.yarn.util.StringHelper.join; + +import org.apache.hadoop.yarn.server.webapp.ContainerBlock; +import org.apache.hadoop.yarn.webapp.SubView; +import org.apache.hadoop.yarn.webapp.YarnWebParams; + +public class ContainerPage extends AHSView { + + @Override + protected void preHead(Page.HTML<_> html) { + commonPreHead(html); + + String containerId = $(YarnWebParams.CONTAINER_ID); + set(TITLE, containerId.isEmpty() ? "Bad request: missing container ID" + : join("Container ", $(YarnWebParams.CONTAINER_ID))); + } + + @Override + protected Class<? extends SubView> content() { + return ContainerBlock.class; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java new file mode 100644 index 0000000..5fd0124 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java @@ -0,0 +1,64 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; +import javax.xml.bind.JAXBContext; + +import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; +import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo; +import org.apache.hadoop.yarn.server.webapp.dao.AppInfo; +import org.apache.hadoop.yarn.server.webapp.dao.AppsInfo; +import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; +import org.apache.hadoop.yarn.server.webapp.dao.ContainersInfo; + +import com.google.inject.Singleton; +import com.sun.jersey.api.json.JSONConfiguration; +import com.sun.jersey.api.json.JSONJAXBContext; + +@Singleton +@Provider +@SuppressWarnings("rawtypes") +public class JAXBContextResolver implements ContextResolver<JAXBContext> { + + private JAXBContext context; + private final Set<Class> types; + + // you have to specify all the dao classes here + private final Class[] cTypes = { AppInfo.class, AppsInfo.class, + AppAttemptInfo.class, AppAttemptsInfo.class, ContainerInfo.class, + ContainersInfo.class }; + + public JAXBContextResolver() throws Exception { + this.types = new HashSet<Class>(Arrays.asList(cTypes)); + this.context = + new JSONJAXBContext(JSONConfiguration.natural().rootUnwrapping(false) + .build(), cTypes); + } + + @Override + public JAXBContext getContext(Class<?> objectType) { + return (types.contains(objectType)) ? context : null; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/NavBlock.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/NavBlock.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/NavBlock.java new file mode 100644 index 0000000..e84ddec --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/NavBlock.java @@ -0,0 +1,51 @@ +/** +* 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.yarn.server.applicationhistoryservice.webapp; + +import org.apache.hadoop.yarn.api.records.YarnApplicationState; +import org.apache.hadoop.yarn.webapp.view.HtmlBlock; + +public class NavBlock extends HtmlBlock { + + @Override + public void render(Block html) { + html. + div("#nav"). + h3("Application History"). + ul(). + li().a(url("apps"), "Applications"). + ul(). + li().a(url("apps", + YarnApplicationState.FINISHED.toString()), + YarnApplicationState.FINISHED.toString()). + _(). + li().a(url("apps", + YarnApplicationState.FAILED.toString()), + YarnApplicationState.FAILED.toString()). + _(). + li().a(url("apps", + YarnApplicationState.KILLED.toString()), + YarnApplicationState.KILLED.toString()). + _(). + _(). + _(). + _(). + _(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/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 new file mode 100644 index 0000000..c9d56fc --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java @@ -0,0 +1,504 @@ +/** + * 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.yarn.server.applicationhistoryservice.webapp; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.api.records.timeline.TimelineEntities; +import org.apache.hadoop.yarn.api.records.timeline.TimelineEntity; +import org.apache.hadoop.yarn.api.records.timeline.TimelineEvents; +import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric; +import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics; +import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse; +import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricStore; +import org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.EntityIdentifier; +import org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.GenericObjectMapper; +import org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.NameValuePair; +import org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.TimelineReader.Field; +import org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.TimelineStore; +import org.apache.hadoop.yarn.util.timeline.TimelineUtils; +import org.apache.hadoop.yarn.webapp.BadRequestException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import static org.apache.hadoop.yarn.util.StringHelper.CSV_JOINER; + +@Singleton +@Path("/ws/v1/timeline") +//TODO: support XML serialization/deserialization +public class TimelineWebServices { + + private static final Log LOG = LogFactory.getLog(TimelineWebServices.class); + + private TimelineStore store; + private TimelineMetricStore timelineMetricStore; + + @Inject + public TimelineWebServices(TimelineStore store, + TimelineMetricStore timelineMetricStore) { + this.store = store; + this.timelineMetricStore = timelineMetricStore; + } + + @XmlRootElement(name = "about") + @XmlAccessorType(XmlAccessType.NONE) + @Public + @Unstable + public static class AboutInfo { + + private String about; + + public AboutInfo() { + + } + + public AboutInfo(String about) { + this.about = about; + } + + @XmlElement(name = "About") + public String getAbout() { + return about; + } + + public void setAbout(String about) { + this.about = about; + } + + } + + /** + * Return the description of the timeline web services. + */ + @GET + @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public AboutInfo about( + @Context HttpServletRequest req, + @Context HttpServletResponse res) { + init(res); + return new AboutInfo("Timeline API"); + } + + /** + * Return a list of entities that match the given parameters. + */ + @GET + @Path("/{entityType}") + @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public TimelineEntities getEntities( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + @PathParam("entityType") String entityType, + @QueryParam("primaryFilter") String primaryFilter, + @QueryParam("secondaryFilter") String secondaryFilter, + @QueryParam("windowStart") String windowStart, + @QueryParam("windowEnd") String windowEnd, + @QueryParam("fromId") String fromId, + @QueryParam("fromTs") String fromTs, + @QueryParam("limit") String limit, + @QueryParam("fields") String fields) { + init(res); + TimelineEntities entities = null; + try { + entities = store.getEntities( + parseStr(entityType), + parseLongStr(limit), + parseLongStr(windowStart), + parseLongStr(windowEnd), + parseStr(fromId), + parseLongStr(fromTs), + parsePairStr(primaryFilter, ":"), + parsePairsStr(secondaryFilter, ",", ":"), + parseFieldsStr(fields, ",")); + } catch (NumberFormatException e) { + throw new BadRequestException( + "windowStart, windowEnd or limit is not a numeric value."); + } catch (IllegalArgumentException e) { + throw new BadRequestException("requested invalid field."); + } catch (IOException e) { + LOG.error("Error getting entities", e); + throw new WebApplicationException(e, + Response.Status.INTERNAL_SERVER_ERROR); + } + if (entities == null) { + return new TimelineEntities(); + } + return entities; + } + + /** + * Return a single entity of the given entity type and Id. + */ + @GET + @Path("/{entityType}/{entityId}") + @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public TimelineEntity getEntity( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + @PathParam("entityType") String entityType, + @PathParam("entityId") String entityId, + @QueryParam("fields") String fields) { + init(res); + TimelineEntity entity = null; + try { + entity = + store.getEntity(parseStr(entityId), parseStr(entityType), + parseFieldsStr(fields, ",")); + } catch (IllegalArgumentException e) { + throw new BadRequestException( + "requested invalid field."); + } catch (IOException e) { + LOG.error("Error getting entity", e); + throw new WebApplicationException(e, + Response.Status.INTERNAL_SERVER_ERROR); + } + if (entity == null) { + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + return entity; + } + + /** + * Return the events that match the given parameters. + */ + @GET + @Path("/{entityType}/events") + @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public TimelineEvents getEvents( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + @PathParam("entityType") String entityType, + @QueryParam("entityId") String entityId, + @QueryParam("eventType") String eventType, + @QueryParam("windowStart") String windowStart, + @QueryParam("windowEnd") String windowEnd, + @QueryParam("limit") String limit) { + init(res); + TimelineEvents events = null; + try { + events = store.getEntityTimelines( + parseStr(entityType), + parseArrayStr(entityId, ","), + parseLongStr(limit), + parseLongStr(windowStart), + parseLongStr(windowEnd), + parseArrayStr(eventType, ",")); + } catch (NumberFormatException e) { + throw new BadRequestException( + "windowStart, windowEnd or limit is not a numeric value."); + } catch (IOException e) { + LOG.error("Error getting entity timelines", e); + throw new WebApplicationException(e, + Response.Status.INTERNAL_SERVER_ERROR); + } + if (events == null) { + return new TimelineEvents(); + } + return events; + } + + /** + * Store the given metrics into the timeline store, and return errors that + * happened during storing. + */ + @Path("/metrics") + @POST + @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public TimelinePutResponse postMetrics( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + TimelineMetrics metrics) { + + init(res); + if (metrics == null) { + return new TimelinePutResponse(); + } + + try { + + // TODO: Check ACLs for MetricEntity using the TimelineACLManager. + // TODO: Save owner of the MetricEntity. + + if (LOG.isDebugEnabled()) { + LOG.debug("Storing metrics: " + + TimelineUtils.dumpTimelineRecordtoJSON(metrics, true)); + } + + return timelineMetricStore.putMetrics(metrics); + + } catch (Exception e) { + LOG.error("Error saving metrics.", e); + throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); + } + } + + /** + * Query for a particular metric satisfying the filter criteria. + * @return {@link TimelineMetric} + */ + @GET + @Path("/metrics/{metricName}") + @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public TimelineMetric getTimelineMetric( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + @PathParam("metricName") String metricName, + @QueryParam("appId") String appId, + @QueryParam("instanceId") String instanceId, + @QueryParam("hostname") String hostname, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("limit") String limit + ) { + init(res); + try { + return timelineMetricStore.getTimelineMetric(metricName, hostname, + appId, instanceId, parseLongStr(startTime), parseLongStr(endTime), + parseIntStr(limit)); + + } catch (NumberFormatException ne) { + throw new BadRequestException("startTime and limit should be numeric " + + "values"); + } catch (SQLException sql) { + throw new WebApplicationException(sql, + Response.Status.INTERNAL_SERVER_ERROR); + } catch (IOException io) { + throw new WebApplicationException(io, + Response.Status.INTERNAL_SERVER_ERROR); + } + } + + /** + * Query for a set of different metrics satisfying the filter criteria. + * All query params are optional. The default limit will apply if none + * specified. + * + * @param metricNames Comma separated list of metrics to retrieve. + * @param appId Application Id for the requested metrics. + * @param instanceId Application instance id. + * @param hostname Hostname where the metrics originated. + * @param startTime Start time for the metric records retrieved. + * @param limit limit on total number of {@link TimelineMetric} records + * retrieved. + * @return {@link TimelineMetrics} + */ + @GET + @Path("/metrics") + @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public TimelineMetrics getTimelineMetrics( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + @QueryParam("metricNames") String metricNames, + @QueryParam("appId") String appId, + @QueryParam("instanceId") String instanceId, + @QueryParam("hostname") String hostname, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("limit") String limit, + @QueryParam("grouped") String grouped + ) { + init(res); + try { + LOG.debug("Request for metrics => metricNames: " + metricNames + ", " + + "appId: " + appId + ", instanceId: " + instanceId + ", " + + "hostname: " + hostname + ", startTime: " + startTime + ", " + + "endTime: " + endTime); + + return timelineMetricStore.getTimelineMetrics( + parseListStr(metricNames, ","), hostname, appId, instanceId, + parseLongStr(startTime), parseLongStr(endTime), parseIntStr(limit), + parseBoolean(grouped)); + + } catch (NumberFormatException ne) { + throw new BadRequestException("startTime and limit should be numeric " + + "values"); + } catch (SQLException sql) { + throw new WebApplicationException(sql, + Response.Status.INTERNAL_SERVER_ERROR); + } catch (IOException io) { + throw new WebApplicationException(io, + Response.Status.INTERNAL_SERVER_ERROR); + } + } + + + /** + * Store the given entities into the timeline store, and return the errors + * that happen during storing. + */ + @POST + @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) + public TimelinePutResponse postEntities( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + TimelineEntities entities) { + init(res); + if (entities == null) { + return new TimelinePutResponse(); + } + try { + List<EntityIdentifier> entityIDs = new ArrayList<EntityIdentifier>(); + for (TimelineEntity entity : entities.getEntities()) { + EntityIdentifier entityID = + new EntityIdentifier(entity.getEntityId(), entity.getEntityType()); + entityIDs.add(entityID); + if (LOG.isDebugEnabled()) { + LOG.debug("Storing the entity " + entityID + ", JSON-style content: " + + TimelineUtils.dumpTimelineRecordtoJSON(entity)); + } + } + if (LOG.isDebugEnabled()) { + LOG.debug("Storing entities: " + CSV_JOINER.join(entityIDs)); + } + return store.put(entities); + } catch (IOException e) { + LOG.error("Error putting entities", e); + throw new WebApplicationException(e, + Response.Status.INTERNAL_SERVER_ERROR); + } + } + + private void init(HttpServletResponse response) { + response.setContentType(null); + } + + private static SortedSet<String> parseArrayStr(String str, String delimiter) { + if (str == null) { + return null; + } + SortedSet<String> strSet = new TreeSet<String>(); + String[] strs = str.split(delimiter); + for (String aStr : strs) { + strSet.add(aStr.trim()); + } + return strSet; + } + + private static NameValuePair parsePairStr(String str, String delimiter) { + if (str == null) { + return null; + } + String[] strs = str.split(delimiter, 2); + try { + return new NameValuePair(strs[0].trim(), + GenericObjectMapper.OBJECT_READER.readValue(strs[1].trim())); + } catch (Exception e) { + // didn't work as an Object, keep it as a String + return new NameValuePair(strs[0].trim(), strs[1].trim()); + } + } + + private static Collection<NameValuePair> parsePairsStr( + String str, String aDelimiter, String pDelimiter) { + if (str == null) { + return null; + } + String[] strs = str.split(aDelimiter); + Set<NameValuePair> pairs = new HashSet<NameValuePair>(); + for (String aStr : strs) { + pairs.add(parsePairStr(aStr, pDelimiter)); + } + return pairs; + } + + private static EnumSet<Field> parseFieldsStr(String str, String delimiter) { + if (str == null) { + return null; + } + String[] strs = str.split(delimiter); + List<Field> fieldList = new ArrayList<Field>(); + for (String s : strs) { + s = s.trim().toUpperCase(); + if (s.equals("EVENTS")) { + fieldList.add(Field.EVENTS); + } else if (s.equals("LASTEVENTONLY")) { + fieldList.add(Field.LAST_EVENT_ONLY); + } else if (s.equals("RELATEDENTITIES")) { + fieldList.add(Field.RELATED_ENTITIES); + } else if (s.equals("PRIMARYFILTERS")) { + fieldList.add(Field.PRIMARY_FILTERS); + } else if (s.equals("OTHERINFO")) { + fieldList.add(Field.OTHER_INFO); + } else { + throw new IllegalArgumentException("Requested nonexistent field " + s); + } + } + if (fieldList.size() == 0) { + return null; + } + Field f1 = fieldList.remove(fieldList.size() - 1); + if (fieldList.size() == 0) { + return EnumSet.of(f1); + } else { + return EnumSet.of(f1, fieldList.toArray(new Field[fieldList.size()])); + } + } + + private static Long parseLongStr(String str) { + return str == null ? null : Long.parseLong(str.trim()); + } + + private static Integer parseIntStr(String str) { + return str == null ? null : Integer.parseInt(str.trim()); + } + + private static boolean parseBoolean(String booleanStr) { + return booleanStr == null || Boolean.parseBoolean(booleanStr); + } + + private static List<String> parseListStr(String str, String delimiter) { + return str == null ? null : Arrays.asList(str.trim().split(delimiter)); + } + + private static String parseStr(String str) { + return str == null ? null : str.trim(); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/DATANODE.dat ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/DATANODE.dat b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/DATANODE.dat new file mode 100644 index 0000000..e157630 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/DATANODE.dat @@ -0,0 +1,101 @@ +| dfs.datanode.BlockChecksumOpAvgTime | datanode | +| dfs.datanode.BlockChecksumOpNumOps | datanode | +| dfs.datanode.BlockReportsAvgTime | datanode | +| dfs.datanode.BlockReportsNumOps | datanode | +| dfs.datanode.BlockVerificationFailures | datanode | +| dfs.datanode.BlocksCached | datanode | +| dfs.datanode.BlocksGetLocalPathInfo | datanode | +| dfs.datanode.BlocksRead | datanode | +| dfs.datanode.BlocksRemoved | datanode | +| dfs.datanode.BlocksReplicated | datanode | +| dfs.datanode.BlocksUncached | datanode | +| dfs.datanode.BlocksVerified | datanode | +| dfs.datanode.BlocksWritten | datanode | +| dfs.datanode.BytesRead | datanode | +| dfs.datanode.BytesWritten | datanode | +| dfs.datanode.CacheReportsAvgTime | datanode | +| dfs.datanode.CacheReportsNumOps | datanode | +| dfs.datanode.CopyBlockOpAvgTime | datanode | +| dfs.datanode.CopyBlockOpNumOps | datanode | +| dfs.datanode.FlushNanosAvgTime | datanode | +| dfs.datanode.FlushNanosNumOps | datanode | +| dfs.datanode.FsyncCount | datanode | +| dfs.datanode.FsyncNanosAvgTime | datanode | +| dfs.datanode.FsyncNanosNumOps | datanode | +| dfs.datanode.HeartbeatsAvgTime | datanode | +| dfs.datanode.HeartbeatsNumOps | datanode | +| dfs.datanode.PacketAckRoundTripTimeNanosAvgTime | datanode | +| dfs.datanode.PacketAckRoundTripTimeNanosNumOps | datanode | +| dfs.datanode.ReadBlockOpAvgTime | datanode | +| dfs.datanode.ReadBlockOpNumOps | datanode | +| dfs.datanode.ReadsFromLocalClient | datanode | +| dfs.datanode.ReadsFromRemoteClient | datanode | +| dfs.datanode.ReplaceBlockOpAvgTime | datanode | +| dfs.datanode.ReplaceBlockOpNumOps | datanode | +| dfs.datanode.SendDataPacketBlockedOnNetworkNanosAvgTime | datanode | +| dfs.datanode.SendDataPacketBlockedOnNetworkNanosNumOps | datanode | +| dfs.datanode.SendDataPacketTransferNanosAvgTime | datanode | +| dfs.datanode.SendDataPacketTransferNanosNumOps | datanode | +| dfs.datanode.VolumeFailures | datanode | +| dfs.datanode.WriteBlockOpAvgTime | datanode | +| dfs.datanode.WriteBlockOpNumOps | datanode | +| dfs.datanode.WritesFromLocalClient | datanode | +| dfs.datanode.WritesFromRemoteClient | datanode | +| jvm.JvmMetrics.GcCount | datanode | +| jvm.JvmMetrics.GcCountCopy | datanode | +| jvm.JvmMetrics.GcCountMarkSweepCompact | datanode | +| jvm.JvmMetrics.GcTimeMillis | datanode | +| jvm.JvmMetrics.GcTimeMillisCopy | datanode | +| jvm.JvmMetrics.GcTimeMillisMarkSweepCompact | datanode | +| jvm.JvmMetrics.LogError | datanode | +| jvm.JvmMetrics.LogFatal | datanode | +| jvm.JvmMetrics.LogInfo | datanode | +| jvm.JvmMetrics.LogWarn | datanode | +| jvm.JvmMetrics.MemHeapCommittedM | datanode | +| jvm.JvmMetrics.MemHeapMaxM | datanode | +| jvm.JvmMetrics.MemHeapUsedM | datanode | +| jvm.JvmMetrics.MemMaxM | datanode | +| jvm.JvmMetrics.MemNonHeapCommittedM | datanode | +| jvm.JvmMetrics.MemNonHeapMaxM | datanode | +| jvm.JvmMetrics.MemNonHeapUsedM | datanode | +| jvm.JvmMetrics.ThreadsBlocked | datanode | +| jvm.JvmMetrics.ThreadsNew | datanode | +| jvm.JvmMetrics.ThreadsRunnable | datanode | +| jvm.JvmMetrics.ThreadsTerminated | datanode | +| jvm.JvmMetrics.ThreadsTimedWaiting | datanode | +| jvm.JvmMetrics.ThreadsWaiting | datanode | +| metricssystem.MetricsSystem.DroppedPubAll | datanode | +| metricssystem.MetricsSystem.NumActiveSinks | datanode | +| metricssystem.MetricsSystem.NumActiveSources | datanode | +| metricssystem.MetricsSystem.NumAllSinks | datanode | +| metricssystem.MetricsSystem.NumAllSources | datanode | +| metricssystem.MetricsSystem.PublishAvgTime | datanode | +| metricssystem.MetricsSystem.PublishNumOps | datanode | +| metricssystem.MetricsSystem.Sink_timelineAvgTime | datanode | +| metricssystem.MetricsSystem.Sink_timelineDropped | datanode | +| metricssystem.MetricsSystem.Sink_timelineNumOps | datanode | +| metricssystem.MetricsSystem.Sink_timelineQsize | datanode | +| metricssystem.MetricsSystem.SnapshotAvgTime | datanode | +| metricssystem.MetricsSystem.SnapshotNumOps | datanode | +| rpc.rpc.CallQueueLength | datanode | +| rpc.rpc.NumOpenConnections | datanode | +| rpc.rpc.ReceivedBytes | datanode | +| rpc.rpc.RpcAuthenticationFailures | datanode | +| rpc.rpc.RpcAuthenticationSuccesses | datanode | +| rpc.rpc.RpcAuthorizationFailures | datanode | +| rpc.rpc.RpcAuthorizationSuccesses | datanode | +| rpc.rpc.RpcProcessingTimeAvgTime | datanode | +| rpc.rpc.RpcProcessingTimeNumOps | datanode | +| rpc.rpc.RpcQueueTimeAvgTime | datanode | +| rpc.rpc.RpcQueueTimeNumOps | datanode | +| rpc.rpc.SentBytes | datanode | +| rpcdetailed.rpcdetailed.InitReplicaRecoveryAvgTime | datanode | +| rpcdetailed.rpcdetailed.InitReplicaRecoveryNumOps | datanode | +| rpcdetailed.rpcdetailed.UpdateReplicaUnderRecoveryAvgTime | datanode | +| rpcdetailed.rpcdetailed.UpdateReplicaUnderRecoveryNumOps | datanode | +| ugi.UgiMetrics.GetGroupsAvgTime | datanode | +| ugi.UgiMetrics.GetGroupsNumOps | datanode | +| ugi.UgiMetrics.LoginFailureAvgTime | datanode | +| ugi.UgiMetrics.LoginFailureNumOps | datanode | +| ugi.UgiMetrics.LoginSuccessAvgTime | datanode | +| ugi.UgiMetrics.LoginSuccessNumOps | datanode | http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/HOST.dat ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/HOST.dat b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/HOST.dat new file mode 100644 index 0000000..c940800 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/HOST.dat @@ -0,0 +1,23 @@ +bytes_in +bytes_out +cpu_idle +cpu_intr +cpu_nice +cpu_sintr +cpu_system +cpu_user +cpu_wio +disk_free +disk_percent +disk_total +disk_used +load_fifteen +load_five +load_one +mem_buffered +mem_cached +mem_free +mem_shared +pkts_in +pkts_out +swap_free \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/MASTER_HBASE.dat ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/MASTER_HBASE.dat b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/MASTER_HBASE.dat new file mode 100644 index 0000000..9ba90f1 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/MASTER_HBASE.dat @@ -0,0 +1,69 @@ +ipc.IPC.authenticationFailures +ipc.IPC.authenticationSuccesses +ipc.IPC.authorizationFailures +ipc.IPC.authorizationSuccesses +ipc.IPC.numCallsInGeneralQueue +ipc.IPC.numCallsInPriorityQueue +ipc.IPC.numCallsInReplicationQueue +ipc.IPC.numOpenConnections +ipc.IPC.ProcessCallTime_75th_percentile +ipc.IPC.ProcessCallTime_95th_percentile +ipc.IPC.ProcessCallTime_99th_percentile +ipc.IPC.ProcessCallTime_max +ipc.IPC.ProcessCallTime_mean +ipc.IPC.ProcessCallTime_median +ipc.IPC.ProcessCallTime_min +ipc.IPC.ProcessCallTime_num_ops +ipc.IPC.QueueCallTime_75th_percentile +ipc.IPC.QueueCallTime_95th_percentile +ipc.IPC.QueueCallTime_99th_percentile +ipc.IPC.QueueCallTime_max +ipc.IPC.QueueCallTime_mean +ipc.IPC.QueueCallTime_median +ipc.IPC.QueueCallTime_min +ipc.IPC.QueueCallTime_num_ops +ipc.IPC.queueSize +ipc.IPC.receivedBytes +ipc.IPC.sentBytes +jvm.JvmMetrics.GcCount +jvm.JvmMetrics.GcCountConcurrentMarkSweep +jvm.JvmMetrics.GcCountCopy +jvm.JvmMetrics.GcTimeMillis +jvm.JvmMetrics.GcTimeMillisConcurrentMarkSweep +jvm.JvmMetrics.GcTimeMillisCopy +jvm.JvmMetrics.LogError +jvm.JvmMetrics.LogFatal +jvm.JvmMetrics.LogInfo +jvm.JvmMetrics.LogWarn +jvm.JvmMetrics.MemHeapCommittedM +jvm.JvmMetrics.MemHeapMaxM +jvm.JvmMetrics.MemHeapUsedM +jvm.JvmMetrics.MemMaxM +jvm.JvmMetrics.MemNonHeapCommittedM +jvm.JvmMetrics.MemNonHeapMaxM +jvm.JvmMetrics.MemNonHeapUsedM +jvm.JvmMetrics.ThreadsBlocked +jvm.JvmMetrics.ThreadsNew +jvm.JvmMetrics.ThreadsRunnable +jvm.JvmMetrics.ThreadsTerminated +jvm.JvmMetrics.ThreadsTimedWaiting +jvm.JvmMetrics.ThreadsWaiting +metricssystem.MetricsSystem.DroppedPubAll +metricssystem.MetricsSystem.NumActiveSinks +metricssystem.MetricsSystem.NumActiveSources +metricssystem.MetricsSystem.NumAllSinks +metricssystem.MetricsSystem.NumAllSources +metricssystem.MetricsSystem.PublishAvgTime +metricssystem.MetricsSystem.PublishNumOps +metricssystem.MetricsSystem.Sink_timelineAvgTime +metricssystem.MetricsSystem.Sink_timelineDropped +metricssystem.MetricsSystem.Sink_timelineNumOps +metricssystem.MetricsSystem.Sink_timelineQsize +metricssystem.MetricsSystem.SnapshotAvgTime +metricssystem.MetricsSystem.SnapshotNumOps +ugi.UgiMetrics.GetGroupsAvgTime +ugi.UgiMetrics.GetGroupsNumOps +ugi.UgiMetrics.LoginFailureAvgTime +ugi.UgiMetrics.LoginFailureNumOps +ugi.UgiMetrics.LoginSuccessAvgTime +ugi.UgiMetrics.LoginSuccessNumOps http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NAMENODE.dat ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NAMENODE.dat b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NAMENODE.dat new file mode 100644 index 0000000..6e98a9c --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NAMENODE.dat @@ -0,0 +1,205 @@ +default.StartupProgress.ElapsedTime +default.StartupProgress.LoadingEditsCount +default.StartupProgress.LoadingEditsElapsedTime +default.StartupProgress.LoadingEditsPercentComplete +default.StartupProgress.LoadingEditsTotal +default.StartupProgress.LoadingFsImageCount +default.StartupProgress.LoadingFsImageElapsedTime +default.StartupProgress.LoadingFsImagePercentComplete +default.StartupProgress.LoadingFsImageTotal +default.StartupProgress.PercentComplete +default.StartupProgress.SafeModeCount +default.StartupProgress.SafeModeElapsedTime +default.StartupProgress.SafeModePercentComplete +default.StartupProgress.SafeModeTotal +default.StartupProgress.SavingCheckpointCount +default.StartupProgress.SavingCheckpointElapsedTime +default.StartupProgress.SavingCheckpointPercentComplete +default.StartupProgress.SavingCheckpointTotal +dfs.FSNamesystem.BlockCapacity +dfs.FSNamesystem.BlocksTotal +dfs.FSNamesystem.CapacityRemaining +dfs.FSNamesystem.CapacityRemainingGB +dfs.FSNamesystem.CapacityTotal +dfs.FSNamesystem.CapacityTotalGB +dfs.FSNamesystem.CapacityUsed +dfs.FSNamesystem.CapacityUsedGB +dfs.FSNamesystem.CapacityUsedNonDFS +dfs.FSNamesystem.CorruptBlocks +dfs.FSNamesystem.ExcessBlocks +dfs.FSNamesystem.ExpiredHeartbeats +dfs.FSNamesystem.FilesTotal +dfs.FSNamesystem.LastCheckpointTime +dfs.FSNamesystem.LastWrittenTransactionId +dfs.FSNamesystem.MillisSinceLastLoadedEdits +dfs.FSNamesystem.MissingBlocks +dfs.FSNamesystem.PendingDataNodeMessageCount +dfs.FSNamesystem.PendingDeletionBlocks +dfs.FSNamesystem.PendingReplicationBlocks +dfs.FSNamesystem.PostponedMisreplicatedBlocks +dfs.FSNamesystem.ScheduledReplicationBlocks +dfs.FSNamesystem.Snapshots +dfs.FSNamesystem.SnapshottableDirectories +dfs.FSNamesystem.StaleDataNodes +dfs.FSNamesystem.TotalFiles +dfs.FSNamesystem.TotalLoad +dfs.FSNamesystem.TransactionsSinceLastCheckpoint +dfs.FSNamesystem.TransactionsSinceLastLogRoll +dfs.FSNamesystem.UnderReplicatedBlocks +dfs.namenode.AddBlockOps +dfs.namenode.AllowSnapshotOps +dfs.namenode.BlockReceivedAndDeletedOps +dfs.namenode.BlockReportAvgTime +dfs.namenode.BlockReportNumOps +dfs.namenode.CacheReportAvgTime +dfs.namenode.CacheReportNumOps +dfs.namenode.CreateFileOps +dfs.namenode.CreateSnapshotOps +dfs.namenode.CreateSymlinkOps +dfs.namenode.DeleteFileOps +dfs.namenode.DeleteSnapshotOps +dfs.namenode.DisallowSnapshotOps +dfs.namenode.FileInfoOps +dfs.namenode.FilesAppended +dfs.namenode.FilesCreated +dfs.namenode.FilesDeleted +dfs.namenode.FilesInGetListingOps +dfs.namenode.FilesRenamed +dfs.namenode.FsImageLoadTime +dfs.namenode.GetAdditionalDatanodeOps +dfs.namenode.GetBlockLocations +dfs.namenode.GetEditAvgTime +dfs.namenode.GetEditNumOps +dfs.namenode.GetImageAvgTime +dfs.namenode.GetImageNumOps +dfs.namenode.GetLinkTargetOps +dfs.namenode.GetListingOps +dfs.namenode.ListSnapshottableDirOps +dfs.namenode.PutImageAvgTime +dfs.namenode.PutImageNumOps +dfs.namenode.RenameSnapshotOps +dfs.namenode.SafeModeTime +dfs.namenode.SnapshotDiffReportOps +dfs.namenode.StorageBlockReportOps +dfs.namenode.SyncsAvgTime +dfs.namenode.SyncsNumOps +dfs.namenode.TransactionsAvgTime +dfs.namenode.TransactionsBatchedInSync +dfs.namenode.TransactionsNumOps +jvm.JvmMetrics.GcCount +jvm.JvmMetrics.GcCountConcurrentMarkSweep +jvm.JvmMetrics.GcCountParNew +jvm.JvmMetrics.GcTimeMillis +jvm.JvmMetrics.GcTimeMillisConcurrentMarkSweep +jvm.JvmMetrics.GcTimeMillisParNew +jvm.JvmMetrics.LogError +jvm.JvmMetrics.LogFatal +jvm.JvmMetrics.LogInfo +jvm.JvmMetrics.LogWarn +jvm.JvmMetrics.MemHeapCommittedM +jvm.JvmMetrics.MemHeapMaxM +jvm.JvmMetrics.MemHeapUsedM +jvm.JvmMetrics.MemMaxM +jvm.JvmMetrics.MemNonHeapCommittedM +jvm.JvmMetrics.MemNonHeapMaxM +jvm.JvmMetrics.MemNonHeapUsedM +jvm.JvmMetrics.ThreadsBlocked +jvm.JvmMetrics.ThreadsNew +jvm.JvmMetrics.ThreadsRunnable +jvm.JvmMetrics.ThreadsTerminated +jvm.JvmMetrics.ThreadsTimedWaiting +jvm.JvmMetrics.ThreadsWaiting +metricssystem.MetricsSystem.DroppedPubAll +metricssystem.MetricsSystem.NumActiveSinks +metricssystem.MetricsSystem.NumActiveSources +metricssystem.MetricsSystem.NumAllSinks +metricssystem.MetricsSystem.NumAllSources +metricssystem.MetricsSystem.PublishAvgTime +metricssystem.MetricsSystem.PublishNumOps +metricssystem.MetricsSystem.Sink_timelineAvgTime +metricssystem.MetricsSystem.Sink_timelineDropped +metricssystem.MetricsSystem.Sink_timelineNumOps +metricssystem.MetricsSystem.Sink_timelineQsize +metricssystem.MetricsSystem.SnapshotAvgTime +metricssystem.MetricsSystem.SnapshotNumOps +rpc.RetryCache.NameNodeRetryCache.CacheCleared +rpc.RetryCache.NameNodeRetryCache.CacheHit +rpc.RetryCache.NameNodeRetryCache.CacheUpdated +rpc.rpc.CallQueueLength +rpc.rpc.NumOpenConnections +rpc.rpc.ReceivedBytes +rpc.rpc.RpcAuthenticationFailures +rpc.rpc.RpcAuthenticationSuccesses +rpc.rpc.RpcAuthorizationFailures +rpc.rpc.RpcAuthorizationSuccesses +rpc.rpc.RpcProcessingTimeAvgTime +rpc.rpc.RpcProcessingTimeNumOps +rpc.rpc.RpcQueueTimeAvgTime +rpc.rpc.RpcQueueTimeNumOps +rpc.rpc.SentBytes +rpcdetailed.rpcdetailed.AbandonBlockAvgTime +rpcdetailed.rpcdetailed.AbandonBlockNumOps +rpcdetailed.rpcdetailed.AddBlockAvgTime +rpcdetailed.rpcdetailed.AddBlockNumOps +rpcdetailed.rpcdetailed.BlockReceivedAndDeletedAvgTime +rpcdetailed.rpcdetailed.BlockReceivedAndDeletedNumOps +rpcdetailed.rpcdetailed.BlockReportAvgTime +rpcdetailed.rpcdetailed.BlockReportNumOps +rpcdetailed.rpcdetailed.CommitBlockSynchronizationAvgTime +rpcdetailed.rpcdetailed.CommitBlockSynchronizationNumOps +rpcdetailed.rpcdetailed.CompleteAvgTime +rpcdetailed.rpcdetailed.CompleteNumOps +rpcdetailed.rpcdetailed.CreateAvgTime +rpcdetailed.rpcdetailed.CreateNumOps +rpcdetailed.rpcdetailed.DeleteAvgTime +rpcdetailed.rpcdetailed.DeleteNumOps +rpcdetailed.rpcdetailed.FsyncAvgTime +rpcdetailed.rpcdetailed.FsyncNumOps +rpcdetailed.rpcdetailed.GetAdditionalDatanodeAvgTime +rpcdetailed.rpcdetailed.GetAdditionalDatanodeNumOps +rpcdetailed.rpcdetailed.GetBlockLocationsAvgTime +rpcdetailed.rpcdetailed.GetBlockLocationsNumOps +rpcdetailed.rpcdetailed.GetEditLogManifestAvgTime +rpcdetailed.rpcdetailed.GetEditLogManifestNumOps +rpcdetailed.rpcdetailed.GetFileInfoAvgTime +rpcdetailed.rpcdetailed.GetFileInfoNumOps +rpcdetailed.rpcdetailed.GetListingAvgTime +rpcdetailed.rpcdetailed.GetListingNumOps +rpcdetailed.rpcdetailed.GetServerDefaultsAvgTime +rpcdetailed.rpcdetailed.GetServerDefaultsNumOps +rpcdetailed.rpcdetailed.GetTransactionIdAvgTime +rpcdetailed.rpcdetailed.GetTransactionIdNumOps +rpcdetailed.rpcdetailed.IsFileClosedAvgTime +rpcdetailed.rpcdetailed.IsFileClosedNumOps +rpcdetailed.rpcdetailed.MkdirsAvgTime +rpcdetailed.rpcdetailed.MkdirsNumOps +rpcdetailed.rpcdetailed.RecoverLeaseAvgTime +rpcdetailed.rpcdetailed.RecoverLeaseNumOps +rpcdetailed.rpcdetailed.RegisterDatanodeAvgTime +rpcdetailed.rpcdetailed.RegisterDatanodeNumOps +rpcdetailed.rpcdetailed.RenameAvgTime +rpcdetailed.rpcdetailed.RenameNumOps +rpcdetailed.rpcdetailed.RenewLeaseAvgTime +rpcdetailed.rpcdetailed.RenewLeaseNumOps +rpcdetailed.rpcdetailed.ReportBadBlocksAvgTime +rpcdetailed.rpcdetailed.ReportBadBlocksNumOps +rpcdetailed.rpcdetailed.RollEditLogAvgTime +rpcdetailed.rpcdetailed.RollEditLogNumOps +rpcdetailed.rpcdetailed.SendHeartbeatAvgTime +rpcdetailed.rpcdetailed.SendHeartbeatNumOps +rpcdetailed.rpcdetailed.SetSafeModeAvgTime +rpcdetailed.rpcdetailed.SetSafeModeNumOps +rpcdetailed.rpcdetailed.SetTimesAvgTime +rpcdetailed.rpcdetailed.SetTimesNumOps +rpcdetailed.rpcdetailed.UpdateBlockForPipelineAvgTime +rpcdetailed.rpcdetailed.UpdateBlockForPipelineNumOps +rpcdetailed.rpcdetailed.UpdatePipelineAvgTime +rpcdetailed.rpcdetailed.UpdatePipelineNumOps +rpcdetailed.rpcdetailed.VersionRequestAvgTime +rpcdetailed.rpcdetailed.VersionRequestNumOps +ugi.UgiMetrics.GetGroupsAvgTime +ugi.UgiMetrics.GetGroupsNumOps +ugi.UgiMetrics.LoginFailureAvgTime +ugi.UgiMetrics.LoginFailureNumOps +ugi.UgiMetrics.LoginSuccessAvgTime +ugi.UgiMetrics.LoginSuccessNumOps http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NODEMANAGER.dat ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NODEMANAGER.dat b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NODEMANAGER.dat new file mode 100644 index 0000000..239b3d4 --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/NODEMANAGER.dat @@ -0,0 +1,67 @@ +jvm.JvmMetrics.GcCount +jvm.JvmMetrics.GcCountCopy +jvm.JvmMetrics.GcCountMarkSweepCompact +jvm.JvmMetrics.GcTimeMillis +jvm.JvmMetrics.GcTimeMillisCopy +jvm.JvmMetrics.GcTimeMillisMarkSweepCompact +jvm.JvmMetrics.LogError +jvm.JvmMetrics.LogFatal +jvm.JvmMetrics.LogInfo +jvm.JvmMetrics.LogWarn +jvm.JvmMetrics.MemHeapCommittedM +jvm.JvmMetrics.MemHeapMaxM +jvm.JvmMetrics.MemHeapUsedM +jvm.JvmMetrics.MemMaxM +jvm.JvmMetrics.MemNonHeapCommittedM +jvm.JvmMetrics.MemNonHeapMaxM +jvm.JvmMetrics.MemNonHeapUsedM +jvm.JvmMetrics.ThreadsBlocked +jvm.JvmMetrics.ThreadsNew +jvm.JvmMetrics.ThreadsRunnable +jvm.JvmMetrics.ThreadsTerminated +jvm.JvmMetrics.ThreadsTimedWaiting +jvm.JvmMetrics.ThreadsWaiting +mapred.ShuffleMetrics.ShuffleConnections +mapred.ShuffleMetrics.ShuffleOutputBytes +mapred.ShuffleMetrics.ShuffleOutputsFailed +mapred.ShuffleMetrics.ShuffleOutputsOK +metricssystem.MetricsSystem.DroppedPubAll +metricssystem.MetricsSystem.NumActiveSinks +metricssystem.MetricsSystem.NumActiveSources +metricssystem.MetricsSystem.NumAllSinks +metricssystem.MetricsSystem.NumAllSources +metricssystem.MetricsSystem.PublishAvgTime +metricssystem.MetricsSystem.PublishNumOps +metricssystem.MetricsSystem.Sink_timelineAvgTime +metricssystem.MetricsSystem.Sink_timelineDropped +metricssystem.MetricsSystem.Sink_timelineNumOps +metricssystem.MetricsSystem.Sink_timelineQsize +metricssystem.MetricsSystem.SnapshotAvgTime +metricssystem.MetricsSystem.SnapshotNumOps +rpc.rpc.CallQueueLength +rpc.rpc.NumOpenConnections +rpc.rpc.ReceivedBytes +rpc.rpc.RpcAuthenticationFailures +rpc.rpc.RpcAuthenticationSuccesses +rpc.rpc.RpcAuthorizationFailures +rpc.rpc.RpcAuthorizationSuccesses +rpc.rpc.RpcProcessingTimeAvgTime +rpc.rpc.RpcProcessingTimeNumOps +rpc.rpc.RpcQueueTimeAvgTime +rpc.rpc.RpcQueueTimeNumOps +rpc.rpc.SentBytes +ugi.UgiMetrics.GetGroupsAvgTime +ugi.UgiMetrics.GetGroupsNumOps +ugi.UgiMetrics.LoginFailureAvgTime +ugi.UgiMetrics.LoginFailureNumOps +ugi.UgiMetrics.LoginSuccessAvgTime +ugi.UgiMetrics.LoginSuccessNumOps +yarn.NodeManagerMetrics.AllocatedContainers +yarn.NodeManagerMetrics.AllocatedGB +yarn.NodeManagerMetrics.AvailableGB +yarn.NodeManagerMetrics.ContainersCompleted +yarn.NodeManagerMetrics.ContainersFailed +yarn.NodeManagerMetrics.ContainersIniting +yarn.NodeManagerMetrics.ContainersKilled +yarn.NodeManagerMetrics.ContainersLaunched +yarn.NodeManagerMetrics.ContainersRunning http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat new file mode 100644 index 0000000..ec698db --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat @@ -0,0 +1,88 @@ +jvm.JvmMetrics.GcCount +jvm.JvmMetrics.GcCountPS MarkSweep +jvm.JvmMetrics.GcCountPS Scavenge +jvm.JvmMetrics.GcTimeMillis +jvm.JvmMetrics.GcTimeMillisPS MarkSweep +jvm.JvmMetrics.GcTimeMillisPS Scavenge +jvm.JvmMetrics.LogError +jvm.JvmMetrics.LogFatal +jvm.JvmMetrics.LogInfo +jvm.JvmMetrics.LogWarn +jvm.JvmMetrics.MemHeapCommittedM +jvm.JvmMetrics.MemHeapMaxM +jvm.JvmMetrics.MemHeapUsedM +jvm.JvmMetrics.MemMaxM +jvm.JvmMetrics.MemNonHeapCommittedM +jvm.JvmMetrics.MemNonHeapMaxM +jvm.JvmMetrics.MemNonHeapUsedM +jvm.JvmMetrics.ThreadsBlocked +jvm.JvmMetrics.ThreadsNew +jvm.JvmMetrics.ThreadsRunnable +jvm.JvmMetrics.ThreadsTerminated +jvm.JvmMetrics.ThreadsTimedWaiting +jvm.JvmMetrics.ThreadsWaiting +metricssystem.MetricsSystem.DroppedPubAll +metricssystem.MetricsSystem.NumActiveSinks +metricssystem.MetricsSystem.NumActiveSources +metricssystem.MetricsSystem.NumAllSinks +metricssystem.MetricsSystem.NumAllSources +metricssystem.MetricsSystem.PublishAvgTime +metricssystem.MetricsSystem.PublishNumOps +metricssystem.MetricsSystem.Sink_timelineAvgTime +metricssystem.MetricsSystem.Sink_timelineDropped +metricssystem.MetricsSystem.Sink_timelineNumOps +metricssystem.MetricsSystem.Sink_timelineQsize +metricssystem.MetricsSystem.SnapshotAvgTime +metricssystem.MetricsSystem.SnapshotNumOps +rpc.rpc.CallQueueLength +rpc.rpc.NumOpenConnections +rpc.rpc.ReceivedBytes +rpc.rpc.RpcAuthenticationFailures +rpc.rpc.RpcAuthenticationSuccesses +rpc.rpc.RpcAuthorizationFailures +rpc.rpc.RpcAuthorizationSuccesses +rpc.rpc.RpcProcessingTimeAvgTime +rpc.rpc.RpcProcessingTimeNumOps +rpc.rpc.RpcQueueTimeAvgTime +rpc.rpc.RpcQueueTimeNumOps +rpc.rpc.SentBytes +rpcdetailed.rpcdetailed.NodeHeartbeatAvgTime +rpcdetailed.rpcdetailed.NodeHeartbeatNumOps +rpcdetailed.rpcdetailed.RegisterNodeManagerAvgTime +rpcdetailed.rpcdetailed.RegisterNodeManagerNumOps +ugi.UgiMetrics.GetGroupsAvgTime +ugi.UgiMetrics.GetGroupsNumOps +ugi.UgiMetrics.LoginFailureAvgTime +ugi.UgiMetrics.LoginFailureNumOps +ugi.UgiMetrics.LoginSuccessAvgTime +ugi.UgiMetrics.LoginSuccessNumOps +yarn.ClusterMetrics.NumActiveNMs +yarn.ClusterMetrics.NumDecommissionedNMs +yarn.ClusterMetrics.NumLostNMs +yarn.ClusterMetrics.NumRebootedNMs +yarn.ClusterMetrics.NumUnhealthyNMs +yarn.QueueMetrics.ActiveApplications +yarn.QueueMetrics.ActiveUsers +yarn.QueueMetrics.AggregateContainersAllocated +yarn.QueueMetrics.AggregateContainersReleased +yarn.QueueMetrics.AllocatedContainers +yarn.QueueMetrics.AllocatedMB +yarn.QueueMetrics.AllocatedVCores +yarn.QueueMetrics.AppsCompleted +yarn.QueueMetrics.AppsFailed +yarn.QueueMetrics.AppsKilled +yarn.QueueMetrics.AppsPending +yarn.QueueMetrics.AppsRunning +yarn.QueueMetrics.AppsSubmitted +yarn.QueueMetrics.AvailableMB +yarn.QueueMetrics.AvailableVCores +yarn.QueueMetrics.PendingContainers +yarn.QueueMetrics.PendingMB +yarn.QueueMetrics.PendingVCores +yarn.QueueMetrics.ReservedContainers +yarn.QueueMetrics.ReservedMB +yarn.QueueMetrics.ReservedVCores +yarn.QueueMetrics.running_0 +yarn.QueueMetrics.running_1440 +yarn.QueueMetrics.running_300 +yarn.QueueMetrics.running_60 http://git-wip-us.apache.org/repos/asf/ambari/blob/ba3d6926/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat new file mode 100644 index 0000000..38b870f --- /dev/null +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat @@ -0,0 +1,178 @@ +ipc.IPC.authenticationFailures +ipc.IPC.authenticationSuccesses +ipc.IPC.authorizationFailures +ipc.IPC.authorizationSuccesses +ipc.IPC.numCallsInGeneralQueue +ipc.IPC.numCallsInPriorityQueue +ipc.IPC.numCallsInReplicationQueue +ipc.IPC.numOpenConnections +ipc.IPC.ProcessCallTime_75th_percentile +ipc.IPC.ProcessCallTime_95th_percentile +ipc.IPC.ProcessCallTime_99th_percentile +ipc.IPC.ProcessCallTime_max +ipc.IPC.ProcessCallTime_mean +ipc.IPC.ProcessCallTime_median +ipc.IPC.ProcessCallTime_min +ipc.IPC.ProcessCallTime_num_ops +ipc.IPC.QueueCallTime_75th_percentile +ipc.IPC.QueueCallTime_95th_percentile +ipc.IPC.QueueCallTime_99th_percentile +ipc.IPC.QueueCallTime_max +ipc.IPC.QueueCallTime_mean +ipc.IPC.QueueCallTime_median +ipc.IPC.QueueCallTime_min +ipc.IPC.QueueCallTime_num_ops +ipc.IPC.queueSize +ipc.IPC.receivedBytes +ipc.IPC.sentBytes +jvm.JvmMetrics.GcCount +jvm.JvmMetrics.GcCountConcurrentMarkSweep +jvm.JvmMetrics.GcCountCopy +jvm.JvmMetrics.GcTimeMillis +jvm.JvmMetrics.GcTimeMillisConcurrentMarkSweep +jvm.JvmMetrics.GcTimeMillisCopy +jvm.JvmMetrics.LogError +jvm.JvmMetrics.LogFatal +jvm.JvmMetrics.LogInfo +jvm.JvmMetrics.LogWarn +jvm.JvmMetrics.MemHeapCommittedM +jvm.JvmMetrics.MemHeapMaxM +jvm.JvmMetrics.MemHeapUsedM +jvm.JvmMetrics.MemMaxM +jvm.JvmMetrics.MemNonHeapCommittedM +jvm.JvmMetrics.MemNonHeapMaxM +jvm.JvmMetrics.MemNonHeapUsedM +jvm.JvmMetrics.ThreadsBlocked +jvm.JvmMetrics.ThreadsNew +jvm.JvmMetrics.ThreadsRunnable +jvm.JvmMetrics.ThreadsTerminated +jvm.JvmMetrics.ThreadsTimedWaiting +jvm.JvmMetrics.ThreadsWaiting +metricssystem.MetricsSystem.DroppedPubAll +metricssystem.MetricsSystem.NumActiveSinks +metricssystem.MetricsSystem.NumActiveSources +metricssystem.MetricsSystem.NumAllSinks +metricssystem.MetricsSystem.NumAllSources +metricssystem.MetricsSystem.PublishAvgTime +metricssystem.MetricsSystem.PublishNumOps +metricssystem.MetricsSystem.Sink_timelineAvgTime +metricssystem.MetricsSystem.Sink_timelineDropped +metricssystem.MetricsSystem.Sink_timelineNumOps +metricssystem.MetricsSystem.Sink_timelineQsize +metricssystem.MetricsSystem.SnapshotAvgTime +metricssystem.MetricsSystem.SnapshotNumOps +regionserver.Server.Append_75th_percentile +regionserver.Server.Append_95th_percentile +regionserver.Server.Append_99th_percentile +regionserver.Server.Append_max +regionserver.Server.Append_mean +regionserver.Server.Append_median +regionserver.Server.Append_min +regionserver.Server.Append_num_ops +regionserver.Server.blockCacheCount +regionserver.Server.blockCacheEvictionCount +regionserver.Server.blockCacheExpressHitPercent +regionserver.Server.blockCacheFreeSize +regionserver.Server.blockCacheHitCount +regionserver.Server.blockCacheMissCount +regionserver.Server.blockCacheSize +regionserver.Server.blockCountHitPercent +regionserver.Server.checkMutateFailedCount +regionserver.Server.checkMutatePassedCount +regionserver.Server.compactionQueueLength +regionserver.Server.Delete_75th_percentile +regionserver.Server.Delete_95th_percentile +regionserver.Server.Delete_99th_percentile +regionserver.Server.Delete_max +regionserver.Server.Delete_mean +regionserver.Server.Delete_median +regionserver.Server.Delete_min +regionserver.Server.Delete_num_ops +regionserver.Server.flushQueueLength +regionserver.Server.Get_75th_percentile +regionserver.Server.Get_95th_percentile +regionserver.Server.Get_99th_percentile +regionserver.Server.Get_max +regionserver.Server.Get_mean +regionserver.Server.Get_median +regionserver.Server.Get_min +regionserver.Server.Get_num_ops +regionserver.Server.hlogFileCount +regionserver.Server.hlogFileSize +regionserver.Server.Increment_75th_percentile +regionserver.Server.Increment_95th_percentile +regionserver.Server.Increment_99th_percentile +regionserver.Server.Increment_max +regionserver.Server.Increment_mean +regionserver.Server.Increment_median +regionserver.Server.Increment_min +regionserver.Server.Increment_num_ops +regionserver.Server.memStoreSize +regionserver.Server.Mutate_75th_percentile +regionserver.Server.Mutate_95th_percentile +regionserver.Server.Mutate_99th_percentile +regionserver.Server.Mutate_max +regionserver.Server.Mutate_mean +regionserver.Server.Mutate_median +regionserver.Server.Mutate_min +regionserver.Server.Mutate_num_ops +regionserver.Server.mutationsWithoutWALCount +regionserver.Server.mutationsWithoutWALSize +regionserver.Server.percentFilesLocal +regionserver.Server.readRequestCount +regionserver.Server.regionCount +regionserver.Server.regionServerStartTime +regionserver.Server.Replay_75th_percentile +regionserver.Server.Replay_95th_percentile +regionserver.Server.Replay_99th_percentile +regionserver.Server.Replay_max +regionserver.Server.Replay_mean +regionserver.Server.Replay_median +regionserver.Server.Replay_min +regionserver.Server.Replay_num_ops +regionserver.Server.slowAppendCount +regionserver.Server.slowDeleteCount +regionserver.Server.slowGetCount +regionserver.Server.slowIncrementCount +regionserver.Server.slowPutCount +regionserver.Server.staticBloomSize +regionserver.Server.staticIndexSize +regionserver.Server.storeCount +regionserver.Server.storeFileCount +regionserver.Server.storeFileIndexSize +regionserver.Server.storeFileSize +regionserver.Server.totalRequestCount +regionserver.Server.updatesBlockedTime +regionserver.Server.writeRequestCount +regionserver.WAL.appendCount +regionserver.WAL.AppendSize_75th_percentile +regionserver.WAL.AppendSize_95th_percentile +regionserver.WAL.AppendSize_99th_percentile +regionserver.WAL.AppendSize_max +regionserver.WAL.AppendSize_mean +regionserver.WAL.AppendSize_median +regionserver.WAL.AppendSize_min +regionserver.WAL.AppendSize_num_ops +regionserver.WAL.AppendTime_75th_percentile +regionserver.WAL.AppendTime_95th_percentile +regionserver.WAL.AppendTime_99th_percentile +regionserver.WAL.AppendTime_max +regionserver.WAL.AppendTime_mean +regionserver.WAL.AppendTime_median +regionserver.WAL.AppendTime_min +regionserver.WAL.AppendTime_num_ops +regionserver.WAL.slowAppendCount +regionserver.WAL.SyncTime_75th_percentile +regionserver.WAL.SyncTime_95th_percentile +regionserver.WAL.SyncTime_99th_percentile +regionserver.WAL.SyncTime_max +regionserver.WAL.SyncTime_mean +regionserver.WAL.SyncTime_median +regionserver.WAL.SyncTime_min +regionserver.WAL.SyncTime_num_ops +ugi.UgiMetrics.GetGroupsAvgTime +ugi.UgiMetrics.GetGroupsNumOps +ugi.UgiMetrics.LoginFailureAvgTime +ugi.UgiMetrics.LoginFailureNumOps +ugi.UgiMetrics.LoginSuccessAvgTime +ugi.UgiMetrics.LoginSuccessNumOps \ No newline at end of file