code: public long getLagBytes() {
      try {
        if (inputEditStream != null && inputEditStream.isInProgress()) {
          // for file journals it may happen that we read a segment finalized
          // by primary, but not refreshed by the standby, so length() returns 0
          // hence we take max(-1,lag)
          return Math.max(-1,
              inputEditStream.length() - this.inputEditStream.getPosition());
        }
        return -1;
      } catch (IOException ex) {
        LOG.error("Error getting the lag", ex);
        return -1;
      }
    }
docs: Returns the distance in bytes between the current position inside of the
  edits log and the length of the edits log