YorkShen closed pull request #1474: [WEEX-595][Android]improvement apm monitor
URL: https://github.com/apache/incubator-weex/pull/1474
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
index f37867860d..57a8d0b86e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
+++ b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
@@ -55,6 +55,7 @@
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";
@@ -106,6 +107,7 @@
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) {
@@ -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();
}
@@ -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);
diff --git
a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceExceptionRecord.java
b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceExceptionRecord.java
index 036aa286ba..91d25af8f0 100644
---
a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceExceptionRecord.java
+++
b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceExceptionRecord.java
@@ -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 {
@@ -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) {
@@ -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,
diff --git
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateBody.java
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateBody.java
index 2286057033..59e2406aca 100644
---
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateBody.java
+++
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateBody.java
@@ -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);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services