summaryrefslogtreecommitdiff
path: root/sw-server
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2021-02-13 19:19:55 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2021-02-13 19:47:03 +0100
commitc77fc93bb404b4af04e931a7672f97bf9f591911 (patch)
treeff1a34a4ab5bb92fa76d53ade1b76ebeb547cf78 /sw-server
parentReduce prometheus scraping period (diff)
downloadseven-wonders-c77fc93bb404b4af04e931a7672f97bf9f591911.tar.gz
seven-wonders-c77fc93bb404b4af04e931a7672f97bf9f591911.tar.bz2
seven-wonders-c77fc93bb404b4af04e931a7672f97bf9f591911.zip
Add metrics labels for default Spring Boot grafana board
https://grafana.com/grafana/dashboards/6756
Diffstat (limited to 'sw-server')
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/SevenWonders.kt10
1 files changed, 10 insertions, 0 deletions
diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/SevenWonders.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/SevenWonders.kt
index 2485a28f..f9167a1a 100644
--- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/SevenWonders.kt
+++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/SevenWonders.kt
@@ -1,10 +1,13 @@
package org.luxons.sevenwonders.server
+import io.micrometer.core.instrument.MeterRegistry
+import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.autoconfigure.http.HttpMessageConverters
import org.springframework.boot.runApplication
import org.springframework.context.annotation.Bean
import org.springframework.http.converter.json.KotlinSerializationJsonHttpMessageConverter
+import java.net.InetAddress
@SpringBootApplication
class SevenWonders {
@@ -13,6 +16,13 @@ class SevenWonders {
fun additionalConverters(): HttpMessageConverters? {
return HttpMessageConverters(KotlinSerializationJsonHttpMessageConverter())
}
+
+ @Bean
+ fun metricsCommonTags(): MeterRegistryCustomizer<MeterRegistry>? = MeterRegistryCustomizer { registry ->
+ registry.config()
+ .commonTags("application", "SevenWonders")
+ .commonTags("instance", InetAddress.getLocalHost().hostAddress)
+ }
}
fun main(args: Array<String>) {
bgstack15