Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhuyifan
2025-04-24 17:14:18 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
32a4a0168c1689b5bcff1d894f359b330a08cc5f
32a4a016
1 parent
79476f7c
fix
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
src/main/java/com/tianting/infoloop/tracing/MysqlZipkinInterceptor.java
src/main/java/com/tianting/infoloop/tracing/MysqlZipkinInterceptor.java
View file @
32a4a01
...
...
@@ -56,7 +56,9 @@ public class MysqlZipkinInterceptor implements StatementInterceptorV2 {
private
Tracing
getTracing
()
{
if
(
tracing
==
null
)
{
tracing
=
AppConfig
.
APP_CONTEXT
.
getBean
(
Tracing
.
class
);
tracing
=
AppConfig
.
APP_CONTEXT
!=
null
?
AppConfig
.
APP_CONTEXT
.
getBean
(
Tracing
.
class
)
:
null
;
}
return
tracing
;
}
...
...
@@ -70,6 +72,9 @@ public class MysqlZipkinInterceptor implements StatementInterceptorV2 {
final
Statement
interceptedStatement
,
final
Connection
connection
)
throws
SQLException
{
final
var
tracing
=
getTracing
();
if
(
tracing
==
null
)
{
return
null
;
}
final
var
context
=
tracing
.
currentTraceContext
().
get
();
final
var
sqlStr
=
sql
!=
null
?
sql
:
interceptedStatement
.
toString
();
log
.
info
(
"sql exec: {}"
,
sqlStr
.
replace
(
"\n"
,
""
));
...
...
@@ -110,6 +115,9 @@ public class MysqlZipkinInterceptor implements StatementInterceptorV2 {
final
boolean
noGoodIndexUsed
,
final
SQLException
statementException
)
throws
SQLException
{
final
var
tracing
=
getTracing
();
if
(
tracing
==
null
)
{
return
null
;
}
final
var
span
=
ThreadLocalSpan
.
CURRENT_TRACER
.
remove
();
if
(
statementException
!=
null
)
{
log
.
error
(
"sql exec failed"
,
statementException
);
...
...
Please
register
or
login
to post a comment