Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asset-distribution
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
asset-distribution
Commits
73dc6773
Commit
73dc6773
authored
Sep 14, 2021
by
shihuajun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加报警机制
parent
303ca531
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
pom.xml
pom.xml
+11
-0
CustomSentryExceptionResolver.java
...ribution/config/sentry/CustomSentryExceptionResolver.java
+22
-0
SentryConfig.java
...tgroup/asset/distribution/config/sentry/SentryConfig.java
+31
-0
No files found.
pom.xml
View file @
73dc6773
...
@@ -377,5 +377,16 @@
...
@@ -377,5 +377,16 @@
<artifactId>
hutool-all
</artifactId>
<artifactId>
hutool-all
</artifactId>
<version>
5.6.3
</version>
<version>
5.6.3
</version>
</dependency>
</dependency>
<dependency>
<groupId>
io.sentry
</groupId>
<artifactId>
sentry
</artifactId>
<version>
1.6.3
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.sentry/sentry-spring -->
<dependency>
<groupId>
io.sentry
</groupId>
<artifactId>
sentry-spring
</artifactId>
<version>
1.6.3
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
src/main/java/com/quantgroup/asset/distribution/config/sentry/CustomSentryExceptionResolver.java
0 → 100644
View file @
73dc6773
package
com
.
quantgroup
.
asset
.
distribution
.
config
.
sentry
;
import
io.sentry.Sentry
;
import
org.springframework.core.Ordered
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
public
class
CustomSentryExceptionResolver
implements
HandlerExceptionResolver
,
Ordered
{
@Override
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
{
Sentry
.
capture
(
ex
);
return
null
;
}
@Override
public
int
getOrder
()
{
return
Integer
.
MIN_VALUE
;
}
}
src/main/java/com/quantgroup/asset/distribution/config/sentry/SentryConfig.java
0 → 100644
View file @
73dc6773
package
com
.
quantgroup
.
asset
.
distribution
.
config
.
sentry
;
import
cn.quantgroup.tech.util.TechEnvironment
;
import
io.sentry.Sentry
;
import
io.sentry.spring.SentryServletContextInitializer
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
javax.annotation.PostConstruct
;
@Configuration
public
class
SentryConfig
{
@Bean
public
HandlerExceptionResolver
sentryExceptionResolver
()
{
return
new
CustomSentryExceptionResolver
();
}
@Bean
public
SentryServletContextInitializer
sentryServletContextInitializer
()
{
return
new
io
.
sentry
.
spring
.
SentryServletContextInitializer
();
}
@PostConstruct
public
void
initSentry
()
{
// if (TechEnvironment.isPro()) {
// }
Sentry
.
init
(
"http://a2d2ecc94b1d421cac7c2ea2abe2f34a:d1ea101bb7d046888e6e8150da152dad@sentry.quantgroups.com/77"
);
}
}
\ No newline at end of file
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