flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zentol <...@git.apache.org>
Subject [GitHub] flink issue #4647: [FLINK-7575] [WEB-DASHBOARD] Display "Fetching..." instea...
Date Mon, 18 Sep 2017 13:37:18 GMT
Github user zentol commented on the issue:

    Tried it out and it works as expected.
    After looking at the aggregation code in detail I suggest to set an isComplete boolean
for each counter instead of setting the value to -1. This makes things more explicit, and
preserves the existing behavior of happily aggregating the counters. It also simplifies the
addition of bytesInLocal/-Remote.
    I.e., the aggregation part looks like this:
    String numBytesInRemoteString = metrics.getMetric(MetricNames.IO_NUM_BYTES_IN_REMOTE);
    if (numBytesInRemoteString == null) {
    	this.numBytesInRemoteComplete = false;
    } else {
    	this.numBytesInRemote += Long.valueOf(numBytesInRemoteString);
    and the writing like this:
    public void writeIOMetricsAsJson(JsonGenerator gen) throws IOException {
    	long numBytesIn = this.numBytesInLocal + this.numBytesInRemote;
    	writeIOMetricWithCompleteness(gen, "read-bytes", numBytesIn, this.numBytesInLocalComplete
&& this.numBytesInRemoteComplete);
    	writeIOMetricWithCompleteness(gen, "write-bytes", this.numBytesOut, this.numBytesOutComplete);
    	writeIOMetricWithCompleteness(gen, "read-records", this.numRecordsIn, this.numRecordsInComplete);
    	writeIOMetricWithCompleteness(gen, "write-records", this.numRecordsOut, this.numRecordsOutComplete);
    private void writeIOMetricWithCompleteness(JsonGenerator gen, String fieldName, long fieldValue,
boolean isComplete) throws IOException{
    	gen.writeNumberField(fieldName, fieldValue);
    	gen.writeBooleanField(fieldName + "-complete", isComplete);
    What do you think @jameslafa ?


View raw message