Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
83d052ae
Commit
83d052ae
authored
Jun 24, 2019
by
QIANGLU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加防灾冗余
parent
987c8adf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
25 deletions
+24
-25
pom.xml
config-starter/pom.xml
+5
-0
LoggerFilter.java
monitor-starter/src/main/java/com/secoo/matrix/monitor/rcp/filter/LoggerFilter.java
+14
-25
pom.xml
pom.xml
+5
-0
No files found.
config-starter/pom.xml
View file @
83d052ae
...
...
@@ -21,6 +21,10 @@
<artifactId>
apollo-client
</artifactId>
<version>
1.4.0
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
monitor-starter
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
monitor-starter/src/main/java/com/secoo/matrix/monitor/rcp/filter/LoggerFilter.java
View file @
83d052ae
...
...
@@ -21,43 +21,32 @@ public class LoggerFilter implements Filter {
@Override
public
Result
invoke
(
Invoker
<?>
invoker
,
Invocation
invocation
)
throws
RpcException
{
long
startTime
=
System
.
currentTimeMillis
();
RpcContext
rpcContext
=
RpcContext
.
getContext
();
URL
url
=
rpcContext
.
getUrl
();
String
who
=
url
.
getParameter
(
"side"
);
String
serviceName
=
url
.
getParameter
(
"application
"
);
//CONSUMER 从MDC中获取RPCID并增加其序列,传递最新序列唯一ID到下一层
try
{
String
who
=
url
.
getParameter
(
"side
"
);
//CONSUMER 从MDC中获取RPCID并增加其序列,传递最新序列唯一ID到下一层
if
(
MonitorConstant
.
CONSUMER
.
equals
(
who
))
{
if
(
MonitorConstant
.
CONSUMER
.
equals
(
who
))
{
String
traceId
=
TraceIDUtils
.
continueTraceID
();
rpcContext
.
setAttachment
(
MonitorConstant
.
TRACE_ID
,
traceId
);
String
traceId
=
TraceIDUtils
.
continueTraceID
();
rpcContext
.
setAttachment
(
MonitorConstant
.
TRACE_ID
,
traceId
);
LOG
.
info
(
"consumer: source[{}, {}], target[{}],arguments[{}]"
,
rpcContext
.
getLocalAddressString
(),
serviceName
,
rpcContext
.
getRemoteAddressString
(),
rpcContext
.
getArguments
());
}
else
if
(
MonitorConstant
.
PROVIDER
.
equals
(
who
))
{
MDC
.
remove
(
MonitorConstant
.
TRACE_ID
);
MDC
.
remove
(
"rpcId"
);
String
traceId
=
rpcContext
.
getAttachment
(
MonitorConstant
.
TRACE_ID
);
TraceIDUtils
.
childTraceID
(
traceId
);
}
}
else
if
(
MonitorConstant
.
PROVIDER
.
equals
(
who
))
{
MDC
.
remove
(
MonitorConstant
.
TRACE_ID
);
MDC
.
remove
(
"rpcId"
);
String
traceId
=
rpcContext
.
getAttachment
(
MonitorConstant
.
TRACE_ID
);
TraceIDUtils
.
childTraceID
(
traceId
);
}
catch
(
Exception
e
)
{
LOG
.
info
(
"provider: source[{}], target[{}, {}],arguments[{}]"
,
rpcContext
.
getRemoteAddressString
(),
rpcContext
.
getLocalAddressString
(),
serviceName
,
rpcContext
.
getArguments
());
}
Result
result
=
invoker
.
invoke
(
invocation
);
long
stopTime
=
System
.
currentTimeMillis
();
LOG
.
info
(
"service[{}] is finished, waste time [{}ms] "
,
serviceName
,
stopTime
-
startTime
);
return
result
;
return
invoker
.
invoke
(
invocation
);
}
}
pom.xml
View file @
83d052ae
...
...
@@ -97,6 +97,11 @@
<dependencies>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
monitor-starter
</artifactId>
<version>
1.0.3-DEV-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
common-core
</artifactId>
<version>
1.0.3-DEV-SNAPSHOT
</version>
</dependency>
...
...
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