Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-595][Android]improvement apm monitor (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky-chen authored and YorkShen committed Aug 27, 2018
1 parent 74eb129 commit 3c2f5ac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class WXInstanceApm {
public static final String KEY_PAGE_STAGES_RENDER_ORGIGIN = "wxRenderTimeOrigin";
public static final String KEY_PAGE_STAGES_LOAD_BUNDLE_START = "wxStartLoadBundle";
public static final String KEY_PAGE_STAGES_LOAD_BUNDLE_END = "wxEndLoadBundle";
public static final String KEY_PAGE_STAGES_FIRST_INTERACTION_VIEW = "wxFirstInteractionView";
public static final String KEY_PAGE_STAGES_CREATE_FINISH= "wxJSBundleCreateFinish";
public static final String KEY_PAGE_STAGES_FSRENDER = "wxFsRender";
public static final String KEY_PAGE_STAGES_NEW_FSRENDER = "wxNewFsRender";
Expand Down Expand Up @@ -106,6 +107,7 @@ public class WXInstanceApm {
private Map<String, Double> recordStatsMap;
private boolean isFSEnd;
private boolean mHasInit = false;
private boolean hasRecordFistInteractionView =false;
public final Map<String,Object> extInfo;

public WXInstanceApm(String instanceId) {
Expand Down Expand Up @@ -235,7 +237,7 @@ public void onEnd() {
if (null == apmInstance) {
return;
}
apmInstance.onStage(KEY_PAGE_STAGES_DESTROY, System.currentTimeMillis());
onStage(KEY_PAGE_STAGES_DESTROY);
apmInstance.onEnd();
}

Expand All @@ -255,7 +257,11 @@ public void arriveInteraction(int screenViewCount, int allViewCount) {
if (null == apmInstance) {
return;
}
onStage(WXInstanceApm.KEY_PAGE_STAGES_INTERACTION);
if (!hasRecordFistInteractionView){
onStage(KEY_PAGE_STAGES_FIRST_INTERACTION_VIEW);
hasRecordFistInteractionView = true;
}
onStage(KEY_PAGE_STAGES_INTERACTION);
updateMaxStats(KEY_PAGE_STATS_I_SCREEN_VIEW_COUNT, screenViewCount);
updateMaxStats(KEY_PAGE_STATS_I_ALL_VIEW_COUNT, allViewCount);
WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.taobao.weex.common.WXErrorCode.ErrorType;
import com.taobao.weex.common.WXJSExceptionInfo;
import com.taobao.weex.utils.WXExceptionUtils;
import com.taobao.weex.utils.WXUtils;

public class WXInstanceExceptionRecord {

Expand Down Expand Up @@ -139,6 +140,17 @@ public void checkEmptyScreenAndReport() {
if (!mBeginRender || mHasReportScreenEmpty || hasAddView.get() || hasDegrade.get()) {
return;
}
//2s limit of instance stayTime (case in\quit very fast case)
final long DIFF_LIMIT = 2000;
long useTime = 2001;
Long startRequestTime = mStageMap.get(WXInstanceApm.KEY_PAGE_STAGES_DOWN_BUNDLE_START);
if (null != startRequestTime) {
useTime = WXUtils.getFixUnixTime() - startRequestTime;
}
if (useTime < DIFF_LIMIT) {
return;
}

boolean hasJsException = false;
for (WXJSExceptionInfo info : errorList) {
if (info.getErrCode().getErrorGroup() == ErrorGroup.JS) {
Expand All @@ -151,6 +163,7 @@ public void checkEmptyScreenAndReport() {
flagMap.put("wxHasAddView",String.valueOf(hasAddView.get()));
flagMap.put("wxHasDegrade",String.valueOf(hasDegrade.get()));
flagMap.put("wxHasReportScreenEmpty",String.valueOf(mHasReportScreenEmpty));
flagMap.put("wxUseTime", String.valueOf(useTime));

WXExceptionUtils.commitCriticalExceptionRT(
instanceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public GraphicActionCreateBody(@NonNull WXSDKInstance instance, String ref,
public void executeAction() {
super.executeAction();
try {
component.mIsAddElementToTree = true;
component.createView();
component.applyLayoutAndEvent(component);
component.bindData(component);
Expand Down

0 comments on commit 3c2f5ac

Please sign in to comment.