diff --git a/build.gradle b/build.gradle index 5279bf5..b830317 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-aop' - implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-webflux' @@ -59,6 +58,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' testImplementation 'com.h2database:h2' + + // Monitoring + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'io.micrometer:micrometer-registry-prometheus' } // QueryDSL Settings diff --git a/src/main/java/org/terning/terningserver/common/config/SecurityConfig.java b/src/main/java/org/terning/terningserver/common/config/SecurityConfig.java index f984b4f..518bdb2 100644 --- a/src/main/java/org/terning/terningserver/common/config/SecurityConfig.java +++ b/src/main/java/org/terning/terningserver/common/config/SecurityConfig.java @@ -32,7 +32,8 @@ public class SecurityConfig { "/api/v1/users/**", "/api/v1/push-status", "/api/v1/external/scraps/unsynced", - "/api/v1/external/scraps/sync/result" + "/api/v1/external/scraps/sync/result", + "/actuator/**", }; @Bean diff --git a/src/main/java/org/terning/terningserver/external/pushNotification/user/domain/UserSyncEvent.java b/src/main/java/org/terning/terningserver/external/pushNotification/user/domain/UserSyncEvent.java index 5583aee..ca6c090 100644 --- a/src/main/java/org/terning/terningserver/external/pushNotification/user/domain/UserSyncEvent.java +++ b/src/main/java/org/terning/terningserver/external/pushNotification/user/domain/UserSyncEvent.java @@ -1,6 +1,7 @@ package org.terning.terningserver.external.pushNotification.user.domain; import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; @@ -24,7 +25,7 @@ public class UserSyncEvent { private Long userId; - @Enumerated + @Enumerated(EnumType.STRING) private UserSyncEventType eventType; private String newValue; diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 8d18327..b86d998 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -1,36 +1,36 @@ -spring: - datasource: - url: jdbc:h2:mem:testdb;MODE=PostgreSQL;DATABASE_TO_UPPER=FALSE - username: sa - password: -# driver-class-name: org.h2.Driver - - jpa: - hibernate: - ddl-auto: create-drop - properties: - hibernate: - dialect: org.hibernate.dialect.H2Dialect - format_sql: true - show-sql: true - - h2: - console: - enabled: true - path: /h2-console - - batch: - job: - enabled: false - -jwt: - secret-key: "this-is-a-temporary-secret-key-for-local-tests-1234567890" - access-token-expired: 3600000 - refresh-token-expired: 86400000 - -operation: - base-url: http://localhost:9999 - -discord: - webhook: - url: "https://discord.com/api/webhooks/test/test" +#spring: +# datasource: +# url: jdbc:h2:mem:testdb;MODE=PostgreSQL;DATABASE_TO_UPPER=FALSE +# username: sa +# password: +## driver-class-name: org.h2.Driver +# +# jpa: +# hibernate: +# ddl-auto: create-drop +# properties: +# hibernate: +# dialect: org.hibernate.dialect.H2Dialect +# format_sql: true +# show-sql: true +# +# h2: +# console: +# enabled: true +# path: /h2-console +# +# batch: +# job: +# enabled: false +# +#jwt: +# secret-key: "this-is-a-temporary-secret-key-for-local-tests-1234567890" +# access-token-expired: 3600000 +# refresh-token-expired: 86400000 +# +#operation: +# base-url: http://localhost:9999 +# +#discord: +# webhook: +# url: "https://discord.com/api/webhooks/test/test" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ec01946..bb1cc26 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -53,3 +53,12 @@ discord: firebase: service-key: ${FIREBASE_SERVICE_KEY_JSON} + +management: + endpoints: + web: + exposure: + include: prometheus + endpoint: + prometheus: + enabled: true