Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
a518e9b8
Commit
a518e9b8
authored
Jul 28, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/qj/event_point' into 'd/v4.4.05'
事件埋点修改 See merge request app_android_lib/YDL-Component!269
parents
49b3ef50
4673e6c2
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
69 additions
and
37 deletions
+69
-37
AudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
+5
-2
YDLavManager.kt
m-audioim/src/main/java/com/ydl/audioim/YDLavManager.kt
+3
-2
WatchMessagePictureActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchMessagePictureActivity.java
+2
-2
WatchVideoActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchVideoActivity.java
+2
-2
YDLMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
+1
-1
MessageListPanelEx.java
m-im/src/main/java/com/yidianling/uikit/business/session/module/list/MessageListPanelEx.java
+3
-4
MsgViewHolderAudio.java
m-im/src/main/java/com/yidianling/uikit/business/session/viewholder/MsgViewHolderAudio.java
+2
-2
MsgViewHolderBase.java
m-im/src/main/java/com/yidianling/uikit/business/session/viewholder/MsgViewHolderBase.java
+2
-2
LoginObservable.kt
m-user/src/main/java/com/yidianling/user/rxlogin/LoginObservable.kt
+1
-1
OneKeyLoginHelp.kt
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
+3
-3
InputPassWordPresenterImpl.kt
m-user/src/main/java/com/yidianling/user/ui/login/presenter/InputPassWordPresenterImpl.kt
+3
-3
LoginPresenterImpl.kt
m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
+4
-4
VerificationCodePresenterImpl.kt
m-user/src/main/java/com/yidianling/user/ui/login/presenter/VerificationCodePresenterImpl.kt
+6
-6
ApmInit.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/app/ApmInit.kt
+29
-0
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+3
-3
No files found.
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
View file @
a518e9b8
...
...
@@ -48,6 +48,7 @@ import com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler
import
com.ydl.ydl_av.voice.manager.YDLVoiceManager
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
import
com.ydl.ydl_image.manager.YDLImageCacheManager
import
com.ydl.ydlcommon.app.Apm
import
com.ydl.ydlcommon.base.BaseMvpActivity
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.modular.findRouteService
...
...
@@ -318,6 +319,7 @@ class AudioHomeActivity :
if
(
err
==
0
||
err
==
18
)
{
return
}
Apm
.
reportEvent
(
"agora_android"
,
"occur_error"
,
"$err"
)
channelId
?.
let
{
YDLavManager
.
instances
.
callEndStatusUpdate
(
it
,
4
,
"频道的错误回调信息$err"
)
}
}
...
...
@@ -369,8 +371,8 @@ class AudioHomeActivity :
override
fun
onRtcStats
(
stats
:
IRtcEngineEventHandler
.
RtcStats
?)
{
super
.
onRtcStats
(
stats
)
writeAgoraLog
(
"声网onRtcStats:users:${stats?.users}"
)
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"声网onRtcStats:users:${stats?.users} channelId:${channelId}"
)
//
AliYunRichLogsHelper.getInstance()
//
.sendRichLog(AliYunLogConfig.AGORA, "声网onRtcStats:users:${stats?.users} channelId:${channelId}")
// 不需要移动端做离开房间逻辑,服务端会判断进行踢人逻辑
//因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断
// if (isConnectSuccess && null != stats?.users && stats.users == 1) {
...
...
@@ -388,6 +390,7 @@ class AudioHomeActivity :
override
fun
onConnectionStateChanged
(
state
:
Int
,
reason
:
Int
)
{
super
.
onConnectionStateChanged
(
state
,
reason
)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
Apm
.
reportEvent
(
"agora_android"
,
"rtc_connection_failure"
,
"$state,$reason"
)
if
(
reason
==
3
)
{
callEventSave
(
"50"
,
"通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason}"
)
writeAgoraLog
(
"通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})"
)
...
...
m-audioim/src/main/java/com/ydl/audioim/YDLavManager.kt
View file @
a518e9b8
...
...
@@ -166,7 +166,7 @@ class YDLavManager {
LogUtil
.
e
(
"[agora]呼叫${response?.calleeId}用户失败:${response?.response}"
)
AliYunRichLogsHelper
.
getInstance
().
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"呼叫${response?.calleeId}用户失败:${response?.response}"
"呼叫${response?.calleeId}用户失败:${response?.response}
,${errorCode}
"
)
val
dimension
=
hashMapOf
(
"call"
to
"call_fail"
,
...
...
@@ -432,7 +432,7 @@ class YDLavManager {
override
fun
onFailure
(
msg
:
String
?)
{
if
(
msg
!=
"LOGIN_ERR_ALREADY_LOGGED_IN"
)
{
Apm
.
report
Custom
(
"agora_login_error"
,
msg
?:
""
,
Exception
(
msg
)
)
Apm
.
report
Event
(
"rtm_android"
,
"connectionstate_error"
,
msg
?:
""
)
}
LogUtil
.
e
(
"[agora]实时消息登录失败:$msg"
)
writeAgoraLog
(
...
...
@@ -449,6 +449,7 @@ class YDLavManager {
}
})
}
else
{
Apm
.
reportEvent
(
"rtm_android"
,
"login_failure"
,
"${it.code},${it.msg}"
)
LogUtil
.
e
(
"声网token获取失败uid:"
+
userId
+
" error:"
+
it
.
msg
)
LogHelper
.
getInstance
()
.
writeLogSync
(
"声网token获取失败uid:"
+
userId
+
" error:"
+
it
.
msg
)
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchMessagePictureActivity.java
View file @
a518e9b8
...
...
@@ -345,12 +345,12 @@ public class WatchMessagePictureActivity extends UI {
@Override
public
void
onFailed
(
int
i
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
new
Exception
(
String
.
valueOf
(
i
))
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
i
);
}
@Override
public
void
onException
(
Throwable
throwable
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
throwable
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
throwable
.
getMessage
()
);
}
});
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchVideoActivity.java
View file @
a518e9b8
...
...
@@ -509,12 +509,12 @@ public class WatchVideoActivity extends UI implements Callback {
@Override
public
void
onFailed
(
int
i
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
new
Exception
(
String
.
valueOf
(
i
))
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
i
);
}
@Override
public
void
onException
(
Throwable
throwable
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
throwable
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
throwable
.
getMessage
()
);
}
});
downloading
=
true
;
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
View file @
a518e9b8
...
...
@@ -1367,7 +1367,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
public
void
onFailed
(
int
code
)
{
if
(
msg
!=
null
)
{
sendFailWithBlackList
(
code
,
msg
);
Apm
.
INSTANCE
.
report
Custom
(
"yx_sendmessage_error"
,
"sessionId:"
+
msg
.
getSessionId
(),
new
Exception
(
String
.
valueOf
(
code
))
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"sendmessage_error"
,
" 云信IM发送消息失败"
+
code
+
msg
);
}
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/module/list/MessageListPanelEx.java
View file @
a518e9b8
...
...
@@ -849,12 +849,12 @@ public class MessageListPanelEx {
@Override
public
void
onFailed
(
int
i
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
new
Exception
(
String
.
valueOf
(
i
))
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
i
);
}
@Override
public
void
onException
(
Throwable
throwable
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
throwable
)
;
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
throwable
.
getMessage
());
;
}
});
}
...
...
@@ -1163,8 +1163,7 @@ public class MessageListPanelEx {
@Override
public
void
onFailed
(
int
code
)
{
String
sessionId
=
item
.
getSessionId
();
Apm
.
INSTANCE
.
reportCustom
(
"yx_revoke_error"
,
"sessionId:"
+
sessionId
,
new
Exception
(
String
.
valueOf
(
code
)));
Apm
.
INSTANCE
.
reportEvent
(
"yxim_android"
,
"revoke_error"
,
"云信IM回撤消息失败"
+
code
);
if
(
code
==
ResponseCode
.
RES_OVERDUE
)
{
ToastHelper
.
showToast
(
container
.
activity
,
R
.
string
.
im_revoke_failed
);
}
else
{
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/viewholder/MsgViewHolderAudio.java
View file @
a518e9b8
...
...
@@ -82,12 +82,12 @@ public class MsgViewHolderAudio extends MsgViewHolderBase {
@Override
public
void
onFailed
(
int
i
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
new
Exception
(
String
.
valueOf
(
i
))
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
i
);
}
@Override
public
void
onException
(
Throwable
throwable
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
throwable
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
throwable
.
getMessage
()
);
}
});
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/viewholder/MsgViewHolderBase.java
View file @
a518e9b8
...
...
@@ -151,12 +151,12 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
@Override
public
void
onFailed
(
int
i
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
new
Exception
(
String
.
valueOf
(
i
))
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
i
);
}
@Override
public
void
onException
(
Throwable
throwable
)
{
Apm
.
INSTANCE
.
report
Custom
(
"yx_attchment_error"
,
""
,
throwable
);
Apm
.
INSTANCE
.
report
Event
(
"yxim_android"
,
"attchment_error"
,
"云信IM收取消息"
+
throwable
.
getMessage
()
);
}
});
}
...
...
m-user/src/main/java/com/yidianling/user/rxlogin/LoginObservable.kt
View file @
a518e9b8
...
...
@@ -73,7 +73,7 @@ class LoginObservable(val activity: Activity, private val media: SHARE_MEDIA): O
}
override
fun
onError
(
p0
:
SHARE_MEDIA
?,
p1
:
Int
,
p2
:
Throwable
?)
{
Apm
.
report
Custom
(
"login"
,
"third_auth_error"
,
p2
?:
Exception
(
"${p0},$p1"
)
)
Apm
.
report
Event
(
"login_android"
,
"third_auth_error"
,
"三方授权失败${p2?.message ?: p1}"
)
observer
?.
onError
(
p2
?:
Throwable
(
"未知异常"
))
}
...
...
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
View file @
a518e9b8
...
...
@@ -507,7 +507,7 @@ object OneKeyLoginHelp {
"一键登录失败 msg:${it.msg}"
)
ToastUtil
.
toastShort
(
it
.
msg
)
Apm
.
report
Custom
(
"login"
,
"oneKey_error"
,
Exception
(
"${it.code},${it.msg}"
)
)
Apm
.
report
Event
(
"login_android"
,
"oneKey_error"
,
"一键登录失败报错${it.code},${it.msg}"
)
mPhoneNumberAuthHelper
?.
hideLoginLoading
()
}
},
{
...
...
@@ -515,7 +515,7 @@ object OneKeyLoginHelp {
AliYunLogConfig
.
LOGIN
,
"一键登录Error msg:${it.message}"
)
Apm
.
report
Custom
(
"login"
,
"oneKey_error"
,
it
)
Apm
.
report
Event
(
"login_android"
,
"oneKey_error"
,
"一键登录失败报错${it.message}"
)
ToastUtil
.
toastShort
(
it
.
message
)
mPhoneNumberAuthHelper
?.
hideLoginLoading
()
})
...
...
@@ -527,7 +527,7 @@ object OneKeyLoginHelp {
}
override
fun
onTokenFailed
(
s
:
String
)
{
Apm
.
report
Custom
(
"login"
,
"oneKey_error"
,
Exception
(
"TokenFailed:${s}"
)
)
Apm
.
report
Event
(
"login_android"
,
"oneKey_error"
,
"一键登录失败TokenFailed:${s}"
)
LogUtil
.
e
(
"onTokenFailed"
+
s
)
mIsGetTokenSuccess
=
false
val
tokenRet
=
TokenRet
.
fromJson
(
s
)
...
...
m-user/src/main/java/com/yidianling/user/ui/login/presenter/InputPassWordPresenterImpl.kt
View file @
a518e9b8
...
...
@@ -115,12 +115,12 @@ class InputPassWordPresenterImpl :
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
LOGIN
,
"手机号密码 登录失败 msg: ${it.msg}"
)
ToastUtil
.
toastShort
(
it
.
msg
)
Apm
.
report
Custom
(
"login"
,
"password_error"
,
Exception
(
"密码登录失败,$phoneCountryCode-$phone"
)
)
Apm
.
report
Event
(
"login_android"
,
"password_error"
,
"密码登录失败,$phoneCountryCode-$phone"
)
mView
.
startAnim
()
}
else
{
if
(
it
.
data
.
userInfo
?.
user_type
==
2
)
{
mView
.
showNormalDialog
()
Apm
.
report
Custom
(
"login"
,
"isexpert"
,
Exception
(
"登录—专家帐号,$phoneCountryCode-$phone"
)
)
Apm
.
report
Event
(
"login_android"
,
"isexpert"
,
"登录—专家帐号,$phoneCountryCode-$phone"
)
}
else
{
saveUserData
(
it
.
data
)
if
(
it
.
data
.
firstLogin
==
1
)
{
//第一次登录:是注册
...
...
@@ -140,7 +140,7 @@ class InputPassWordPresenterImpl :
}
},
{
YdlCommonOut
.
showToast
(
it
.
message
!!
)
Apm
.
report
Custom
(
"login"
,
"password_error"
,
it
)
Apm
.
report
Event
(
"login_android"
,
"password_error"
,
"密码登录失败${it.message}"
)
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
LOGIN
,
"手机号密码 Error msg: ${it.message}"
)
...
...
m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
View file @
a518e9b8
...
...
@@ -168,7 +168,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
if
(
it
.
data
.
isRegistered
==
1
)
{
mView
.
showLoading
(
false
)
mView
.
showHasBindedDialog
()
Apm
.
report
Custom
(
"login"
,
"mobile_isbind"
,
Exception
(
"登录-手机被绑定,$countryCode-$phone"
)
)
Apm
.
report
Event
(
"login_android"
,
"mobile_isbind"
,
"登录-手机被绑定,$countryCode-$phone"
)
}
else
{
mView
.
checkPhoneStatusSuccess
(
it
.
data
,
phone
)
}
...
...
@@ -176,7 +176,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
if
(
it
.
data
.
isDoctor
==
1
)
{
//是专家账号
mView
.
showLoading
(
false
)
mView
.
showNormalDialog
()
Apm
.
report
Custom
(
"login"
,
"isexpert"
,
Exception
(
"登录—专家帐号,$countryCode-$phone"
)
)
Apm
.
report
Event
(
"login_android"
,
"isexpert"
,
"登录—专家帐号,$countryCode-$phone"
)
}
else
{
mView
.
checkPhoneStatusSuccess
(
it
.
data
,
phone
)
}
...
...
@@ -214,7 +214,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
.
subscribe
({
mView
.
dismissProgressView
()
if
(
it
?.
data
==
null
)
{
Apm
.
report
Custom
(
"login"
,
"third_login_error"
,
Exception
(
"${it.code},${it.msg}"
)
)
Apm
.
report
Event
(
"login_android"
,
"third_login_error"
,
"三方登录失败${it.code},${it.msg}"
)
ToastUtil
.
toastShort
(
it
.
msg
)
return
@subscribe
}
...
...
@@ -268,7 +268,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
},
{
mView
.
dismissProgressView
()
Apm
.
report
Custom
(
"login"
,
"third_login_error"
,
it
)
Apm
.
report
Event
(
"login"
,
"third_login_error"
,
it
.
message
?:
""
)
YdlCommonOut
.
showToast
(
it
.
message
!!
)
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
LOGIN
,
media
.
getName
()
+
"登录失败"
)
...
...
m-user/src/main/java/com/yidianling/user/ui/login/presenter/VerificationCodePresenterImpl.kt
View file @
a518e9b8
...
...
@@ -47,12 +47,12 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
mView
.
startCountdown
(
60
)
}
else
{
mView
.
startAnim
()
Apm
.
report
Custom
(
"login"
,
"getcode_error"
,
Exception
(
"${phone},${it.code},${it.msg}"
)
)
Apm
.
report
Event
(
"login_android"
,
"getcode_error"
,
"获取验证码失败${phone},${it.code},${it.msg}"
)
ToastUtil
.
toastShort
(
it
.
msg
)
}
},
{
mView
.
startAnim
()
Apm
.
report
Custom
(
"login"
,
"getcode_error"
,
it
)
Apm
.
report
Event
(
"login"
,
"getcode_error"
,
"获取验证码失败${it.message}"
)
ToastUtil
.
toastShort
(
it
.
message
)
})
}
...
...
@@ -115,13 +115,13 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
}
else
{
ToastUtil
.
toastShort
(
it
.
msg
)
//服务端返回{验证码错误&异常}信息
// mView.startAnim()
Apm
.
report
Custom
(
"login"
,
"bind_mobile_error"
,
Exception
(
"${param.countryCode}-${param.phoneNumber},${it.code},${it.msg}"
)
)
Apm
.
report
Event
(
"login_android"
,
"bind_mobile_error"
,
" 手机号绑定失败${param.countryCode}-${param.phoneNumber},${it.code},${it.msg}"
)
mView
.
verificationErrorCode
()
}
},
{
// mView.startAnim()
mView
.
verificationErrorCode
()
Apm
.
report
Custom
(
"login"
,
"bind_mobile_error"
,
it
)
Apm
.
report
Event
(
"login_android"
,
"bind_mobile_error"
,
" 手机号绑定失败${param.countryCode}-${param.phoneNumber},${it.message}"
)
ToastUtil
.
toastShort
(
it
.
message
)
})
...
...
@@ -193,12 +193,12 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
}
else
{
ToastUtil
.
toastShort
(
it
.
msg
)
//服务端返回{验证码错误&异常}信息
// mView.startAnim()
Apm
.
report
Custom
(
"login"
,
"code_error"
,
Exception
(
"${phoneCountryCode}-${phone},${it.code},${it.msg}"
)
)
Apm
.
report
Event
(
"login_android"
,
"code_error"
,
"验证码登录失败${phoneCountryCode}-${phone},${it.code},${it.msg}"
)
mView
.
verificationErrorCode
()
}
},
{
mView
.
startAnim
()
Apm
.
report
Custom
(
"login"
,
"code_error"
,
it
)
Apm
.
report
Event
(
"login"
,
"code_error"
,
it
.
message
?:
""
)
ToastUtil
.
toastShort
(
it
.
message
)
})
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/app/ApmInit.kt
View file @
a518e9b8
...
...
@@ -4,9 +4,11 @@ import android.content.Context
import
com.apm.insight.MonitorCrash
import
com.apm.insight.log.VLog
import
com.bytedance.apm.insight.ApmInsight
import
com.bytedance.apm.insight.ApmInsightAgent
import
com.bytedance.apm.insight.ApmInsightInitConfig
import
com.bytedance.apm.insight.IDynamicParams
import
com.meituan.android.walle.WalleChannelReader
import
org.json.JSONObject
object
Apm
{
...
...
@@ -46,6 +48,33 @@ object Apm {
crash
?.
reportCustomErr
(
msg
,
type
,
throwable
)
}
}
fun
reportEvent
(
event
:
String
,
dimension
:
String
,
value
:
String
)
{
try
{
if
(
hasInit
)
{
val
d
=
hashMapOf
(
dimension
to
value
)
ApmInsightAgent
.
monitorEvent
(
event
,
d
,
hashMapOf
())
}
}
catch
(
throwable
:
Throwable
)
{
VLog
.
e
(
"reportEvent"
,
throwable
.
message
)
}
}
fun
reportEventWithExt
(
event
:
String
,
dimension
:
String
,
value
:
String
,
ext
:
Map
<
String
,
String
>)
{
try
{
if
(
hasInit
)
{
val
d
=
hashMapOf
(
dimension
to
value
)
if
(
ext
.
isNotEmpty
())
{
val
json
=
JSONObject
(
ext
)
ApmInsightAgent
.
monitorEvent
(
event
,
d
,
hashMapOf
(),
json
)
}
else
{
ApmInsightAgent
.
monitorEvent
(
event
,
d
,
hashMapOf
())
}
}
}
catch
(
throwable
:
Throwable
)
{
VLog
.
e
(
"reportEvent"
,
throwable
.
message
)
}
}
}
private
class
ApmParams
(
val
crash
:
MonitorCrash
?,
val
uidCall
:
()
->
String
?)
:
IDynamicParams
()
{
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
a518e9b8
...
...
@@ -194,16 +194,16 @@ class HttpConfig {
val
message
=
resp
.
message
()
val
api
=
req
.
url
().
encodedPath
()
if
(!
resp
.
isSuccessful
)
{
Apm
.
report
Custom
(
"network_request_error"
,
"${api}(${code},${message})"
,
Exception
(
"${api}(${code},${message})"
))
Apm
.
report
EventWithExt
(
"network_api"
,
"resp_fail"
,
api
,
mapOf
(
"code"
to
code
.
toString
(),
"msg"
to
message
))
}
else
{
try
{
val
body
=
resp
.
body
()
?:
return
@Interceptor
resp
val
buffer
=
body
.
source
().
buffer
()
if
(!
isPlaintext
(
buffer
))
return
@Interceptor
resp
if
(!
isPlaintext
(
buffer
))
return
@Interceptor
resp
val
readString
=
buffer
.
clone
().
readString
(
Charset
.
forName
(
"UTF-8"
))
val
fromJson
=
Gson
().
fromJson
<
BaseAPIResponse
<
Any
>>(
readString
,
BaseAPIResponse
::
class
.
java
)
if
(
fromJson
.
code
!=
"200"
&&
fromJson
.
code
!=
"0"
)
{
Apm
.
report
Custom
(
"network_business_error"
,
"${api}(${fromJson.code},${fromJson.msg})"
,
Exception
(
"${api}(${fromJson.code},${fromJson.msg})"
))
Apm
.
report
EventWithExt
(
"network_api"
,
"business_fail"
,
api
,
mapOf
(
"code"
to
code
.
toString
(),
"msg"
to
message
))
}
}
catch
(
throwable
:
Throwable
)
{
LogUtil
.
e
(
throwable
.
message
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment