Skip to content

Commit

Permalink
모니터링 환경 설정 (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
juno-junho authored Jan 11, 2024
1 parent 175ab65 commit 2c2ebd1
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id "com.gorylenko.gradle-git-properties" version "2.4.1" // actuator git 정보 추가
}

group = 'com.spaceclub'
Expand Down Expand Up @@ -53,6 +54,10 @@ dependencies {
// mail
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'

// monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('test') {
Expand Down Expand Up @@ -92,3 +97,8 @@ bootJar {
into 'static/docs'
}
}

// actuator 빌드 정보 추가
springBoot {
buildInfo()
}
15 changes: 15 additions & 0 deletions src/main/java/com/spaceclub/global/ActuatorConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.spaceclub.global;

import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ActuatorConfig {

@Bean
public InMemoryHttpExchangeRepository httpExchangeRepository() {
return new InMemoryHttpExchangeRepository();
}

}
32 changes: 32 additions & 0 deletions src/main/resources/application-actuator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
management:
info:
java: ## 자바 런타임 정보
enabled: true
os: ## OS 정보
enabled: true
env: ## Environment에서 info.로 시작하는정보
enabled: true
git: ## git 정보
mode: full
build: ## 빌드 정보
enabled: true

endpoint:
health:
show-components: always

endpoints:
web:
exposure:
include: "*"

info:
app:
name: space-club-backend
company: space-club

## 톰캣의 최대 쓰레드, 사용 쓰레드 수 포함 다양 메트릭 확인 가능
server:
tomcat:
mbeanregistry:
enabled: true
5 changes: 5 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ spring:
multipart:
max-file-size: 10MB
max-request-size: 10MB

profiles:
active: local

jpa:
open-in-view: false

Expand Down Expand Up @@ -32,6 +34,9 @@ spring:
suffix: .html
mode: HTML5

config:
import: classpath:application-actuator.yml

mail:
properties:
background-url: static/images/backgroundImage.jpeg
Expand Down

0 comments on commit 2c2ebd1

Please sign in to comment.