[ https://issues.apache.org/jira/browse/FLINK-3030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15642459#comment-15642459 ]
ASF GitHub Bot commented on FLINK-3030: --------------------------------------- Github user mushketyk commented on a diff in the pull request: https://github.com/apache/flink/pull/2448#discussion_r86697108 --- Diff: flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JsonGenerators.java --- @@ -0,0 +1,86 @@ +/* + * 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.flink.runtime.webmonitor.handlers; + +import com.fasterxml.jackson.core.JsonGenerator; +import org.apache.flink.api.common.accumulators.Accumulator; +import org.apache.flink.api.common.accumulators.LongCounter; +import org.apache.flink.runtime.accumulators.AccumulatorRegistry; +import org.apache.flink.runtime.execution.ExecutionState; +import org.apache.flink.runtime.executiongraph.Execution; +import org.apache.flink.runtime.instance.InstanceConnectionInfo; + +import java.io.IOException; +import java.util.Map; + +public final class JsonGenerators { + private JsonGenerators() {} + + public static void serializeExecutionAttempt(Execution execAttempt, JsonGenerator gen) throws IOException { + + final ExecutionState status = execAttempt.getState(); + final long now = System.currentTimeMillis(); + + InstanceConnectionInfo location = execAttempt.getAssignedResourceLocation(); + String locationString = location == null ? "(unassigned)" : location.getHostname(); + + long startTime = execAttempt.getStateTimestamp(ExecutionState.DEPLOYING); + if (startTime == 0) { + startTime = -1; + } + long endTime = status.isTerminal() ? execAttempt.getStateTimestamp(status) : -1; + long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1; + + Map<AccumulatorRegistry.Metric, Accumulator<?, ?>> metrics = execAttempt.getFlinkAccumulators(); + LongCounter readBytes; + LongCounter writeBytes; + LongCounter readRecords; + LongCounter writeRecords; + + if (metrics != null) { + readBytes = (LongCounter) metrics.get(AccumulatorRegistry.Metric.NUM_BYTES_IN); + writeBytes = (LongCounter) metrics.get(AccumulatorRegistry.Metric.NUM_BYTES_OUT); + readRecords = (LongCounter) metrics.get(AccumulatorRegistry.Metric.NUM_RECORDS_IN); + writeRecords = (LongCounter) metrics.get(AccumulatorRegistry.Metric.NUM_RECORDS_OUT); --- End diff -- Ok. I'll rebase the change and fix merge conflicts. > Enhance Dashboard to show Execution Attempts > -------------------------------------------- > > Key: FLINK-3030 > URL: https://issues.apache.org/jira/browse/FLINK-3030 > Project: Flink > Issue Type: Improvement > Components: Webfrontend > Affects Versions: 0.10.0 > Reporter: Stephan Ewen > Assignee: Ivan Mushketyk > Fix For: 1.0.0 > > > Currently, the web dashboard shows only the latest execution attempt. We > should make all execution attempts and their accumulators available for > inspection. > The REST monitoring API supports this, so it should be a change only to the > frontend part. -- This message was sent by Atlassian JIRA (v6.3.4#6332)