From c77fc93bb404b4af04e931a7672f97bf9f591911 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Sat, 13 Feb 2021 19:19:55 +0100 Subject: Add metrics labels for default Spring Boot grafana board https://grafana.com/grafana/dashboards/6756 --- .../main/kotlin/org/luxons/sevenwonders/server/SevenWonders.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sw-server/src') 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? = MeterRegistryCustomizer { registry -> + registry.config() + .commonTags("application", "SevenWonders") + .commonTags("instance", InetAddress.getLocalHost().hostAddress) + } } fun main(args: Array) { -- cgit