File tree Expand file tree Collapse file tree 11 files changed +96
-22
lines changed
kotlin/org/yapp/apis/config Expand file tree Collapse file tree 11 files changed +96
-22
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ springdoc:
3434 enabled : true
3535 override-with-generic-response : false
3636
37+ app :
38+ module-name : admin
39+
3740---
3841spring :
3942 config :
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ import org.yapp.infra.InfraBaseConfigGroup
1313 InfraBaseConfigGroup .REST_CLIENT ,
1414 InfraBaseConfigGroup .QUERY_DSL ,
1515 InfraBaseConfigGroup .PAGE ,
16- InfraBaseConfigGroup .AOP
16+ InfraBaseConfigGroup .AOP ,
17+ InfraBaseConfigGroup .SENTRY
1718 ]
1819)
1920class InfraConfig
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ springdoc:
4242 enabled : true
4343 override-with-generic-response : false
4444
45+ app :
46+ module-name : apis
47+
4548---
4649spring :
4750 config :
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ spring:
2323 max-file-size : 10MB
2424 max-request-size : 30MB
2525
26+ app :
27+ module-name : batch
28+
2629---
2730spring :
2831 config :
Original file line number Diff line number Diff line change @@ -70,4 +70,9 @@ object Dependencies {
7070 object Prometheus {
7171 const val MICROMETER_PROMETHEUS_REGISTRY = " io.micrometer:micrometer-registry-prometheus"
7272 }
73+
74+ object Sentry {
75+ const val SPRING_BOOT_STARTER = " io.sentry:sentry-spring-boot-starter-jakarta:8.22.0"
76+ const val LOG4J2 = " io.sentry:sentry-log4j2:8.22.0"
77+ }
7378}
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ dependencies {
1717
1818 implementation(Dependencies .QueryDsl .JPA )
1919
20+ implementation(Dependencies .Sentry .SPRING_BOOT_STARTER )
21+ implementation(Dependencies .Sentry .LOG4J2 )
22+
2023 kapt(Dependencies .QueryDsl .APT )
2124
2225 testImplementation(Dependencies .Spring .BOOT_STARTER_TEST )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import org.yapp.infra.config.internal.async.AsyncConfig
77import org.yapp.infra.config.internal.jpa.JpaConfig
88import org.yapp.infra.config.internal.page.PageConfig
99import org.yapp.infra.config.internal.querydsl.QuerydslConfig
10+ import org.yapp.infra.config.external.sentry.SentryConfig
1011
1112enum class InfraBaseConfigGroup (
1213 val configClass : Class <out InfraBaseConfig >
@@ -17,5 +18,6 @@ enum class InfraBaseConfigGroup(
1718 REDIS (RedisConfig ::class .java),
1819 REST_CLIENT (RestClientConfig ::class .java),
1920 QUERY_DSL (QuerydslConfig ::class .java),
20- AOP (AopConfig ::class .java)
21+ AOP (AopConfig ::class .java),
22+ SENTRY (SentryConfig ::class .java)
2123}
Original file line number Diff line number Diff line change 1+ package org.yapp.infra.config.external.sentry
2+
3+ import io.sentry.Sentry
4+ import io.sentry.SentryOptions
5+ import org.springframework.beans.factory.annotation.Value
6+ import org.springframework.boot.context.properties.EnableConfigurationProperties
7+ import org.springframework.context.annotation.Bean
8+ import org.springframework.context.annotation.Configuration
9+ import org.yapp.infra.InfraBaseConfig
10+
11+ @Configuration
12+ @EnableConfigurationProperties(SentryProperties ::class )
13+ class SentryConfig (
14+ private val sentryProperties : SentryProperties ,
15+ @Value(" \$ {app.module-name}" )
16+ private val moduleName : String
17+ ) : InfraBaseConfig {
18+
19+ @Bean
20+ fun sentryOptionsCustomizer (): Sentry .OptionsConfiguration <SentryOptions > {
21+ return Sentry .OptionsConfiguration { options: SentryOptions ->
22+ if (sentryProperties.dsn.isBlank()) {
23+ options.isEnabled = false
24+ return @OptionsConfiguration
25+ }
26+
27+ options.dsn = sentryProperties.dsn
28+ options.environment = sentryProperties.environment
29+ options.serverName = sentryProperties.serverName
30+ options.setTag(" module" , moduleName)
31+ }
32+ }
33+ }
34+
35+
Original file line number Diff line number Diff line change 1+ package org.yapp.infra.config.external.sentry
2+
3+ import org.springframework.boot.context.properties.ConfigurationProperties
4+
5+ @ConfigurationProperties(prefix = " sentry" )
6+ data class SentryProperties (
7+ val dsn : String ,
8+ val environment : String ,
9+ val serverName : String ,
10+ )
Original file line number Diff line number Diff line change @@ -10,6 +10,18 @@ logging:
1010 controller :
1111 enabled : true
1212
13+ sentry :
14+ dsn : ${SENTRY_DSN}
15+ environment : ${SENTRY_ENVIRONMENT}
16+ server-name : ${SENTRY_SERVER_NAME}
17+ traces-sample-rate : 1.0
18+ send-default-pii : true
19+ logs :
20+ enabled : true
21+ logging :
22+ minimum-event-level : error
23+ minimum-breadcrumb-level : info
24+
1325---
1426spring :
1527 config :
@@ -25,3 +37,15 @@ logging:
2537 max-log-length : 500
2638 controller :
2739 enabled : true
40+
41+ sentry :
42+ dsn :
43+ environment : test
44+ server-name : reed-test
45+ traces-sample-rate : 1.0
46+ send-default-pii : true
47+ logs :
48+ enabled : true
49+ logging :
50+ minimum-event-level : error
51+ minimum-breadcrumb-level : info
You can’t perform that action at this time.
0 commit comments