Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
fcf2b9e4
S
SkyWalking
项目概览
阿信在这里
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / SkyWalking
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fcf2b9e4
编写于
12月 11, 2016
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复部分问题
上级
ce81b2ee
变更
45
显示空白变更内容
内联
并排
Showing
45 changed file
with
702 addition
and
492 deletion
+702
-492
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/conf/Config.java
...src/main/java/com/a/eye/skywalking/alarm/conf/Config.java
+21
-10
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/model/AlarmType.java
...main/java/com/a/eye/skywalking/alarm/model/AlarmType.java
+41
-30
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/model/ApplicationInfo.java
...ava/com/a/eye/skywalking/alarm/model/ApplicationInfo.java
+0
-12
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/procesor/AlarmMessageProcessor.java
.../eye/skywalking/alarm/procesor/AlarmMessageProcessor.java
+185
-186
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/util/AlarmTypeUtil.java
...n/java/com/a/eye/skywalking/alarm/util/AlarmTypeUtil.java
+25
-29
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/util/MailSender.java
...main/java/com/a/eye/skywalking/alarm/util/MailSender.java
+31
-27
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/util/TemplateConfigurationUtil.java
.../eye/skywalking/alarm/util/TemplateConfigurationUtil.java
+1
-1
skywalking-alarm/src/main/resources/config.properties
skywalking-alarm/src/main/resources/config.properties
+16
-10
skywalking-commons/pom.xml
skywalking-commons/pom.xml
+1
-0
skywalking-commons/skywalking-logging/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/api/ILog.java
.../src/main/java/com/a/eye/skywalking/logging/api/ILog.java
+2
-0
skywalking-commons/skywalking-logging/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/api/NoopLogger.java
...ain/java/com/a/eye/skywalking/logging/api/NoopLogger.java
+5
-0
skywalking-commons/skywalking-logging/skywalking-logging-impl-log4j2/src/main/java/com/a/eye/skywalking/logging/impl/log4j2/Log4j2Logger.java
...om/a/eye/skywalking/logging/impl/log4j2/Log4j2Logger.java
+5
-0
skywalking-commons/skywalking-util/pom.xml
skywalking-commons/skywalking-util/pom.xml
+27
-0
skywalking-commons/skywalking-util/src/main/java/com/a/eye/skywalking/util/StringUtil.java
...l/src/main/java/com/a/eye/skywalking/util/StringUtil.java
+0
-0
skywalking-commons/skywalking-util/src/main/java/com/a/eye/skywalking/util/TraceIdUtil.java
.../src/main/java/com/a/eye/skywalking/util/TraceIdUtil.java
+17
-0
skywalking-network/src/main/proto/Spans.proto
skywalking-network/src/main/proto/Spans.proto
+15
-14
skywalking-sniffer/pom.xml
skywalking-sniffer/pom.xml
+7
-1
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/logging/EasyLogger.java
...rc/main/java/com/a/eye/skywalking/logging/EasyLogger.java
+5
-0
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/PluginCfg.java
.../src/main/java/com/a/eye/skywalking/plugin/PluginCfg.java
+2
-2
skywalking-storage-center/skywalking-storage/pom.xml
skywalking-storage-center/skywalking-storage/pom.xml
+10
-0
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/SpanAlarmHandler.java
.../com/a/eye/skywalking/storage/alarm/SpanAlarmHandler.java
+3
-3
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/checker/FatalReason.java
...m/a/eye/skywalking/storage/alarm/checker/FatalReason.java
+10
-1
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/sender/AlarmMessageSender.java
...e/skywalking/storage/alarm/sender/AlarmMessageSender.java
+20
-3
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/sender/AlarmRedisConnector.java
.../skywalking/storage/alarm/sender/AlarmRedisConnector.java
+121
-0
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/config/Config.java
...main/java/com/a/eye/skywalking/storage/config/Config.java
+15
-0
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/index/IndexMetaInfo.java
...om/a/eye/skywalking/storage/data/index/IndexMetaInfo.java
+1
-1
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/AckSpanData.java
...m/a/eye/skywalking/storage/data/spandata/AckSpanData.java
+5
-1
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/RequestSpanData.java
...eye/skywalking/storage/data/spandata/RequestSpanData.java
+15
-1
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/SpanData.java
.../com/a/eye/skywalking/storage/data/spandata/SpanData.java
+1
-1
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/SpanDataHelper.java
.../eye/skywalking/storage/data/spandata/SpanDataHelper.java
+6
-5
skywalking-storage-center/skywalking-storage/src/test/java/com/a/eye/skywalking/storage/alarm/SpanAlarmHandlerTest.java
.../a/eye/skywalking/storage/alarm/SpanAlarmHandlerTest.java
+4
-4
skywalking-webui/pom.xml
skywalking-webui/pom.xml
+6
-0
skywalking-webui/src/main/java/com/a/eye/skywalking/web/client/routing/SearchClient.java
...com/a/eye/skywalking/web/client/routing/SearchClient.java
+1
-1
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/AlarmRuleMaintainController.java
...kywalking/web/controller/AlarmRuleMaintainController.java
+2
-2
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/ApplicationConfigController.java
...kywalking/web/controller/ApplicationConfigController.java
+4
-4
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/SearchController.java
...com/a/eye/skywalking/web/controller/SearchController.java
+2
-2
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/UserMaintainController.java
...eye/skywalking/web/controller/UserMaintainController.java
+3
-3
skywalking-webui/src/main/java/com/a/eye/skywalking/web/dao/impl/TraceNodeDao.java
.../java/com/a/eye/skywalking/web/dao/impl/TraceNodeDao.java
+35
-25
skywalking-webui/src/main/java/com/a/eye/skywalking/web/dto/FullSpan.java
.../src/main/java/com/a/eye/skywalking/web/dto/FullSpan.java
+15
-9
skywalking-webui/src/main/java/com/a/eye/skywalking/web/dto/TraceNodeInfo.java
...main/java/com/a/eye/skywalking/web/dto/TraceNodeInfo.java
+13
-5
skywalking-webui/src/main/java/com/a/eye/skywalking/web/service/impl/TraceTreeService.java
...m/a/eye/skywalking/web/service/impl/TraceTreeService.java
+1
-5
skywalking-webui/src/main/java/com/a/eye/skywalking/web/util/SortUtil.java
...src/main/java/com/a/eye/skywalking/web/util/SortUtil.java
+0
-61
skywalking-webui/src/main/java/com/a/eye/skywalking/web/util/StringUtil.java
...c/main/java/com/a/eye/skywalking/web/util/StringUtil.java
+0
-11
skywalking-webui/src/main/resources/jdbc.properties
skywalking-webui/src/main/resources/jdbc.properties
+3
-3
skywalking-webui/src/main/sql/table.mysql
skywalking-webui/src/main/sql/table.mysql
+0
-19
未找到文件。
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/conf/Config.java
浏览文件 @
fcf2b9e4
...
@@ -14,12 +14,10 @@ public class Config {
...
@@ -14,12 +14,10 @@ public class Config {
public
static
class
ProcessThread
{
public
static
class
ProcessThread
{
public
static
long
THREAD_WAIT_INTERVAL
=
60
*
1000L
;
public
static
long
THREAD_WAIT_INTERVAL
=
60
*
1000L
;
// public static long THREAD_WAIT_INTERVAL = 5 * 1000L;
}
}
public
static
class
ZKPath
{
public
static
class
ZKPath
{
public
static
String
CONNECT_STR
=
"127.0.0.1:2181"
;
public
static
String
CONNECT_STR
=
"127.0.0.1:2181"
;
public
static
int
CONNECT_TIMEOUT
=
1000
;
public
static
int
CONNECT_TIMEOUT
=
1000
;
...
@@ -49,13 +47,13 @@ public class Config {
...
@@ -49,13 +47,13 @@ public class Config {
public
static
class
DB
{
public
static
class
DB
{
public
static
String
PASSWORD
=
"
devrdbusr21
"
;
public
static
String
PASSWORD
=
"
root
"
;
public
static
String
USER_NAME
=
"
devrdbusr21
"
;
public
static
String
USER_NAME
=
"
root
"
;
public
static
String
DRIVER_CLASS
=
"com.mysql.jdbc.Driver"
;
public
static
String
DRIVER_CLASS
=
"com.mysql.jdbc.Driver"
;
public
static
String
URL
=
"jdbc:mysql://1
0.1.228.202:31
316/test"
;
public
static
String
URL
=
"jdbc:mysql://1
27.0.0.1:3
316/test"
;
public
static
int
MAX_IDLE
=
1
;
public
static
int
MAX_IDLE
=
1
;
...
@@ -84,14 +82,27 @@ public class Config {
...
@@ -84,14 +82,27 @@ public class Config {
public
static
boolean
ALARM_OFF_FLAG
=
false
;
public
static
boolean
ALARM_OFF_FLAG
=
false
;
public
static
String
ALARM_TYPE_CONFIG_ID
=
"1004"
;
}
}
public
static
class
MailSenderInfo
{
public
static
class
MailSenderInfo
{
public
static
String
configId
=
"1000"
;
public
static
String
MAIL_HOST
=
"mail.com"
;
public
static
String
TRANSPORT_PROTOCOL
=
"smtp"
;
public
static
boolean
SMTP_AUTH
=
true
;
public
static
boolean
SSL_ENABLE
=
false
;
public
static
String
USERNAME
=
"username"
;
public
static
String
PASSWORD
=
"password"
;
public
static
String
SENDER
=
"sender@mail.com"
;
}
}
public
static
class
TemplateInfo
{
public
static
class
TemplateInfo
{
public
static
String
CONFIG_ID
=
"1001
"
;
public
static
String
PORTAL_URL
=
"http://127.0.0.1:8080/skywalking
"
;
}
}
}
}
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/model/AlarmType.java
浏览文件 @
fcf2b9e4
...
@@ -10,6 +10,12 @@ public class AlarmType {
...
@@ -10,6 +10,12 @@ public class AlarmType {
//告警描述
//告警描述
private
String
desc
;
private
String
desc
;
public
AlarmType
(
String
type
,
String
label
,
String
desc
)
{
this
.
type
=
type
;
this
.
label
=
label
;
this
.
desc
=
desc
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"AlarmType [type="
+
type
+
", label="
+
label
+
", desc="
+
desc
+
"]"
;
return
"AlarmType [type="
+
type
+
", label="
+
label
+
", desc="
+
desc
+
"]"
;
...
@@ -18,18 +24,23 @@ public class AlarmType {
...
@@ -18,18 +24,23 @@ public class AlarmType {
public
String
getType
()
{
public
String
getType
()
{
return
type
;
return
type
;
}
}
public
void
setType
(
String
type
)
{
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
this
.
type
=
type
;
}
}
public
String
getLabel
()
{
public
String
getLabel
()
{
return
label
;
return
label
;
}
}
public
void
setLabel
(
String
label
)
{
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
;
this
.
label
=
label
;
}
}
public
String
getDesc
()
{
public
String
getDesc
()
{
return
desc
;
return
desc
;
}
}
public
void
setDesc
(
String
desc
)
{
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
this
.
desc
=
desc
;
}
}
...
...
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/model/ApplicationInfo.java
浏览文件 @
fcf2b9e4
...
@@ -2,7 +2,6 @@ package com.a.eye.skywalking.alarm.model;
...
@@ -2,7 +2,6 @@ package com.a.eye.skywalking.alarm.model;
public
class
ApplicationInfo
{
public
class
ApplicationInfo
{
private
String
appId
;
private
String
appId
;
private
String
configArgs
;
private
String
UId
;
private
String
UId
;
private
String
toDoType
;
private
String
toDoType
;
private
String
appCode
;
private
String
appCode
;
...
@@ -19,9 +18,6 @@ public class ApplicationInfo {
...
@@ -19,9 +18,6 @@ public class ApplicationInfo {
this
.
appId
=
appId
;
this
.
appId
=
appId
;
}
}
public
String
getConfigArgs
()
{
return
configArgs
;
}
public
void
setUId
(
String
UId
)
{
public
void
setUId
(
String
UId
)
{
this
.
UId
=
UId
;
this
.
UId
=
UId
;
...
@@ -31,14 +27,6 @@ public class ApplicationInfo {
...
@@ -31,14 +27,6 @@ public class ApplicationInfo {
return
UId
;
return
UId
;
}
}
public
void
setToDoType
(
String
toDoType
)
{
this
.
toDoType
=
toDoType
;
}
public
String
getToDoType
()
{
return
toDoType
;
}
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
return
true
;
...
...
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/procesor/AlarmMessageProcessor.java
浏览文件 @
fcf2b9e4
...
@@ -18,9 +18,9 @@ import com.a.eye.skywalking.alarm.model.AlarmRule;
...
@@ -18,9 +18,9 @@ import com.a.eye.skywalking.alarm.model.AlarmRule;
import
com.a.eye.skywalking.alarm.model.AlarmType
;
import
com.a.eye.skywalking.alarm.model.AlarmType
;
import
com.a.eye.skywalking.alarm.model.ApplicationInfo
;
import
com.a.eye.skywalking.alarm.model.ApplicationInfo
;
import
com.a.eye.skywalking.alarm.model.MailInfo
;
import
com.a.eye.skywalking.alarm.model.MailInfo
;
import
com.a.eye.skywalking.alarm.util.MailSender
;
import
com.a.eye.skywalking.alarm.util.RedisUtil
;
import
com.a.eye.skywalking.alarm.util.RedisUtil
;
import
com.a.eye.skywalking.alarm.util.TemplateConfigurationUtil
;
import
com.a.eye.skywalking.alarm.util.TemplateConfigurationUtil
;
import
com.a.eye.skywalking.alarm.util.MailUtil
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -61,12 +61,11 @@ public class AlarmMessageProcessor {
...
@@ -61,12 +61,11 @@ public class AlarmMessageProcessor {
for
(
AlarmType
alarmType
:
alarmTypeList
)
{
for
(
AlarmType
alarmType
:
alarmTypeList
)
{
String
type
=
alarmType
.
getType
();
String
type
=
alarmType
.
getType
();
List
<
AlarmMessage
>
warningObjects
=
new
ArrayList
<
AlarmMessage
>();
List
<
AlarmMessage
>
warningObjects
=
new
ArrayList
<
AlarmMessage
>();
for
(
ApplicationInfo
applicationInfo
:
rule
for
(
ApplicationInfo
applicationInfo
:
rule
.
getApplicationInfos
())
{
.
getApplicationInfos
())
{
for
(
int
period
=
0
;
period
<
warningTimeWindowSize
;
period
++)
{
for
(
int
period
=
0
;
period
<
warningTimeWindowSize
;
period
++)
{
Long
currentMinuteTime
=
currentFireMinuteTime
-
period
Long
currentMinuteTime
=
currentFireMinuteTime
-
period
-
1
;
-
1
;
String
alarmKey
=
userInfo
.
getUserId
()
+
"-"
String
alarmKey
=
userInfo
.
getUserName
()
+
"-"
+
applicationInfo
.
getAppCode
()
+
"-"
+
applicationInfo
.
getAppCode
()
+
"-"
+
currentMinuteTime
;
+
currentMinuteTime
;
if
(!
TYPE_OF_EXCEPTION_WARNING
.
equals
(
type
))
{
if
(!
TYPE_OF_EXCEPTION_WARNING
.
equals
(
type
))
{
...
@@ -110,7 +109,7 @@ public class AlarmMessageProcessor {
...
@@ -110,7 +109,7 @@ public class AlarmMessageProcessor {
if
(
mailContext
.
length
()
>
0
)
{
if
(
mailContext
.
length
()
>
0
)
{
MailInfo
mailInfo
=
rule
.
getConfigArgsDescriber
()
MailInfo
mailInfo
=
rule
.
getConfigArgsDescriber
()
.
getMailInfo
();
.
getMailInfo
();
MailUtil
.
sendMail
(
mailInfo
.
getMailTo
(),
MailSender
.
send
(
mailInfo
.
getMailTo
(),
mailInfo
.
getMailCc
(),
mailContext
,
subjects
);
mailInfo
.
getMailCc
(),
mailContext
,
subjects
);
}
}
}
}
...
...
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/util/AlarmTypeUtil.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.alarm.util
;
package
com.a.eye.skywalking.alarm.util
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.a.eye.skywalking.alarm.dao.SystemConfigDao
;
import
com.a.eye.skywalking.alarm.model.AlarmType
;
import
com.a.eye.skywalking.alarm.model.AlarmType
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
com.a.eye.skywalking.alarm.conf.Config
;
import
java.util.ArrayList
;
import
com.google.gson.Gson
;
import
java.util.List
;
import
com.google.gson.reflect.TypeToken
;
public
class
AlarmTypeUtil
{
public
class
AlarmTypeUtil
{
...
@@ -19,9 +14,10 @@ public class AlarmTypeUtil {
...
@@ -19,9 +14,10 @@ public class AlarmTypeUtil {
static
{
static
{
try
{
try
{
String
typeInfo
=
SystemConfigDao
.
getSystemConfig
(
Config
.
Alarm
.
ALARM_TYPE_CONFIG_ID
);
alarmTypeList
=
new
ArrayList
<
AlarmType
>();
alarmTypeList
=
new
Gson
().
fromJson
(
typeInfo
,
new
TypeToken
<
ArrayList
<
AlarmType
>>()
{
alarmTypeList
.
add
(
new
AlarmType
(
"default"
,
"exception"
,
"System Exception"
));
}.
getType
());
alarmTypeList
.
add
(
new
AlarmType
(
"ExecuteTime-PossibleError"
,
"remark"
,
"Excution Time > 5s"
));
alarmTypeList
.
add
(
new
AlarmType
(
"ExecuteTime-Warning"
,
"remark"
,
"Excution Time > 500ms"
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"Failed to load alarm type info."
,
e
);
logger
.
error
(
"Failed to load alarm type info."
,
e
);
System
.
exit
(-
1
);
System
.
exit
(-
1
);
...
...
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/util/Mail
Util
.java
→
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/util/Mail
Sender
.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.alarm.util
;
package
com.a.eye.skywalking.alarm.util
;
import
java.util.Properties
;
import
javax.mail.Message
;
import
javax.mail.MessagingException
;
import
javax.mail.NoSuchProviderException
;
import
javax.mail.Session
;
import
javax.mail.Transport
;
import
javax.mail.internet.AddressException
;
import
javax.mail.internet.InternetAddress
;
import
javax.mail.internet.MimeMessage
;
import
com.a.eye.skywalking.alarm.conf.Config
;
import
com.a.eye.skywalking.alarm.conf.Config
;
import
com.
a.eye.skywalking.alarm.dao.SystemConfigDao
;
import
com.
sun.mail.util.MailSSLSocketFactory
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
com.google.gson.Gson
;
import
javax.mail.*
;
import
javax.mail.internet.AddressException
;
public
class
MailUtil
{
import
javax.mail.internet.InternetAddress
;
import
javax.mail.internet.MimeMessage
;
import
java.util.Properties
;
private
static
Logger
logger
=
LogManager
.
getLogger
(
MailUtil
.
class
);
public
class
MailSender
{
private
static
String
mailSender
;
private
static
Logger
logger
=
LogManager
.
getLogger
(
MailSender
.
class
);
private
static
Properties
config
;
private
static
MailSender
sender
=
new
MailSender
();
private
String
mailSender
;
private
Properties
config
;
static
{
private
MailSender
()
{
try
{
try
{
String
senderInfo
=
SystemConfigDao
.
getSystemConfig
(
Config
.
MailSenderInfo
.
configId
);
config
=
new
Properties
();
config
=
new
Gson
().
fromJson
(
senderInfo
,
Properties
.
class
);
mailSender
=
config
.
getProperty
(
"mail.sender"
);
config
.
setProperty
(
"mail.transport.protocol"
,
Config
.
MailSenderInfo
.
TRANSPORT_PROTOCOL
);
config
.
setProperty
(
"mail.smtp.auth"
,
String
.
valueOf
(
Config
.
MailSenderInfo
.
SMTP_AUTH
));
config
.
setProperty
(
"mail.smtp.socketFactory.port"
,
"465"
);
config
.
setProperty
(
"mail.debug"
,
"true"
);
//config.setProperty("mail.smtp.ssl.enable", "true");
if
(
Config
.
MailSenderInfo
.
SSL_ENABLE
)
{
MailSSLSocketFactory
sf
=
new
MailSSLSocketFactory
();
sf
.
setTrustAllHosts
(
true
);
config
.
put
(
"mail.smtp.ssl.enable"
,
"true"
);
config
.
put
(
"mail.smtp.ssl.socketFactory"
,
sf
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"Failed to load mail sender info."
,
e
);
logger
.
error
(
"Failed to load mail sender info."
,
e
);
System
.
exit
(-
1
);
System
.
exit
(-
1
);
}
}
mailSender
=
Config
.
MailSenderInfo
.
SENDER
;
}
}
public
static
void
send
Mail
(
String
[]
recipientAccounts
,
String
[]
ccList
,
String
content
,
String
title
)
{
public
static
void
send
(
String
[]
recipientAccounts
,
String
[]
ccList
,
String
content
,
String
title
)
{
Session
session
=
Session
.
getInstance
(
config
);
Session
session
=
Session
.
getInstance
(
sender
.
config
);
Transport
ts
=
null
;
Transport
ts
=
null
;
try
{
try
{
ts
=
session
.
getTransport
();
ts
=
session
.
getTransport
();
ts
.
connect
(
config
.
getProperty
(
"mail.host"
),
config
.
getProperty
(
"mail.username"
),
config
.
getProperty
(
"mail.password"
)
);
ts
.
connect
(
Config
.
MailSenderInfo
.
MAIL_HOST
,
Config
.
MailSenderInfo
.
USERNAME
,
Config
.
MailSenderInfo
.
PASSWORD
);
MimeMessage
message
=
new
MimeMessage
(
session
);
MimeMessage
message
=
new
MimeMessage
(
session
);
message
.
setFrom
(
new
InternetAddress
(
mailSender
));
message
.
setFrom
(
new
InternetAddress
(
sender
.
mailSender
));
InternetAddress
[]
recipientAccountArray
=
new
InternetAddress
[
recipientAccounts
.
length
];
InternetAddress
[]
recipientAccountArray
=
new
InternetAddress
[
recipientAccounts
.
length
];
for
(
int
i
=
0
;
i
<
recipientAccounts
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
recipientAccounts
.
length
;
i
++)
{
recipientAccountArray
[
i
]
=
new
InternetAddress
(
recipientAccounts
[
i
]);
recipientAccountArray
[
i
]
=
new
InternetAddress
(
recipientAccounts
[
i
]);
...
@@ -59,7 +64,6 @@ public class MailUtil {
...
@@ -59,7 +64,6 @@ public class MailUtil {
}
}
message
.
setSubject
(
title
);
message
.
setSubject
(
title
);
message
.
setContent
(
content
,
"text/html;charset=UTF-8"
);
message
.
setContent
(
content
,
"text/html;charset=UTF-8"
);
ts
.
sendMessage
(
message
,
message
.
getAllRecipients
());
ts
.
sendMessage
(
message
,
message
.
getAllRecipients
());
}
catch
(
AddressException
e
)
{
}
catch
(
AddressException
e
)
{
...
...
skywalking-alarm/src/main/java/com/a/eye/skywalking/alarm/util/TemplateConfigurationUtil.java
浏览文件 @
fcf2b9e4
...
@@ -19,7 +19,7 @@ public class TemplateConfigurationUtil {
...
@@ -19,7 +19,7 @@ public class TemplateConfigurationUtil {
if
(
cfg
==
null
)
{
if
(
cfg
==
null
)
{
cfg
=
new
Configuration
(
new
Version
(
"2.3.23"
));
cfg
=
new
Configuration
(
new
Version
(
"2.3.23"
));
cfg
.
setDefaultEncoding
(
"UTF-8"
);
cfg
.
setDefaultEncoding
(
"UTF-8"
);
cfg
.
setSharedVariable
(
"portalAddr"
,
SystemConfigDao
.
getSystemConfig
(
Config
.
TemplateInfo
.
CONFIG_ID
)
);
cfg
.
setSharedVariable
(
"portalAddr"
,
Config
.
TemplateInfo
.
PORTAL_URL
);
//获取资源路径
//获取资源路径
String
classPath
=
cfg
.
getClass
().
getResource
(
"/"
).
getFile
().
toString
();
String
classPath
=
cfg
.
getClass
().
getResource
(
"/"
).
getFile
().
toString
();
...
...
skywalking-alarm/src/main/resources/config.properties
浏览文件 @
fcf2b9e4
...
@@ -9,7 +9,7 @@ server.alarm_rule_activity_interval=3600000
...
@@ -9,7 +9,7 @@ server.alarm_rule_activity_interval=3600000
processthread.thread_wait_interval
=
5000
processthread.thread_wait_interval
=
5000
#zookeeper连接地址
#zookeeper连接地址
zkpath.connect_str
=
1
0.1.241.18:29181,10.1.241.19:29181,10.1.241.20:29
181
zkpath.connect_str
=
1
27.0.0.1:2
181
#zookeeper连接超时时间(单位:毫秒)
#zookeeper连接超时时间(单位:毫秒)
zkpath.connect_timeout
=
1000
zkpath.connect_timeout
=
1000
#zookeeper重试次数
#zookeeper重试次数
...
@@ -35,11 +35,11 @@ coordinator.check_all_process_thread_interval=500
...
@@ -35,11 +35,11 @@ coordinator.check_all_process_thread_interval=500
#数据库驱动类
#数据库驱动类
db.driver_class
=
com.mysql.jdbc.Driver
db.driver_class
=
com.mysql.jdbc.Driver
#数据库连接地址
#数据库连接地址
db.url
=
jdbc:mysql://
10.1.241.20:31306/sw_db
db.url
=
jdbc:mysql://
localhost:3307/test
#数据库用户名
#数据库用户名
db.user_name
=
sw_dbusr01
db.user_name
=
root
#数据库密码
#数据库密码
db.password
=
sw_dbusr01
db.password
=
root
#数据库连接最大空闲数
#数据库连接最大空闲数
db.max_idle
=
1
db.max_idle
=
1
#数据库最大连接数
#数据库最大连接数
...
@@ -48,7 +48,7 @@ db.max_pool_size=20
...
@@ -48,7 +48,7 @@ db.max_pool_size=20
db.connect_timeout
=
10000
db.connect_timeout
=
10000
#告警信息存在的redis服务器地址
#告警信息存在的redis服务器地址
alarm.redis_server
=
1
0.1.241.18:1
6379
alarm.redis_server
=
1
27.0.0.1:
6379
#redis的最大空闲连接数
#redis的最大空闲连接数
alarm.redis_max_idle
=
20
alarm.redis_max_idle
=
20
#redis的最小空闲连接数
#redis的最小空闲连接数
...
@@ -61,15 +61,21 @@ alarm.alarm_off_flag=false
...
@@ -61,15 +61,21 @@ alarm.alarm_off_flag=false
alarm.checker.turn_on_exception_checker
=
true
alarm.checker.turn_on_exception_checker
=
true
#告警检查器:执行时间超时告警检查
#告警检查器:执行时间超时告警检查
alarm.checker.turn_on_execute_time_checker
=
true
alarm.checker.turn_on_execute_time_checker
=
true
#告警类型配置id
alarm.alarm_type_config_id
=
1004
#邮件发送配置id
#邮件发送配置id
mailsenderinfo.configid
=
1000
mailsenderinfo.mail_host
=
smtp.qq.com
mailsenderinfo.transport_protocol
=
smtp
mailsenderinfo.smtp_auth
=
true
mailsenderinfo.smtp_start_ssl_enable
=
false
mailsenderinfo.username
=
skywalking
mailsenderinfo.password
=
skywalking
mailsenderinfo.sender
=
skywalking@foxmail.com
mailsenderinfo.ssl_enable
=
true
#邮件模板配置id
#邮件模板配置id
templateinfo.
config_id
=
1001
templateinfo.
portal_url
=
http://127.0.0.1:8080/skywalking
#尝试获取轮询锁的周期(单位:毫秒)
#尝试获取轮询锁的周期(单位:毫秒)
inspectthread.retry_get_inspect_lock_interval
=
10000
inspectthread.retry_get_inspect_lock_interval
=
10000
#尝试检查用户列表的周期(单位:毫秒)
#尝试检查用户列表的周期(单位:毫秒)
inspectthread.check_user_list_interval
=
300000
inspectthread.check_user_list_interval
=
300000
skywalking-commons/pom.xml
浏览文件 @
fcf2b9e4
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
<module>
skywalking-logging
</module>
<module>
skywalking-logging
</module>
<module>
skywalking-registry
</module>
<module>
skywalking-registry
</module>
<module>
skywalking-health-report
</module>
<module>
skywalking-health-report
</module>
<module>
skywalking-util
</module>
</modules>
</modules>
<name>
skywalking-commons
</name>
<name>
skywalking-commons
</name>
...
...
skywalking-commons/skywalking-logging/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/api/ILog.java
浏览文件 @
fcf2b9e4
...
@@ -27,4 +27,6 @@ public interface ILog {
...
@@ -27,4 +27,6 @@ public interface ILog {
void
debug
(
String
format
);
void
debug
(
String
format
);
void
debug
(
String
format
,
Object
...
arguments
);
void
debug
(
String
format
,
Object
...
arguments
);
void
error
(
String
format
);
}
}
skywalking-commons/skywalking-logging/skywalking-logging-api/src/main/java/com/a/eye/skywalking/logging/api/NoopLogger.java
浏览文件 @
fcf2b9e4
...
@@ -65,4 +65,9 @@ public class NoopLogger implements ILog{
...
@@ -65,4 +65,9 @@ public class NoopLogger implements ILog{
public
void
debug
(
String
format
,
Object
...
arguments
)
{
public
void
debug
(
String
format
,
Object
...
arguments
)
{
}
}
@Override
public
void
error
(
String
format
)
{
}
}
}
skywalking-commons/skywalking-logging/skywalking-logging-impl-log4j2/src/main/java/com/a/eye/skywalking/logging/impl/log4j2/Log4j2Logger.java
浏览文件 @
fcf2b9e4
...
@@ -72,4 +72,9 @@ public class Log4j2Logger implements ILog {
...
@@ -72,4 +72,9 @@ public class Log4j2Logger implements ILog {
public
void
debug
(
String
format
,
Object
...
arguments
)
{
public
void
debug
(
String
format
,
Object
...
arguments
)
{
logger
.
debug
(
format
,
arguments
);
logger
.
debug
(
format
,
arguments
);
}
}
@Override
public
void
error
(
String
format
)
{
logger
.
error
(
format
);
}
}
}
skywalking-commons/skywalking-util/pom.xml
0 → 100644
浏览文件 @
fcf2b9e4
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
skywalking-commons
</artifactId>
<groupId>
com.a.eye
</groupId>
<version>
2.0-2016
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
skywalking-util
</artifactId>
<packaging>
jar
</packaging>
<name>
skywalking-util
</name>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-network
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
skywalking-
sniffer/skywalking-api
/src/main/java/com/a/eye/skywalking/util/StringUtil.java
→
skywalking-
commons/skywalking-util
/src/main/java/com/a/eye/skywalking/util/StringUtil.java
浏览文件 @
fcf2b9e4
文件已移动
skywalking-commons/skywalking-util/src/main/java/com/a/eye/skywalking/util/TraceIdUtil.java
0 → 100644
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.util
;
import
com.a.eye.skywalking.network.grpc.TraceId
;
/**
* Created by xin on 2016/12/8.
*/
public
class
TraceIdUtil
{
public
static
String
formatTraceId
(
TraceId
traceId
)
{
StringBuilder
traceIdBuilder
=
new
StringBuilder
();
for
(
Long
segment
:
traceId
.
getSegmentsList
())
{
traceIdBuilder
.
append
(
segment
).
append
(
"."
);
}
return
traceIdBuilder
.
substring
(
0
,
traceIdBuilder
.
length
()
-
1
).
toString
();
}
}
skywalking-network/src/main/proto/Spans.proto
浏览文件 @
fcf2b9e4
...
@@ -41,18 +41,19 @@ message TraceId {
...
@@ -41,18 +41,19 @@ message TraceId {
message
Span
{
message
Span
{
TraceId
traceId
=
1
;
TraceId
traceId
=
1
;
string
levelId
=
2
;
// parentLevelId + "." + levelId
string
parentLevelId
=
2
;
string
viewpoint
=
3
;
int32
levelId
=
3
;
// parentLevelId + "." + levelId
int64
starttime
=
4
;
string
viewpoint
=
4
;
int64
cost
=
5
;
int64
startTime
=
5
;
int32
statusCode
=
6
;
int64
cost
=
6
;
string
exceptionStack
=
7
;
int32
statusCode
=
7
;
string
spanTypeDesc
=
8
;
string
exceptionStack
=
8
;
string
callType
=
9
;
string
spanTypeDesc
=
9
;
int32
spanType
=
10
;
string
callType
=
10
;
string
applicationCode
=
11
;
int32
spanType
=
11
;
string
username
=
12
;
string
applicationCode
=
12
;
string
businessKey
=
13
;
string
username
=
13
;
int32
processNo
=
14
;
string
businessKey
=
14
;
string
address
=
15
;
int32
processNo
=
15
;
string
address
=
16
;
}
}
skywalking-sniffer/pom.xml
浏览文件 @
fcf2b9e4
...
@@ -23,5 +23,11 @@
...
@@ -23,5 +23,11 @@
<compiler.version>
1.6
</compiler.version>
<compiler.version>
1.6
</compiler.version>
</properties>
</properties>
<dependencies>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-util
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
</project>
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/logging/EasyLogger.java
浏览文件 @
fcf2b9e4
...
@@ -119,4 +119,9 @@ public class EasyLogger implements com.a.eye.skywalking.logging.api.ILog {
...
@@ -119,4 +119,9 @@ public class EasyLogger implements com.a.eye.skywalking.logging.api.ILog {
public
void
debug
(
String
format
,
Object
...
arguments
)
{
public
void
debug
(
String
format
,
Object
...
arguments
)
{
logger
(
DEBUG
,
replaceParam
(
format
,
arguments
),
null
);
logger
(
DEBUG
,
replaceParam
(
format
,
arguments
),
null
);
}
}
@Override
public
void
error
(
String
format
)
{
logger
(
ERROR
,
format
,
null
);
}
}
}
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/PluginCfg.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.plugin
;
package
com.a.eye.skywalking.plugin
;
import
com.a.eye.skywalking.util.StringUtil
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -7,8 +9,6 @@ import java.io.InputStreamReader;
...
@@ -7,8 +9,6 @@ import java.io.InputStreamReader;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
com.a.eye.skywalking.util.StringUtil
;
public
class
PluginCfg
{
public
class
PluginCfg
{
public
final
static
PluginCfg
CFG
=
new
PluginCfg
();
public
final
static
PluginCfg
CFG
=
new
PluginCfg
();
...
...
skywalking-storage-center/skywalking-storage/pom.xml
浏览文件 @
fcf2b9e4
...
@@ -31,6 +31,16 @@
...
@@ -31,6 +31,16 @@
<version>
1.17
</version>
<version>
1.17
</version>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
<version>
2.8.0
</version>
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-util
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/SpanAlarmHandler.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.storage.alarm
;
package
com.a.eye.skywalking.storage.alarm
;
import
com.a.eye.skywalking.network.grpc.AckSpan
;
import
com.a.eye.skywalking.storage.alarm.checker.*
;
import
com.a.eye.skywalking.storage.alarm.checker.*
;
import
com.a.eye.skywalking.storage.alarm.sender.AlarmMessageSenderFactory
;
import
com.a.eye.skywalking.storage.alarm.sender.AlarmMessageSenderFactory
;
import
com.a.eye.skywalking.storage.data.spandata.AckSpanData
;
import
com.a.eye.skywalking.storage.data.spandata.AckSpanData
;
import
com.a.eye.skywalking.util.TraceIdUtil
;
import
com.lmax.disruptor.EventHandler
;
import
com.lmax.disruptor.EventHandler
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -22,7 +22,7 @@ public class SpanAlarmHandler implements EventHandler<AckSpanData> {
...
@@ -22,7 +22,7 @@ public class SpanAlarmHandler implements EventHandler<AckSpanData> {
}
}
private
String
generateAlarmMessageKey
(
AckSpanData
span
,
FatalReason
reason
)
{
private
String
generateAlarmMessageKey
(
AckSpanData
span
,
FatalReason
reason
)
{
return
span
.
getUserName
()
+
"-"
+
span
.
getApplicationCode
()
+
"-"
+
(
System
.
currentTimeMillis
()
/
(
10000
*
6
))
+
"-"
+
reason
;
return
span
.
getUserName
()
+
"-"
+
span
.
getApplicationCode
()
+
"-"
+
(
System
.
currentTimeMillis
()
/
(
10000
*
6
))
+
reason
.
getDetail
()
;
}
}
@Override
@Override
...
@@ -30,7 +30,7 @@ public class SpanAlarmHandler implements EventHandler<AckSpanData> {
...
@@ -30,7 +30,7 @@ public class SpanAlarmHandler implements EventHandler<AckSpanData> {
for
(
ISpanChecker
spanChecker
:
spanCheckers
)
{
for
(
ISpanChecker
spanChecker
:
spanCheckers
)
{
CheckResult
result
=
spanChecker
.
check
(
spanData
);
CheckResult
result
=
spanChecker
.
check
(
spanData
);
if
(!
result
.
isPassed
())
{
if
(!
result
.
isPassed
())
{
AlarmMessageSenderFactory
.
getSender
().
send
(
generateAlarmMessageKey
(
spanData
,
result
.
getFatalReason
()),
result
.
getMessage
());
AlarmMessageSenderFactory
.
getSender
().
send
(
generateAlarmMessageKey
(
spanData
,
result
.
getFatalReason
()),
TraceIdUtil
.
formatTraceId
(
spanData
.
getTraceId
()),
result
.
getMessage
());
}
}
}
}
}
}
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/checker/FatalReason.java
浏览文件 @
fcf2b9e4
...
@@ -4,5 +4,14 @@ package com.a.eye.skywalking.storage.alarm.checker;
...
@@ -4,5 +4,14 @@ package com.a.eye.skywalking.storage.alarm.checker;
* Created by xin on 2016/12/8.
* Created by xin on 2016/12/8.
*/
*/
public
enum
FatalReason
{
public
enum
FatalReason
{
EXCEPTION_ERROR
,
EXECUTE_TIME_ERROR
,
EXECUTE_TIME_WARNING
;
EXCEPTION_ERROR
(
""
),
EXECUTE_TIME_ERROR
(
"-ExecuteTime-PossibleError"
),
EXECUTE_TIME_WARNING
(
"-ExecuteTime-Warning"
);
private
String
detail
;
FatalReason
(
String
detail
)
{
this
.
detail
=
detail
;
}
public
String
getDetail
()
{
return
detail
;
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/sender/AlarmMessageSender.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.storage.alarm.sender
;
package
com.a.eye.skywalking.storage.alarm.sender
;
import
com.a.eye.skywalking.logging.api.ILog
;
import
com.a.eye.skywalking.logging.api.LogManager
;
import
com.a.eye.skywalking.storage.config.Config
;
import
redis.clients.jedis.Jedis
;
/**
/**
* Created by xin on 2016/12/8.
* Created by xin on 2016/12/8.
*/
*/
public
class
AlarmMessageSender
{
public
class
AlarmMessageSender
{
private
ILog
logger
=
LogManager
.
getLogger
(
AlarmMessageSender
.
class
);
public
void
send
(
String
alarmKey
,
String
traceId
,
String
message
)
{
public
void
send
(
String
alarmKey
,
String
message
)
{
Jedis
jedis
=
null
;
try
{
jedis
=
AlarmRedisConnector
.
getJedis
();
jedis
.
hsetnx
(
alarmKey
,
traceId
,
message
);
jedis
.
expire
(
alarmKey
,
Config
.
Alarm
.
ALARM_EXPIRE_SECONDS
);
}
catch
(
Exception
e
)
{
AlarmRedisConnector
.
reportJedisFailure
();
logger
.
error
(
"Failed to set data."
,
e
);
}
finally
{
if
(
jedis
!=
null
)
{
jedis
.
close
();
}
}
}
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/alarm/sender/AlarmRedisConnector.java
0 → 100644
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.storage.alarm.sender
;
import
com.a.eye.skywalking.logging.api.ILog
;
import
com.a.eye.skywalking.logging.api.LogManager
;
import
com.a.eye.skywalking.storage.config.Config
;
import
org.apache.commons.pool2.impl.GenericObjectPoolConfig
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.JedisPool
;
import
static
com
.
a
.
eye
.
skywalking
.
health
.
report
.
HealthCollector
.
getCurrentHeathReading
;
import
static
com
.
a
.
eye
.
skywalking
.
health
.
report
.
HeathReading
.
ERROR
;
import
static
com
.
a
.
eye
.
skywalking
.
health
.
report
.
HeathReading
.
INFO
;
/**
* Created by xin on 2016/12/8.
*/
public
class
AlarmRedisConnector
{
private
static
JedisPool
jedisPool
;
static
{
new
RedisInspector
().
connect
().
start
();
}
public
static
Jedis
getJedis
()
{
if
(
Config
.
Alarm
.
ALARM_OFF_FLAG
)
{
return
null
;
}
else
{
return
jedisPool
.
getResource
();
}
}
public
static
void
reportJedisFailure
()
{
RedisInspector
.
needConnectInit
=
true
;
}
private
static
class
RedisInspector
extends
Thread
{
private
static
ILog
logger
=
LogManager
.
getLogger
(
RedisInspector
.
class
);
private
static
boolean
needConnectInit
=
true
;
private
String
[]
config
;
public
RedisInspector
()
{
super
(
"RedisInspectorThread"
);
String
redisServerConfig
=
Config
.
Alarm
.
REDIS_SERVER
;
if
(
redisServerConfig
==
null
||
redisServerConfig
.
length
()
<=
0
)
{
logger
.
error
(
"Redis server is not setting. Switch off alarm module. "
);
Config
.
Alarm
.
ALARM_OFF_FLAG
=
true
;
}
else
{
config
=
redisServerConfig
.
split
(
":"
);
if
(
config
.
length
!=
2
)
{
logger
.
error
(
"Redis server address is illegal setting, need to be 'ip:port'. Switch off alarm module. "
);
Config
.
Alarm
.
ALARM_OFF_FLAG
=
true
;
}
}
this
.
setDaemon
(
true
);
}
private
RedisInspector
connect
()
{
if
(
jedisPool
!=
null
&&
!
jedisPool
.
isClosed
())
{
jedisPool
.
close
();
}
GenericObjectPoolConfig
genericObjectPoolConfig
=
buildGenericObjectPoolConfig
();
jedisPool
=
new
JedisPool
(
genericObjectPoolConfig
,
config
[
0
],
Integer
.
valueOf
(
config
[
1
]));
// Test connect redis.
Jedis
jedis
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
jedis
.
get
(
"ok"
);
needConnectInit
=
false
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"can't connect to redis["
+
Config
.
Alarm
.
REDIS_SERVER
+
"]"
,
e
);
}
finally
{
if
(
jedis
!=
null
)
{
jedis
.
close
();
}
}
return
this
;
}
@Override
public
void
run
()
{
if
(
Config
.
Alarm
.
ALARM_OFF_FLAG
)
return
;
while
(
true
)
{
try
{
if
(
needConnectInit
)
{
connect
();
}
if
(
needConnectInit
)
{
getCurrentHeathReading
(
null
).
updateData
(
ERROR
,
"alarm redis connect failue."
);
}
else
{
getCurrentHeathReading
(
null
).
updateData
(
INFO
,
"alarm redis connectted."
);
}
}
catch
(
Throwable
t
)
{
logger
.
error
(
"redis init connect failue"
,
t
);
}
try
{
Thread
.
sleep
(
Config
.
Alarm
.
ALARM_REDIS_INSPECTOR_INTERVAL
);
}
catch
(
InterruptedException
e
)
{
logger
.
error
(
"Failure sleep."
,
e
);
}
}
}
private
GenericObjectPoolConfig
buildGenericObjectPoolConfig
()
{
GenericObjectPoolConfig
genericObjectPoolConfig
=
new
GenericObjectPoolConfig
();
genericObjectPoolConfig
.
setTestOnBorrow
(
true
);
genericObjectPoolConfig
.
setMaxIdle
(
Config
.
Alarm
.
REDIS_MAX_IDLE
);
genericObjectPoolConfig
.
setMinIdle
(
Config
.
Alarm
.
REDIS_MIN_IDLE
);
genericObjectPoolConfig
.
setMaxTotal
(
Config
.
Alarm
.
REDIS_MAX_TOTAL
);
return
genericObjectPoolConfig
;
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/config/Config.java
浏览文件 @
fcf2b9e4
...
@@ -44,6 +44,21 @@ public class Config {
...
@@ -44,6 +44,21 @@ public class Config {
}
}
public
static
class
Alarm
{
public
static
class
Alarm
{
public
static
String
REDIS_SERVER
=
"127.0.0.1:6379"
;
public
static
boolean
ALARM_OFF_FLAG
=
false
;
public
static
int
ALARM_EXCEPTION_STACK_LENGTH
=
300
;
public
static
int
ALARM_EXCEPTION_STACK_LENGTH
=
300
;
public
static
long
ALARM_REDIS_INSPECTOR_INTERVAL
=
100
;
public
static
int
REDIS_MAX_IDLE
=
10
;
public
static
int
REDIS_MIN_IDLE
=
1
;
public
static
int
REDIS_MAX_TOTAL
=
30
;
public
static
int
ALARM_EXPIRE_SECONDS
=
1000
*
60
*
90
;
}
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/index/IndexMetaInfo.java
浏览文件 @
fcf2b9e4
...
@@ -52,7 +52,7 @@ public class IndexMetaInfo {
...
@@ -52,7 +52,7 @@ public class IndexMetaInfo {
}
}
public
String
getLevelId
()
{
public
String
getLevelId
()
{
return
spanData
.
getLevelId
();
return
spanData
.
get
Trace
LevelId
();
}
}
public
SpanType
getSpanType
()
{
public
SpanType
getSpanType
()
{
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/AckSpanData.java
浏览文件 @
fcf2b9e4
...
@@ -41,7 +41,7 @@ public class AckSpanData extends AbstractSpanData {
...
@@ -41,7 +41,7 @@ public class AckSpanData extends AbstractSpanData {
}
}
@Override
@Override
public
String
getLevelId
()
{
public
String
get
Trace
LevelId
()
{
return
buildLevelId
(
ackSpan
.
getParentLevel
(),
ackSpan
.
getLevelId
());
return
buildLevelId
(
ackSpan
.
getParentLevel
(),
ackSpan
.
getLevelId
());
}
}
...
@@ -68,4 +68,8 @@ public class AckSpanData extends AbstractSpanData {
...
@@ -68,4 +68,8 @@ public class AckSpanData extends AbstractSpanData {
public
String
getApplicationCode
(){
public
String
getApplicationCode
(){
return
ackSpan
.
getApplicationCode
();
return
ackSpan
.
getApplicationCode
();
}
}
public
TraceId
getTraceId
(){
return
ackSpan
.
getTraceId
();
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/RequestSpanData.java
浏览文件 @
fcf2b9e4
...
@@ -41,10 +41,20 @@ public class RequestSpanData extends AbstractSpanData {
...
@@ -41,10 +41,20 @@ public class RequestSpanData extends AbstractSpanData {
}
}
@Override
@Override
public
String
getLevelId
()
{
public
String
get
Trace
LevelId
()
{
return
buildLevelId
(
requestSpan
.
getParentLevel
(),
requestSpan
.
getLevelId
());
return
buildLevelId
(
requestSpan
.
getParentLevel
(),
requestSpan
.
getLevelId
());
}
}
public
String
getParentLevelId
(){
return
requestSpan
.
getParentLevel
();
}
public
int
getLevelId
(){
return
requestSpan
.
getLevelId
();
}
public
String
getAddress
()
{
public
String
getAddress
()
{
return
requestSpan
.
getAddress
();
return
requestSpan
.
getAddress
();
}
}
...
@@ -72,4 +82,8 @@ public class RequestSpanData extends AbstractSpanData {
...
@@ -72,4 +82,8 @@ public class RequestSpanData extends AbstractSpanData {
public
int
getType
()
{
public
int
getType
()
{
return
requestSpan
.
getSpanType
();
return
requestSpan
.
getSpanType
();
}
}
public
String
getViewPoint
(){
return
requestSpan
.
getViewPointId
();
}
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/SpanData.java
浏览文件 @
fcf2b9e4
...
@@ -10,5 +10,5 @@ public interface SpanData {
...
@@ -10,5 +10,5 @@ public interface SpanData {
Long
[]
getTraceIdSegments
();
Long
[]
getTraceIdSegments
();
String
getLevelId
();
String
get
Trace
LevelId
();
}
}
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/spandata/SpanDataHelper.java
浏览文件 @
fcf2b9e4
...
@@ -21,9 +21,9 @@ public class SpanDataHelper {
...
@@ -21,9 +21,9 @@ public class SpanDataHelper {
public
SpanDataHelper
category
()
{
public
SpanDataHelper
category
()
{
for
(
SpanData
spanData
:
data
)
{
for
(
SpanData
spanData
:
data
)
{
if
(
spanData
instanceof
RequestSpanData
)
{
if
(
spanData
instanceof
RequestSpanData
)
{
levelIdRequestSpanDataMapping
.
put
(
spanData
.
getLevelId
(),
(
RequestSpanData
)
spanData
);
levelIdRequestSpanDataMapping
.
put
(
spanData
.
get
Trace
LevelId
(),
(
RequestSpanData
)
spanData
);
}
else
{
}
else
{
levelIdAckSpanDataMapping
.
put
(
spanData
.
getLevelId
(),
(
AckSpanData
)
spanData
);
levelIdAckSpanDataMapping
.
put
(
spanData
.
get
Trace
LevelId
(),
(
AckSpanData
)
spanData
);
}
}
}
}
...
@@ -50,9 +50,10 @@ public class SpanDataHelper {
...
@@ -50,9 +50,10 @@ public class SpanDataHelper {
builder
=
builder
.
setExceptionStack
(
ackSpanData
.
getExceptionStack
());
builder
=
builder
.
setExceptionStack
(
ackSpanData
.
getExceptionStack
());
}
}
builder
=
builder
.
setLevelId
(
requestSpanData
.
getLevelId
()).
setProcessNo
(
requestSpanData
.
getProcessNo
())
builder
=
builder
.
setLevelId
(
requestSpanData
.
getLevelId
()).
setP
arentLevelId
(
requestSpanData
.
getParentLevelId
()).
setP
rocessNo
(
requestSpanData
.
getProcessNo
())
.
setSpanType
(
requestSpanData
.
getType
()).
setStart
t
ime
(
requestSpanData
.
getStartTime
())
.
setSpanType
(
requestSpanData
.
getType
()).
setStart
T
ime
(
requestSpanData
.
getStartTime
())
.
setStatusCode
(
ackSpanData
.
getStatusCode
())
.
setStatusCode
(
ackSpanData
.
getStatusCode
())
.
setViewpoint
(
requestSpanData
.
getViewPoint
())
.
setTraceId
(
TraceId
.
newBuilder
().
addAllSegments
(
Arrays
.
asList
(
requestSpanData
.
getTraceIdSegments
())));
.
setTraceId
(
TraceId
.
newBuilder
().
addAllSegments
(
Arrays
.
asList
(
requestSpanData
.
getTraceIdSegments
())));
return
builder
.
build
();
return
builder
.
build
();
}
}
...
...
skywalking-storage-center/skywalking-storage/src/test/java/com/a/eye/skywalking/storage/alarm/SpanAlarmHandlerTest.java
浏览文件 @
fcf2b9e4
...
@@ -49,25 +49,25 @@ public class SpanAlarmHandlerTest {
...
@@ -49,25 +49,25 @@ public class SpanAlarmHandlerTest {
@Test
@Test
public
void
testNormalSpan
()
throws
Exception
{
public
void
testNormalSpan
()
throws
Exception
{
handler
.
onEvent
(
normalAckSpan
,
1
,
false
);
handler
.
onEvent
(
normalAckSpan
,
1
,
false
);
verify
(
messageHandler
,
never
()).
send
(
any
(),
anyString
());
verify
(
messageHandler
,
never
()).
send
(
any
(),
any
(),
any
String
());
}
}
@Test
@Test
public
void
testCostMuchSpan
()
throws
Exception
{
public
void
testCostMuchSpan
()
throws
Exception
{
handler
.
onEvent
(
costMuchSpan
,
1
,
false
);
handler
.
onEvent
(
costMuchSpan
,
1
,
false
);
verify
(
messageHandler
,
times
(
1
)).
send
(
any
(),
anyString
());
verify
(
messageHandler
,
times
(
1
)).
send
(
any
(),
any
(),
any
String
());
}
}
@Test
@Test
public
void
testExceptionSpan
()
throws
Exception
{
public
void
testExceptionSpan
()
throws
Exception
{
handler
.
onEvent
(
exceptionSpan
,
1
,
false
);
handler
.
onEvent
(
exceptionSpan
,
1
,
false
);
verify
(
messageHandler
,
times
(
1
)).
send
(
any
(),
anyString
());
verify
(
messageHandler
,
times
(
1
)).
send
(
any
(),
any
(),
any
String
());
}
}
@Test
@Test
public
void
testCostTooMuchSpan
()
throws
Exception
{
public
void
testCostTooMuchSpan
()
throws
Exception
{
handler
.
onEvent
(
costTooMuchSpan
,
1
,
false
);
handler
.
onEvent
(
costTooMuchSpan
,
1
,
false
);
verify
(
messageHandler
,
times
(
1
)).
send
(
any
(),
anyString
());
verify
(
messageHandler
,
times
(
1
)).
send
(
any
(),
any
(),
any
String
());
}
}
}
}
skywalking-webui/pom.xml
浏览文件 @
fcf2b9e4
...
@@ -110,5 +110,11 @@
...
@@ -110,5 +110,11 @@
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-util
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
skywalking-webui/src/main/java/com/a/eye/skywalking/web/client/routing/SearchClient.java
浏览文件 @
fcf2b9e4
...
@@ -25,7 +25,7 @@ public class SearchClient {
...
@@ -25,7 +25,7 @@ public class SearchClient {
}
}
public
TraceNodesResult
searchSpan
(
String
traceId
){
public
TraceNodesResult
searchSpan
(
String
traceId
){
String
[]
traceIdSegments
=
traceId
.
split
(
"."
);
String
[]
traceIdSegments
=
traceId
.
split
(
"
\\
."
);
TraceNodesResult
traceNodesResult
=
new
TraceNodesResult
();
TraceNodesResult
traceNodesResult
=
new
TraceNodesResult
();
if
(
traceIdSegments
.
length
!=
6
){
if
(
traceIdSegments
.
length
!=
6
){
return
traceNodesResult
;
return
traceNodesResult
;
...
...
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/AlarmRuleMaintainController.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.web.controller
;
package
com.a.eye.skywalking.web.controller
;
import
com.a.eye.skywalking.util.StringUtil
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.dao.inter.IAlarmRuleMaintainDao
;
import
com.a.eye.skywalking.web.dao.inter.IAlarmRuleMaintainDao
;
import
com.a.eye.skywalking.web.dto.AlarmRuleInfo
;
import
com.a.eye.skywalking.web.dto.AlarmRuleInfo
;
import
com.a.eye.skywalking.web.dto.ConfigArgs
;
import
com.a.eye.skywalking.web.dto.ConfigArgs
;
import
com.a.eye.skywalking.web.dto.LoginUserInfo
;
import
com.a.eye.skywalking.web.dto.LoginUserInfo
;
import
com.a.eye.skywalking.web.entity.AlarmRule
;
import
com.a.eye.skywalking.web.entity.AlarmRule
;
import
com.a.eye.skywalking.web.util.StringUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -97,7 +97,7 @@ public class AlarmRuleMaintainController extends BaseController {
...
@@ -97,7 +97,7 @@ public class AlarmRuleMaintainController extends BaseController {
public
String
loadAlarmRule
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
HttpServletRequest
request
)
{
public
String
loadAlarmRule
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
HttpServletRequest
request
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
try
{
try
{
if
(
StringUtil
.
is
Blank
(
applicationId
))
{
if
(
StringUtil
.
is
Empty
(
applicationId
))
{
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"message"
,
"application Id cannot be null"
);
jsonObject
.
put
(
"message"
,
"application Id cannot be null"
);
return
jsonObject
.
toJSONString
();
return
jsonObject
.
toJSONString
();
...
...
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/ApplicationConfigController.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.web.controller
;
package
com.a.eye.skywalking.web.controller
;
import
com.a.eye.skywalking.util.StringUtil
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.dao.inter.IAlarmRuleMaintainDao
;
import
com.a.eye.skywalking.web.dao.inter.IAlarmRuleMaintainDao
;
import
com.a.eye.skywalking.web.dao.inter.IApplicationsMaintainDao
;
import
com.a.eye.skywalking.web.dao.inter.IApplicationsMaintainDao
;
import
com.a.eye.skywalking.web.dto.ApplicationInfo
;
import
com.a.eye.skywalking.web.dto.ApplicationInfo
;
import
com.a.eye.skywalking.web.dto.LoginUserInfo
;
import
com.a.eye.skywalking.web.dto.LoginUserInfo
;
import
com.a.eye.skywalking.web.util.StringUtil
;
import
com.a.eye.skywalking.web.entity.AlarmRule
;
import
com.a.eye.skywalking.web.entity.AlarmRule
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -122,7 +122,7 @@ public class ApplicationConfigController extends BaseController {
...
@@ -122,7 +122,7 @@ public class ApplicationConfigController extends BaseController {
public
String
updateApplication
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
String
appInfo
,
HttpServletRequest
request
)
{
public
String
updateApplication
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
String
appInfo
,
HttpServletRequest
request
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
try
{
try
{
if
(
StringUtil
.
is
Blank
(
applicationId
))
{
if
(
StringUtil
.
is
Empty
(
applicationId
))
{
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"message"
,
"applicationId cannot be null"
);
jsonObject
.
put
(
"message"
,
"applicationId cannot be null"
);
return
jsonObject
.
toJSONString
();
return
jsonObject
.
toJSONString
();
...
@@ -203,7 +203,7 @@ public class ApplicationConfigController extends BaseController {
...
@@ -203,7 +203,7 @@ public class ApplicationConfigController extends BaseController {
public
String
loadApplication
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
HttpServletRequest
request
)
{
public
String
loadApplication
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
HttpServletRequest
request
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
try
{
try
{
if
(
StringUtil
.
is
Blank
(
applicationId
))
{
if
(
StringUtil
.
is
Empty
(
applicationId
))
{
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"message"
,
"applicationId cannot be null"
);
jsonObject
.
put
(
"message"
,
"applicationId cannot be null"
);
return
jsonObject
.
toJSONString
();
return
jsonObject
.
toJSONString
();
...
@@ -241,7 +241,7 @@ public class ApplicationConfigController extends BaseController {
...
@@ -241,7 +241,7 @@ public class ApplicationConfigController extends BaseController {
public
String
delApplication
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
HttpServletRequest
request
)
{
public
String
delApplication
(
@PathVariable
(
"applicationId"
)
String
applicationId
,
HttpServletRequest
request
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
try
{
try
{
if
(
StringUtil
.
is
Blank
(
applicationId
))
{
if
(
StringUtil
.
is
Empty
(
applicationId
))
{
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"code"
,
"500"
);
jsonObject
.
put
(
"message"
,
"applicationId cannot be null"
);
jsonObject
.
put
(
"message"
,
"applicationId cannot be null"
);
return
jsonObject
.
toJSONString
();
return
jsonObject
.
toJSONString
();
...
...
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/SearchController.java
浏览文件 @
fcf2b9e4
...
@@ -3,13 +3,13 @@ package com.a.eye.skywalking.web.controller;
...
@@ -3,13 +3,13 @@ package com.a.eye.skywalking.web.controller;
import
com.a.eye.skywalking.registry.RegistryCenterFactory
;
import
com.a.eye.skywalking.registry.RegistryCenterFactory
;
import
com.a.eye.skywalking.registry.api.RegistryCenter
;
import
com.a.eye.skywalking.registry.api.RegistryCenter
;
import
com.a.eye.skywalking.registry.impl.zookeeper.ZookeeperConfig
;
import
com.a.eye.skywalking.registry.impl.zookeeper.ZookeeperConfig
;
import
com.a.eye.skywalking.util.StringUtil
;
import
com.a.eye.skywalking.web.client.routing.RoutingServerWatcher
;
import
com.a.eye.skywalking.web.client.routing.RoutingServerWatcher
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.config.Config
;
import
com.a.eye.skywalking.web.config.Config
;
import
com.a.eye.skywalking.web.config.ConfigInitializer
;
import
com.a.eye.skywalking.web.config.ConfigInitializer
;
import
com.a.eye.skywalking.web.dto.TraceTreeInfo
;
import
com.a.eye.skywalking.web.dto.TraceTreeInfo
;
import
com.a.eye.skywalking.web.service.inter.ITraceTreeService
;
import
com.a.eye.skywalking.web.service.inter.ITraceTreeService
;
import
com.a.eye.skywalking.web.util.StringUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -60,7 +60,7 @@ public class SearchController extends BaseController {
...
@@ -60,7 +60,7 @@ public class SearchController extends BaseController {
public
String
loadTraceTree
(
@RequestParam
(
"traceId"
)
String
traceId
)
{
public
String
loadTraceTree
(
@RequestParam
(
"traceId"
)
String
traceId
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
try
{
try
{
if
(
StringUtil
.
is
Blank
(
traceId
))
{
if
(
StringUtil
.
is
Empty
(
traceId
))
{
jsonObject
.
put
(
"code"
,
"400"
);
jsonObject
.
put
(
"code"
,
"400"
);
jsonObject
.
put
(
"result"
,
"TraceId cannot be null"
);
jsonObject
.
put
(
"result"
,
"TraceId cannot be null"
);
return
jsonObject
.
toJSONString
();
return
jsonObject
.
toJSONString
();
...
...
skywalking-webui/src/main/java/com/a/eye/skywalking/web/controller/UserMaintainController.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.web.controller
;
package
com.a.eye.skywalking.web.controller
;
import
com.a.eye.skywalking.util.StringUtil
;
import
com.a.eye.skywalking.web.dao.inter.IUserMaintainDao
;
import
com.a.eye.skywalking.web.dao.inter.IUserMaintainDao
;
import
com.a.eye.skywalking.web.dto.LoginUserInfo
;
import
com.a.eye.skywalking.web.dto.LoginUserInfo
;
import
com.a.eye.skywalking.web.entity.UserInfo
;
import
com.a.eye.skywalking.web.entity.UserInfo
;
import
com.a.eye.skywalking.web.dto.SignInUserInfo
;
import
com.a.eye.skywalking.web.dto.SignInUserInfo
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.common.BaseController
;
import
com.a.eye.skywalking.web.util.Constants
;
import
com.a.eye.skywalking.web.util.Constants
;
import
com.a.eye.skywalking.web.util.StringUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -65,7 +65,7 @@ public class UserMaintainController extends BaseController {
...
@@ -65,7 +65,7 @@ public class UserMaintainController extends BaseController {
}
}
private
boolean
validateUserInfo
(
UserInfo
loginInfo
,
JSONObject
result
)
{
private
boolean
validateUserInfo
(
UserInfo
loginInfo
,
JSONObject
result
)
{
if
(
StringUtil
.
is
Blank
(
loginInfo
.
getUserName
())
||
StringUtil
.
isBlank
(
loginInfo
.
getPassword
()))
{
if
(
StringUtil
.
is
Empty
(
loginInfo
.
getUserName
())
||
StringUtil
.
isEmpty
(
loginInfo
.
getPassword
()))
{
result
.
put
(
"code"
,
"400"
);
result
.
put
(
"code"
,
"400"
);
result
.
put
(
"message"
,
"Username or password is null"
);
result
.
put
(
"message"
,
"Username or password is null"
);
return
true
;
return
true
;
...
@@ -90,7 +90,7 @@ public class UserMaintainController extends BaseController {
...
@@ -90,7 +90,7 @@ public class UserMaintainController extends BaseController {
signInUserInfo
.
setRoleType
(
Constants
.
USR
.
ROLE_TYPE_USER
);
signInUserInfo
.
setRoleType
(
Constants
.
USR
.
ROLE_TYPE_USER
);
signInUserInfo
.
setSts
(
Constants
.
USR
.
STR_VAL_A
);
signInUserInfo
.
setSts
(
Constants
.
USR
.
STR_VAL_A
);
iUserMaintainDao
.
addUser
(
signInUserInfo
);
iUserMaintainDao
.
addUser
(
signInUserInfo
);
if
(
StringUtil
.
is
Blank
(
signInUserInfo
.
getUid
()))
{
if
(
StringUtil
.
is
Empty
(
signInUserInfo
.
getUid
()))
{
result
.
put
(
"code"
,
"500"
);
result
.
put
(
"code"
,
"500"
);
result
.
put
(
"message"
,
"Failed to register user"
+
signInUserInfo
.
getUserName
());
result
.
put
(
"message"
,
"Failed to register user"
+
signInUserInfo
.
getUserName
());
return
result
.
toJSONString
();
return
result
.
toJSONString
();
...
...
skywalking-webui/src/main/java/com/a/eye/skywalking/web/dao/impl/TraceNodeDao.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.web.dao.impl
;
package
com.a.eye.skywalking.web.dao.impl
;
import
com.a.eye.skywalking.network.grpc.Span
;
import
com.a.eye.skywalking.network.grpc.Span
;
import
com.a.eye.skywalking.network.grpc.TraceId
;
import
com.a.eye.skywalking.util.StringUtil
;
import
com.a.eye.skywalking.web.client.routing.SearchClient
;
import
com.a.eye.skywalking.web.client.routing.SearchClient
;
import
com.a.eye.skywalking.web.dao.inter.ITraceNodeDao
;
import
com.a.eye.skywalking.web.dao.inter.ITraceNodeDao
;
import
com.a.eye.skywalking.web.dto.TraceNodeInfo
;
import
com.a.eye.skywalking.web.dto.TraceNodeInfo
;
import
com.a.eye.skywalking.web.dto.TraceNodesResult
;
import
com.a.eye.skywalking.web.dto.TraceNodesResult
;
import
com.a.eye.skywalking.web.util.Constants
;
import
com.a.eye.skywalking.web.util.Constants
;
import
com.a.eye.skywalking.web.util.SortUtil
;
import
com.a.eye.skywalking.web.util.StringUtil
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* Created by xin on 16-3-30.
* Created by xin on 16-3-30.
...
@@ -27,23 +24,36 @@ public class TraceNodeDao implements ITraceNodeDao {
...
@@ -27,23 +24,36 @@ public class TraceNodeDao implements ITraceNodeDao {
public
TraceNodesResult
queryTraceNodesByTraceId
(
String
traceId
)
public
TraceNodesResult
queryTraceNodesByTraceId
(
String
traceId
)
throws
IOException
,
IllegalAccessException
,
NoSuchMethodException
,
throws
IOException
,
IllegalAccessException
,
NoSuchMethodException
,
InvocationTargetException
{
InvocationTargetException
{
List
<
Span
>
searchResult
=
new
ArrayList
<>();
return
new
SearchClient
().
searchSpan
(
traceId
);
}
// TODO: 2016/12/10
private
Collection
<
TraceNodeInfo
>
generateTestData
()
{
long
startTime
=
System
.
currentTimeMillis
();
TraceId
traceId
=
TraceId
.
newBuilder
()
.
addSegments
(
202016
)
.
addSegments
(
startTime
)
.
addSegments
(-
1
)
.
addSegments
(
1234
)
.
addSegments
(
1234
)
.
addSegments
(
1234
).
build
();
Span
rootSpan
=
Span
.
newBuilder
().
setSpanType
(
1
).
setAddress
(
"127.0.0.1/ascrutae"
).
setApplicationCode
(
"test"
)
.
setCallType
(
"S"
).
setCost
(
200
).
setLevelId
(
0
).
setViewpoint
(
"provider://127.0.0.1:20880/com.a.eye.dubbo.provider.GreetService.sayHello()"
)
.
setProcessNo
(
19872
)
.
setTraceId
(
traceId
).
setStartTime
(
startTime
)
.
setStatusCode
(
0
).
setUsername
(
"test"
).
build
();
SearchClient
client
=
new
SearchClient
();
Span
span
=
Span
.
newBuilder
().
setSpanType
(
1
).
setAddress
(
"127.0.0.1/ascrutae"
).
setApplicationCode
(
"test"
)
TraceNodesResult
result
=
client
.
searchSpan
(
traceId
);
.
setCallType
(
"S"
).
setCost
(
100
).
setParentLevelId
(
"0"
).
setLevelId
(
0
).
setViewpoint
(
"consumer://127.0.0.1:20880/com.a.eye.dubbo.provider.GreetService.sayHello()"
)
Map
<
String
,
TraceNodeInfo
>
traceNodeInfoMap
=
new
HashMap
<>();
.
setProcessNo
(
19872
)
searchResult
.
forEach
((
span
->
{
.
setTraceId
(
traceId
).
setStartTime
(
startTime
+
50
)
traceNodeInfoMap
.
put
(
span
.
getLevelId
(),
new
TraceNodeInfo
(
span
));
.
setStatusCode
(
0
).
setUsername
(
"test"
).
build
();
}));
Map
<
String
,
TraceNodeInfo
>
traceLogMap
=
new
HashMap
<
String
,
TraceNodeInfo
>();
List
<
TraceNodeInfo
>
nodeInfos
=
new
ArrayList
<>();
Map
<
String
,
TraceNodeInfo
>
rpcMap
=
new
HashMap
<
String
,
TraceNodeInfo
>();
nodeInfos
.
add
(
new
TraceNodeInfo
(
rootSpan
));
traceNodeInfoMap
.
entrySet
().
forEach
((
entry
->
{
nodeInfos
.
add
(
new
TraceNodeInfo
(
span
));
SortUtil
.
addCurNodeTreeMapKey
(
traceLogMap
,
entry
.
getKey
(),
entry
.
getValue
());
}));
return
nodeInfos
;
computeRPCInfo
(
rpcMap
,
traceLogMap
);
result
.
setResult
(
traceLogMap
.
values
());
return
result
;
}
}
private
void
computeRPCInfo
(
Map
<
String
,
TraceNodeInfo
>
rpcMap
,
Map
<
String
,
TraceNodeInfo
>
traceLogMap
)
{
private
void
computeRPCInfo
(
Map
<
String
,
TraceNodeInfo
>
rpcMap
,
Map
<
String
,
TraceNodeInfo
>
traceLogMap
)
{
...
@@ -54,8 +64,8 @@ public class TraceNodeDao implements ITraceNodeDao {
...
@@ -54,8 +64,8 @@ public class TraceNodeDao implements ITraceNodeDao {
if
(
traceLogMap
.
containsKey
(
colId
))
{
if
(
traceLogMap
.
containsKey
(
colId
))
{
TraceNodeInfo
logVO
=
traceLogMap
.
get
(
colId
);
TraceNodeInfo
logVO
=
traceLogMap
.
get
(
colId
);
TraceNodeInfo
serverLog
=
rpcVO
.
getValue
();
TraceNodeInfo
serverLog
=
rpcVO
.
getValue
();
if
(
StringUtil
.
is
Blank
(
logVO
.
getStatusCodeStr
())
||
Constants
.
STATUS_CODE_9
.
equals
(
logVO
.
getStatusCodeStr
()))
{
if
(
StringUtil
.
is
Empty
(
logVO
.
getStatusCodeStr
())
||
Constants
.
STATUS_CODE_9
.
equals
(
logVO
.
getStatusCodeStr
()))
{
serverLog
.
setColId
(
colId
);
//
serverLog.setColId(colId);
traceLogMap
.
put
(
colId
,
serverLog
);
traceLogMap
.
put
(
colId
,
serverLog
);
}
else
{
}
else
{
TraceNodeInfo
clientLog
=
traceLogMap
.
get
(
colId
);
TraceNodeInfo
clientLog
=
traceLogMap
.
get
(
colId
);
...
@@ -63,9 +73,9 @@ public class TraceNodeDao implements ITraceNodeDao {
...
@@ -63,9 +73,9 @@ public class TraceNodeDao implements ITraceNodeDao {
clientLog
.
setViewPointId
(
serverLog
.
getViewPointId
());
clientLog
.
setViewPointId
(
serverLog
.
getViewPointId
());
clientLog
.
setViewPointIdSub
(
serverLog
.
getViewPointIdSub
());
clientLog
.
setViewPointIdSub
(
serverLog
.
getViewPointIdSub
());
clientLog
.
setAddress
(
serverLog
.
getAddress
());
clientLog
.
setAddress
(
serverLog
.
getAddress
());
if
(
StringUtil
.
is
Blank
(
clientLog
.
getExceptionStack
()))
{
if
(
StringUtil
.
is
Empty
(
clientLog
.
getExceptionStack
()))
{
clientLog
.
setExceptionStack
(
serverLog
.
getExceptionStack
());
clientLog
.
setExceptionStack
(
serverLog
.
getExceptionStack
());
}
else
{
}
else
{
clientLog
.
setServerExceptionStr
(
serverLog
.
getServerExceptionStr
());
clientLog
.
setServerExceptionStr
(
serverLog
.
getServerExceptionStr
());
}
}
}
}
...
...
skywalking-webui/src/main/java/com/a/eye/skywalking/web/dto/FullSpan.java
浏览文件 @
fcf2b9e4
...
@@ -8,8 +8,9 @@ import com.a.eye.skywalking.network.grpc.Span;
...
@@ -8,8 +8,9 @@ import com.a.eye.skywalking.network.grpc.Span;
public
class
FullSpan
{
public
class
FullSpan
{
private
String
parentLevelId
;
protected
String
traceId
;
protected
String
traceId
;
protected
String
levelId
=
""
;
protected
int
levelId
;
protected
String
viewPointId
;
protected
String
viewPointId
;
protected
String
applicationId
;
protected
String
applicationId
;
protected
String
callType
;
protected
String
callType
;
...
@@ -35,12 +36,13 @@ public class FullSpan {
...
@@ -35,12 +36,13 @@ public class FullSpan {
}
}
this
.
traceId
=
traceId
.
substring
(
0
,
traceId
.
length
()
-
1
);
this
.
traceId
=
traceId
.
substring
(
0
,
traceId
.
length
()
-
1
);
this
.
levelId
=
span
.
getLevelId
();
this
.
levelId
=
span
.
getLevelId
();
this
.
parentLevelId
=
span
.
getParentLevelId
();
this
.
applicationId
=
span
.
getApplicationCode
();
this
.
applicationId
=
span
.
getApplicationCode
();
this
.
callType
=
span
.
getCallType
();
this
.
callType
=
span
.
getCallType
();
this
.
businessKey
=
span
.
getBusinessKey
();
this
.
businessKey
=
span
.
getBusinessKey
();
this
.
spanTypeDesc
=
span
.
getSpanTypeDesc
();
this
.
spanTypeDesc
=
span
.
getSpanTypeDesc
();
this
.
username
=
span
.
getUsername
();
this
.
username
=
span
.
getUsername
();
this
.
startDate
=
span
.
getStart
t
ime
();
this
.
startDate
=
span
.
getStart
T
ime
();
this
.
viewPointId
=
span
.
getViewpoint
();
this
.
viewPointId
=
span
.
getViewpoint
();
this
.
spanType
=
span
.
getSpanType
()
+
""
;
this
.
spanType
=
span
.
getSpanType
()
+
""
;
this
.
address
=
span
.
getAddress
();
this
.
address
=
span
.
getAddress
();
...
@@ -48,14 +50,14 @@ public class FullSpan {
...
@@ -48,14 +50,14 @@ public class FullSpan {
this
.
cost
=
span
.
getCost
();
this
.
cost
=
span
.
getCost
();
this
.
exceptionStack
=
span
.
getExceptionStack
();
this
.
exceptionStack
=
span
.
getExceptionStack
();
this
.
statusCode
=
(
byte
)
span
.
getStatusCode
();
this
.
statusCode
=
(
byte
)
span
.
getStatusCode
();
}
}
public
String
getTraceId
()
{
public
String
getTraceId
()
{
return
traceId
;
return
traceId
;
}
}
public
String
getLevelId
()
{
public
int
getLevelId
()
{
return
levelId
;
return
levelId
;
}
}
...
@@ -119,7 +121,7 @@ public class FullSpan {
...
@@ -119,7 +121,7 @@ public class FullSpan {
return
spanType
;
return
spanType
;
}
}
public
void
setLevelId
(
String
levelId
)
{
public
void
setLevelId
(
int
levelId
)
{
this
.
levelId
=
levelId
;
this
.
levelId
=
levelId
;
}
}
...
@@ -128,7 +130,7 @@ public class FullSpan {
...
@@ -128,7 +130,7 @@ public class FullSpan {
}
}
public
String
getTraceLevelId
()
{
public
String
getTraceLevelId
()
{
return
getLevelId
()
;
return
parentLevelId
==
null
||
parentLevelId
.
length
()
==
0
?
levelId
+
""
:
parentLevelId
+
"."
+
levelId
;
}
}
public
void
setViewPointId
(
String
viewPointId
)
{
public
void
setViewPointId
(
String
viewPointId
)
{
...
@@ -142,4 +144,8 @@ public class FullSpan {
...
@@ -142,4 +144,8 @@ public class FullSpan {
public
String
getProcessNo
()
{
public
String
getProcessNo
()
{
return
processNo
;
return
processNo
;
}
}
public
String
getParentLevelId
()
{
return
parentLevelId
;
}
}
}
skywalking-webui/src/main/java/com/a/eye/skywalking/web/dto/TraceNodeInfo.java
浏览文件 @
fcf2b9e4
package
com.a.eye.skywalking.web.dto
;
package
com.a.eye.skywalking.web.dto
;
import
com.a.eye.skywalking.network.grpc.Span
;
import
com.a.eye.skywalking.network.grpc.Span
;
import
com.a.eye.skywalking.util.StringUtil
;
import
com.a.eye.skywalking.web.util.Constants
;
import
com.a.eye.skywalking.web.util.Constants
;
import
com.a.eye.skywalking.web.util.StringUtil
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.Iterator
;
...
@@ -40,17 +40,19 @@ public class TraceNodeInfo extends FullSpan {
...
@@ -40,17 +40,19 @@ public class TraceNodeInfo extends FullSpan {
private
String
serverExceptionStr
;
private
String
serverExceptionStr
;
private
String
parentLevel
;
public
TraceNodeInfo
()
{
public
TraceNodeInfo
()
{
}
}
public
TraceNodeInfo
(
Span
span
)
{
public
TraceNodeInfo
(
Span
span
)
{
super
(
span
);
super
(
span
);
this
.
colId
=
this
.
levelId
;
this
.
colId
=
getTraceLevelId
()
;
// 处理类型key-value
// 处理类型key-value
String
spanTypeStr
=
String
.
valueOf
(
span
.
getSpanTypeDesc
());
String
spanTypeStr
=
String
.
valueOf
(
span
.
getSpanTypeDesc
());
if
(
StringUtil
.
is
Blank
(
spanTypeStr
)
||
Constants
.
SPAN_TYPE_MAP
.
containsKey
(
spanTypeStr
))
{
if
(
StringUtil
.
is
Empty
(
spanTypeStr
)
||
Constants
.
SPAN_TYPE_MAP
.
containsKey
(
spanTypeStr
))
{
this
.
spanTypeStr
=
Constants
.
SPAN_TYPE_U
;
this
.
spanTypeStr
=
Constants
.
SPAN_TYPE_U
;
}
}
this
.
spanTypeStr
=
spanTypeStr
;
this
.
spanTypeStr
=
spanTypeStr
;
...
@@ -63,7 +65,7 @@ public class TraceNodeInfo extends FullSpan {
...
@@ -63,7 +65,7 @@ public class TraceNodeInfo extends FullSpan {
// 处理状态key-value
// 处理状态key-value
String
statusCodeStr
=
String
.
valueOf
(
getStatusCode
());
String
statusCodeStr
=
String
.
valueOf
(
getStatusCode
());
if
(
StringUtil
.
is
Blank
(
statusCodeStr
)
||
Constants
.
STATUS_CODE_MAP
.
containsKey
(
statusCodeStr
))
{
if
(
StringUtil
.
is
Empty
(
statusCodeStr
)
||
Constants
.
STATUS_CODE_MAP
.
containsKey
(
statusCodeStr
))
{
this
.
statusCodeStr
=
Constants
.
STATUS_CODE_9
;
this
.
statusCodeStr
=
Constants
.
STATUS_CODE_9
;
}
}
String
statusCodeName
=
Constants
.
STATUS_CODE_MAP
.
get
(
statusCodeStr
);
String
statusCodeName
=
Constants
.
STATUS_CODE_MAP
.
get
(
statusCodeStr
);
...
@@ -71,7 +73,7 @@ public class TraceNodeInfo extends FullSpan {
...
@@ -71,7 +73,7 @@ public class TraceNodeInfo extends FullSpan {
this
.
statusCodeName
=
statusCodeName
;
this
.
statusCodeName
=
statusCodeName
;
this
.
applicationIdStr
=
this
.
applicationId
;
this
.
applicationIdStr
=
this
.
applicationId
;
if
(!
StringUtil
.
is
Blank
(
this
.
viewPointId
)
&&
this
.
viewPointId
.
length
()
>
60
)
{
if
(!
StringUtil
.
is
Empty
(
this
.
viewPointId
)
&&
this
.
viewPointId
.
length
()
>
60
)
{
this
.
viewPointIdSub
=
this
.
viewPointId
.
substring
(
0
,
30
)
+
"..."
+
this
.
viewPointId
this
.
viewPointIdSub
=
this
.
viewPointId
.
substring
(
0
,
30
)
+
"..."
+
this
.
viewPointId
.
substring
(
this
.
viewPointId
.
length
()
-
30
);
.
substring
(
this
.
viewPointId
.
length
()
-
30
);
}
else
{
}
else
{
...
@@ -80,6 +82,8 @@ public class TraceNodeInfo extends FullSpan {
...
@@ -80,6 +82,8 @@ public class TraceNodeInfo extends FullSpan {
this
.
addTimeLine
(
this
.
startDate
,
this
.
cost
);
this
.
addTimeLine
(
this
.
startDate
,
this
.
cost
);
this
.
endDate
=
this
.
startDate
+
this
.
cost
;
this
.
endDate
=
this
.
startDate
+
this
.
cost
;
this
.
parentLevel
=
getParentLevelId
();
}
}
public
String
getColId
()
{
public
String
getColId
()
{
...
@@ -167,4 +171,8 @@ public class TraceNodeInfo extends FullSpan {
...
@@ -167,4 +171,8 @@ public class TraceNodeInfo extends FullSpan {
public
void
setExceptionStack
(
String
exceptionStack
)
{
public
void
setExceptionStack
(
String
exceptionStack
)
{
this
.
exceptionStack
=
exceptionStack
;
this
.
exceptionStack
=
exceptionStack
;
}
}
public
String
getParentLevel
()
{
return
parentLevel
;
}
}
}
skywalking-webui/src/main/java/com/a/eye/skywalking/web/service/impl/TraceTreeService.java
浏览文件 @
fcf2b9e4
...
@@ -51,7 +51,7 @@ public class TraceTreeService implements ITraceTreeService {
...
@@ -51,7 +51,7 @@ public class TraceTreeService implements ITraceTreeService {
if
(
endTime
.
get
(
0
)
<
arg1
.
getEndDate
())
{
if
(
endTime
.
get
(
0
)
<
arg1
.
getEndDate
())
{
endTime
.
set
(
0
,
arg1
.
getEndDate
());
endTime
.
set
(
0
,
arg1
.
getEndDate
());
}
}
return
SpanLevelIdComparators
.
ascCompare
(
arg0
.
get
ColId
(),
arg1
.
getCo
lId
());
return
SpanLevelIdComparators
.
ascCompare
(
arg0
.
get
TraceLevelId
(),
arg1
.
getTraceLeve
lId
());
}
}
});
});
...
@@ -63,10 +63,6 @@ public class TraceTreeService implements ITraceTreeService {
...
@@ -63,10 +63,6 @@ public class TraceTreeService implements ITraceTreeService {
traceTreeInfo
.
setHasBeenSpiltNodes
(
traceNodeInfoList
.
subList
(
0
,
subIndex
));
traceTreeInfo
.
setHasBeenSpiltNodes
(
traceNodeInfoList
.
subList
(
0
,
subIndex
));
traceTreeInfo
.
setBeginTime
(
traceNodeInfoList
.
get
(
0
).
getStartDate
());
traceTreeInfo
.
setBeginTime
(
traceNodeInfoList
.
get
(
0
).
getStartDate
());
traceTreeInfo
.
setEndTime
(
endTime
.
get
(
0
));
traceTreeInfo
.
setEndTime
(
endTime
.
get
(
0
));
if
(
traceNodeInfoList
.
get
(
0
)
!=
null
)
{
traceTreeInfo
.
fillCallChainTreeToken
(
ReplaceAddressUtil
.
replace
(
traceNodeInfoList
.
get
(
0
).
getViewPointId
(),
traceNodeInfoList
.
get
(
0
).
getApplicationId
()));
}
}
}
return
traceTreeInfo
;
return
traceTreeInfo
;
...
...
skywalking-webui/src/main/java/com/a/eye/skywalking/web/util/SortUtil.java
已删除
100644 → 0
浏览文件 @
ce81b2ee
/**
*
*/
package
com.a.eye.skywalking.web.util
;
import
com.a.eye.skywalking.web.dto.TimeLineEntry
;
import
com.a.eye.skywalking.web.dto.TraceNodeInfo
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.util.Map
;
public
class
SortUtil
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
SortUtil
.
class
);
public
static
void
addCurNodeTreeMapKey
(
Map
<
String
,
TraceNodeInfo
>
reMap
,
String
colId
,
TraceNodeInfo
tmpEntry
)
{
reMap
.
put
(
colId
,
tmpEntry
);
// 根据当前Id查找上级,如果不存在,插入空,再看上级,如果不存在还插入空,直到根"0"
while
(
colId
.
indexOf
(
Constants
.
VAL_SPLIT_CHAR
)
>
-
1
)
{
colId
=
colId
.
substring
(
0
,
colId
.
lastIndexOf
(
Constants
.
VAL_SPLIT_CHAR
));
if
(!
addParentNodeTreeMapKey
(
reMap
,
colId
))
{
break
;
}
}
}
private
static
boolean
addParentNodeTreeMapKey
(
Map
<
String
,
TraceNodeInfo
>
reMap
,
String
colId
)
{
if
(
reMap
.
containsKey
(
colId
))
{
return
false
;
}
else
{
// 增加虚拟节点
reMap
.
put
(
colId
,
addLostBuriedPointEntry
(
colId
));
// 根据当前Id查找上级,如果不存在,插入空,再看上级,如果不存在还插入空,直到根"0"
while
(
colId
.
indexOf
(
Constants
.
VAL_SPLIT_CHAR
)
>
-
1
)
{
colId
=
colId
.
substring
(
0
,
colId
.
lastIndexOf
(
Constants
.
VAL_SPLIT_CHAR
));
if
(!
addParentNodeTreeMapKey
(
reMap
,
colId
))
{
break
;
}
}
return
false
;
}
}
/***
* 补充丢失的链路信息
*
* @param colId
* @return
*/
public
static
TraceNodeInfo
addLostBuriedPointEntry
(
String
colId
)
{
TraceNodeInfo
result
=
new
TraceNodeInfo
();
result
.
setColId
(
colId
);
result
.
setLevelId
(
colId
);
result
.
getTimeLineList
().
add
(
new
TimeLineEntry
());
// 其它默认值
return
result
;
}
}
skywalking-webui/src/main/java/com/a/eye/skywalking/web/util/StringUtil.java
已删除
100644 → 0
浏览文件 @
ce81b2ee
package
com.a.eye.skywalking.web.util
;
public
class
StringUtil
{
public
static
boolean
isBlank
(
String
str
)
{
if
(
str
==
null
||
str
.
length
()
==
0
)
{
return
true
;
}
return
false
;
}
}
skywalking-webui/src/main/resources/jdbc.properties
浏览文件 @
fcf2b9e4
jdbc.driverClassName
=
com.mysql.jdbc.Driver
jdbc.driverClassName
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://localhost:330
6/sw_db
jdbc.url
=
jdbc:mysql://localhost:330
7/test
jdbc.username
=
sw_dbusr
jdbc.username
=
root
jdbc.password
=
sw_dbusr
jdbc.password
=
root
jdbc.maxTotal
=
200
jdbc.maxTotal
=
200
jdbc.maxIdle
=
50
jdbc.maxIdle
=
50
jdbc.maxWaitMillis
=
1000
jdbc.maxWaitMillis
=
1000
...
...
skywalking-webui/src/main/sql/table.mysql
浏览文件 @
fcf2b9e4
...
@@ -96,22 +96,3 @@ CREATE TABLE IF NOT EXISTS `exclude_rule` (
...
@@ -96,22 +96,3 @@ CREATE TABLE IF NOT EXISTS `exclude_rule` (
ENGINE = InnoDB;
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `system_config`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `system_config` ;
CREATE TABLE IF NOT EXISTS `system_config` (
`config_id` INT UNSIGNED NOT NULL,
`conf_key` VARCHAR(200) NOT NULL,
`conf_value` VARCHAR(500) NOT NULL,
`val_type` VARCHAR(45) NOT NULL,
`val_desc` VARCHAR(200) NULL,
`create_time` DATETIME NULL,
`sts` VARCHAR(2) NOT NULL,
`modify_time` DATETIME NULL,
PRIMARY KEY (`config_id`),
UNIQUE INDEX `conf_key_UNIQUE` (`conf_key` ASC))
ENGINE = InnoDB;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录