-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
103 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,49 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
id("org.springframework.boot") version "3.1.2" | ||
id("io.spring.dependency-management") version "1.1.2" | ||
kotlin("jvm") version "1.8.22" | ||
kotlin("plugin.spring") version "1.8.22" | ||
id("org.springframework.boot") version "3.1.2" | ||
id("io.spring.dependency-management") version "1.1.2" | ||
kotlin("jvm") version "1.8.22" | ||
kotlin("plugin.spring") version "1.8.22" | ||
} | ||
|
||
group = "2joryu" | ||
version = "0.0.1-SNAPSHOT" | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom(configurations.annotationProcessor.get()) | ||
} | ||
compileOnly { | ||
extendsFrom(configurations.annotationProcessor.get()) | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation ("org.springframework.boot:spring-boot-starter-data-jpa") | ||
compileOnly("org.projectlombok:lombok") | ||
annotationProcessor("org.projectlombok:lombok") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
runtimeOnly("com.mysql:mysql-connector-j") | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
implementation("org.springframework.boot:spring-boot-starter-actuator") | ||
implementation("io.micrometer:micrometer-registry-prometheus") | ||
compileOnly("org.projectlombok:lombok") | ||
annotationProcessor("org.projectlombok:lombok") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
runtimeOnly("com.mysql:mysql-connector-j") | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
freeCompilerArgs += "-Xjsr305=strict" | ||
jvmTarget = "17" | ||
} | ||
kotlinOptions { | ||
freeCompilerArgs += "-Xjsr305=strict" | ||
jvmTarget = "17" | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
global: | ||
scrape_interval: 15s # scrap target의 기본 interval을 15초로 변경 / default = 1m | ||
scrape_timeout: 15s # scrap request 가 timeout 나는 길이 / default = 10s | ||
evaluation_interval: 2m # rule 을 얼마나 빈번하게 검증하는지 / default = 1m | ||
|
||
external_labels: | ||
monitor: 'ktwitter-monitor' # 기본적으로 붙여줄 라벨 | ||
query_log_file: query_log_file.log # prometheus의 쿼리 로그들을 기록, 없으면 기록안함 | ||
|
||
rule_files: | ||
- "rule.yml" # 파일 위치는 prometheus.yaml 이 있는 곳과 동일 위치 | ||
|
||
scrape_configs: | ||
- job_name: "prometheus" | ||
static_configs: | ||
- targets: | ||
- "localhost:9090" | ||
- job_name: "springboot" | ||
metrics_path: "/actuator/prometheus" | ||
scheme: 'http' | ||
scrape_interval: 5s | ||
static_configs: | ||
- targets: | ||
- "localhost:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
groups: | ||
- name: ktwitter | ||
rules: | ||
- alert: InstanceDown | ||
expr: up == 0 | ||
for: 5m | ||
labels: | ||
severity: page | ||
annotations: | ||
summary: "Instance {{ $labels.instance }} down" | ||
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes." | ||
|
||
- alert: APIHighRequestLatency | ||
expr: api_http_request_latencies_second{quantile="0.5"} > 1 | ||
for: 10m | ||
annotations: | ||
summary: "High request latency on {{ $labels.instance }}" | ||
description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters