Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
commons
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
3
Merge Requests
3
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
DevOps
commons
Commits
f7289d7d
Commit
f7289d7d
authored
Feb 06, 2020
by
杨锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增sentry-starter
parent
4a6d0577
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
170 additions
and
9 deletions
+170
-9
pom.xml
brave-spring-boot-starter/pom.xml
+1
-1
pom.xml
commons-core/pom.xml
+1
-1
pom.xml
commons-spring/pom.xml
+1
-1
pom.xml
elastic-job-lite-spring-boot-starter/pom.xml
+1
-1
pom.xml
enoch-agent-spring-boot-starter/pom.xml
+1
-1
pom.xml
idgenerator-spring-boot-starter/pom.xml
+1
-1
pom.xml
pom.xml
+3
-2
pom.xml
sentry-starter/pom.xml
+38
-0
CustomSentryExceptionResolver.java
...quantgroup/tech/sentry/CustomSentryExceptionResolver.java
+37
-0
NoSentryCaptureRuntimeException.java
...antgroup/tech/sentry/NoSentryCaptureRuntimeException.java
+23
-0
SentryCaptureRuntimeException.java
...quantgroup/tech/sentry/SentryCaptureRuntimeException.java
+23
-0
SentryConfig.java
...src/main/java/cn/quantgroup/tech/sentry/SentryConfig.java
+37
-0
spring.factories
sentry-starter/src/main/resources/META-INF/spring.factories
+2
-0
pom.xml
shutdown-spring-boot-starter/pom.xml
+1
-1
No files found.
brave-spring-boot-starter/pom.xml
View file @
f7289d7d
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
commons-core/pom.xml
View file @
f7289d7d
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
commons-spring/pom.xml
View file @
f7289d7d
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
elastic-job-lite-spring-boot-starter/pom.xml
View file @
f7289d7d
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
enoch-agent-spring-boot-starter/pom.xml
View file @
f7289d7d
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
</parent>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
enoch-agent-spring-boot-starter
</artifactId>
...
...
idgenerator-spring-boot-starter/pom.xml
View file @
f7289d7d
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
pom.xml
View file @
f7289d7d
...
...
@@ -6,7 +6,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons-parent
</artifactId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -22,6 +22,7 @@
<module>
idgenerator-spring-boot-starter
</module>
<module>
enoch-agent-spring-boot-starter
</module>
<module>
elastic-job-lite-spring-boot-starter
</module>
<module>
sentry-starter
</module>
</modules>
<packaging>
pom
</packaging>
...
...
@@ -35,7 +36,7 @@
<lombok.version>
1.16.20
</lombok.version>
<guava.version>
23.0
</guava.version>
<apollo.client.version>
0.10.2
</apollo.client.version>
<common.parent.version>
0.2.
6
</common.parent.version>
<common.parent.version>
0.2.
7
</common.parent.version>
</properties>
<dependencies>
...
...
sentry-starter/pom.xml
0 → 100644
View file @
f7289d7d
<?xml version="1.0" encoding="UTF-8"?>
<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>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
sentry-starter
</artifactId>
<name>
sentry-starter
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
io.sentry
</groupId>
<artifactId>
sentry-spring
</artifactId>
<version>
1.6.3
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons-spring
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
</project>
sentry-starter/src/main/java/cn/quantgroup/tech/sentry/CustomSentryExceptionResolver.java
0 → 100644
View file @
f7289d7d
package
cn
.
quantgroup
.
tech
.
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
;
/**
* {@link HandlerExceptionResolver} implementation that will record any exception that a
* Spring {@link org.springframework.web.servlet.mvc.Controller} throws to Sentry. It then
* returns null, which will let the other (default or custom) exception resolvers handle
* the actual error.
*/
public
class
CustomSentryExceptionResolver
implements
HandlerExceptionResolver
,
Ordered
{
@Override
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
{
if
(
ex
instanceof
NoSentryCaptureRuntimeException
)
{
return
null
;
}
Sentry
.
capture
(
ex
);
// null = run other HandlerExceptionResolvers to actually handle the exception
return
null
;
}
@Override
public
int
getOrder
()
{
// ensure this resolver runs first so that all exceptions are reported
return
Integer
.
MIN_VALUE
;
}
}
\ No newline at end of file
sentry-starter/src/main/java/cn/quantgroup/tech/sentry/NoSentryCaptureRuntimeException.java
0 → 100644
View file @
f7289d7d
package
cn
.
quantgroup
.
tech
.
sentry
;
public
class
NoSentryCaptureRuntimeException
extends
RuntimeException
{
public
NoSentryCaptureRuntimeException
()
{
}
public
NoSentryCaptureRuntimeException
(
String
message
)
{
super
(
message
);
}
public
NoSentryCaptureRuntimeException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
NoSentryCaptureRuntimeException
(
Throwable
cause
)
{
super
(
cause
);
}
public
NoSentryCaptureRuntimeException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
sentry-starter/src/main/java/cn/quantgroup/tech/sentry/SentryCaptureRuntimeException.java
0 → 100644
View file @
f7289d7d
package
cn
.
quantgroup
.
tech
.
sentry
;
public
class
SentryCaptureRuntimeException
extends
RuntimeException
{
public
SentryCaptureRuntimeException
()
{
}
public
SentryCaptureRuntimeException
(
String
message
)
{
super
(
message
);
}
public
SentryCaptureRuntimeException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
SentryCaptureRuntimeException
(
Throwable
cause
)
{
super
(
cause
);
}
public
SentryCaptureRuntimeException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
sentry-starter/src/main/java/cn/quantgroup/tech/sentry/SentryConfig.java
0 → 100644
View file @
f7289d7d
package
cn
.
quantgroup
.
tech
.
sentry
;
import
cn.quantgroup.tech.util.TechEnvironment
;
import
io.sentry.Sentry
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
javax.annotation.PostConstruct
;
@Configuration
@ConditionalOnProperty
(
name
=
"dsn"
)
public
class
SentryConfig
{
@Value
(
"${dsn}"
)
private
String
dsn
;
@Bean
public
HandlerExceptionResolver
sentryExceptionResolver
()
{
return
new
CustomSentryExceptionResolver
();
}
@Bean
public
ServletContextInitializer
sentryServletContextInitializer
()
{
return
new
io
.
sentry
.
spring
.
SentryServletContextInitializer
();
}
@PostConstruct
public
void
initSentry
()
{
if
(
TechEnvironment
.
isPro
())
{
Sentry
.
init
(
dsn
);
}
}
}
sentry-starter/src/main/resources/META-INF/spring.factories
0 → 100644
View file @
f7289d7d
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.quantgroup.tech.sentry.SentryConfig
\ No newline at end of file
shutdown-spring-boot-starter/pom.xml
View file @
f7289d7d
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.2.
6
</version>
<version>
0.2.
7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
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