-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/DRAW-241' into sandbox
- Loading branch information
Showing
11 changed files
with
82 additions
and
1 deletion.
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
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
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
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
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,11 @@ | ||
import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter-actuator:${Versions.SPRING_BOOT}") | ||
implementation("io.micrometer:micrometer-registry-prometheus:${Versions.MICROMETER}") | ||
} | ||
|
||
tasks { | ||
withType<Jar> { enabled = true } | ||
withType<BootJar> { enabled = false } | ||
} |
41 changes: 41 additions & 0 deletions
41
support/metric/src/main/kotlin/com/xorker/draw/support/metric/MetricManager.kt
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,41 @@ | ||
package com.xorker.draw.support.metric | ||
|
||
import io.micrometer.core.instrument.Gauge | ||
import io.micrometer.core.instrument.MeterRegistry | ||
import java.util.concurrent.atomic.AtomicInteger | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class MetricManager( | ||
private val metric: MeterRegistry, | ||
) { | ||
private val connectedWebSocketCount: AtomicInteger = AtomicInteger() | ||
private val playingPlayingRoomCount: AtomicInteger = AtomicInteger() | ||
|
||
init { | ||
Gauge | ||
.builder("connect_websocket_gauge", connectedWebSocketCount) { it.toDouble() } | ||
.register(metric) | ||
|
||
Gauge | ||
.builder("playing_game_room_gauge", playingPlayingRoomCount) { it.toDouble() } | ||
.register(metric) | ||
|
||
} | ||
|
||
fun increaseWebsocket() { | ||
connectedWebSocketCount.incrementAndGet() | ||
} | ||
|
||
fun decreaseWebsocket() { | ||
connectedWebSocketCount.decrementAndGet() | ||
} | ||
|
||
fun increaseGameCount(){ | ||
playingPlayingRoomCount.incrementAndGet() | ||
} | ||
|
||
fun decreaseGameCount(){ | ||
playingPlayingRoomCount.decrementAndGet() | ||
} | ||
} |
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,11 @@ | ||
management: | ||
endpoints: | ||
web: | ||
exposure: | ||
include: prometheus | ||
endpoint: | ||
prometheus: | ||
enabled: true | ||
# metrics: | ||
# tags: | ||
# application: ${spring.application.name} |