From 7c2cb2f768af063d2bf968ead82e0c223b50d35e Mon Sep 17 00:00:00 2001 From: DenisGabriela Date: Wed, 10 Oct 2018 11:41:57 +0300 Subject: [PATCH 1/5] ATS-126 : Expose JVM metrics - eg. CPU & Memory (within jvm process / container) - added actuator & micrometer - enabled /health, /metrics & /prometheus - disabled some of the default metrics (subject to be discussed) --- alfresco-transformer-base/pom.xml | 8 +++++++ .../src/main/resources/application.yaml | 21 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/alfresco-transformer-base/pom.xml b/alfresco-transformer-base/pom.xml index cd21190e..96fab665 100644 --- a/alfresco-transformer-base/pom.xml +++ b/alfresco-transformer-base/pom.xml @@ -21,6 +21,14 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-actuator + + + io.micrometer + micrometer-registry-prometheus + org.springframework.boot spring-boot-starter-test diff --git a/alfresco-transformer-base/src/main/resources/application.yaml b/alfresco-transformer-base/src/main/resources/application.yaml index 95ca9000..4b418b12 100644 --- a/alfresco-transformer-base/src/main/resources/application.yaml +++ b/alfresco-transformer-base/src/main/resources/application.yaml @@ -16,4 +16,23 @@ logging: org.alfresco.transformer.ImageMagickController: debug org.alfresco.transformer.TikaController: debug -fileStoreUrl: ${FILE_STORE_URL:http://localhost:8099/alfresco/api/-default-/private/sfs/versions/1/file} \ No newline at end of file +fileStoreUrl: ${FILE_STORE_URL:http://localhost:8099/alfresco/api/-default-/private/sfs/versions/1/file} + +management: + endpoints: + web: + exposure: + include: + - metrics + - prometheus + - health + metrics: + enable[go]: false + enable[http]: false + enable[net]: false + enable[logback]: false + enable[prometheus]: false + enable[promhttp]: false + enable[tomcat]: false + enable[scrape]: false + enable[jvm.classes]: false \ No newline at end of file From 2d578997b92d2c5dfb9b5bd6f4bb4054d84c5dbf Mon Sep 17 00:00:00 2001 From: DenisGabriela Date: Wed, 10 Oct 2018 16:36:19 +0300 Subject: [PATCH 2/5] ATS-126 : Expose JVM metrics - eg. CPU & Memory (within jvm process / container) - removed disabling of non-t-engines' metrics --- alfresco-transformer-base/src/main/resources/application.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/alfresco-transformer-base/src/main/resources/application.yaml b/alfresco-transformer-base/src/main/resources/application.yaml index 4b418b12..b35d43cf 100644 --- a/alfresco-transformer-base/src/main/resources/application.yaml +++ b/alfresco-transformer-base/src/main/resources/application.yaml @@ -27,12 +27,8 @@ management: - prometheus - health metrics: - enable[go]: false enable[http]: false enable[net]: false enable[logback]: false - enable[prometheus]: false - enable[promhttp]: false enable[tomcat]: false - enable[scrape]: false enable[jvm.classes]: false \ No newline at end of file From 494a16c00d009b94b9fba84234f17d3046809f9d Mon Sep 17 00:00:00 2001 From: DenisGabriela Date: Wed, 10 Oct 2018 16:42:34 +0300 Subject: [PATCH 3/5] ATS-126 : Expose JVM metrics - eg. CPU & Memory (within jvm process / container) - removed disabling of non-t-engines' metrics --- alfresco-transformer-base/src/main/resources/application.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/alfresco-transformer-base/src/main/resources/application.yaml b/alfresco-transformer-base/src/main/resources/application.yaml index b35d43cf..ece36605 100644 --- a/alfresco-transformer-base/src/main/resources/application.yaml +++ b/alfresco-transformer-base/src/main/resources/application.yaml @@ -28,7 +28,6 @@ management: - health metrics: enable[http]: false - enable[net]: false enable[logback]: false enable[tomcat]: false enable[jvm.classes]: false \ No newline at end of file From 6a7bbb3c4ea7f8de4bf160f363b24ac74029063f Mon Sep 17 00:00:00 2001 From: DenisGabriela Date: Mon, 15 Oct 2018 12:41:42 +0300 Subject: [PATCH 4/5] ATS-126 : Expose JVM metrics - eg. CPU & Memory (within jvm process / container) - added pod name tag tag on metrics --- .../java/org/alfresco/transformer/Application.java | 11 +++++++++++ .../java/org/alfresco/transformer/Application.java | 11 +++++++++++ .../java/org/alfresco/transformer/Application.java | 11 +++++++++++ .../java/org/alfresco/transformer/Application.java | 11 +++++++++++ .../src/main/resources/application.yaml | 5 ++++- 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java index 6b28dcf7..3c26f1ea 100644 --- a/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java @@ -11,15 +11,26 @@ */ package org.alfresco.transformer; +import io.micrometer.core.instrument.MeterRegistry; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { + @Value("${pod.name}") + private String podName; + + @Bean MeterRegistryCustomizer metricsCommonTags() { + return registry -> registry.config().commonTags("podName", podName); + } + public static void main(String[] args) { SpringApplication.run(Application.class, args); diff --git a/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java index 22cbefc4..d13e27a2 100644 --- a/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java @@ -11,15 +11,26 @@ */ package org.alfresco.transformer; +import io.micrometer.core.instrument.MeterRegistry; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { + @Value("${pod.name}") + private String podName; + + @Bean MeterRegistryCustomizer metricsCommonTags() { + return registry -> registry.config().commonTags("podName", podName); + } + public static void main(String[] args) { SpringApplication.run(Application.class, args); diff --git a/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java index 6b28dcf7..3c26f1ea 100644 --- a/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java @@ -11,15 +11,26 @@ */ package org.alfresco.transformer; +import io.micrometer.core.instrument.MeterRegistry; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { + @Value("${pod.name}") + private String podName; + + @Bean MeterRegistryCustomizer metricsCommonTags() { + return registry -> registry.config().commonTags("podName", podName); + } + public static void main(String[] args) { SpringApplication.run(Application.class, args); diff --git a/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java index 22cbefc4..d13e27a2 100644 --- a/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java @@ -11,15 +11,26 @@ */ package org.alfresco.transformer; +import io.micrometer.core.instrument.MeterRegistry; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { + @Value("${pod.name}") + private String podName; + + @Bean MeterRegistryCustomizer metricsCommonTags() { + return registry -> registry.config().commonTags("podName", podName); + } + public static void main(String[] args) { SpringApplication.run(Application.class, args); diff --git a/alfresco-transformer-base/src/main/resources/application.yaml b/alfresco-transformer-base/src/main/resources/application.yaml index ece36605..d8b69ff4 100644 --- a/alfresco-transformer-base/src/main/resources/application.yaml +++ b/alfresco-transformer-base/src/main/resources/application.yaml @@ -30,4 +30,7 @@ management: enable[http]: false enable[logback]: false enable[tomcat]: false - enable[jvm.classes]: false \ No newline at end of file + enable[jvm.classes]: false + +pod: + name: ${POD_NAME:t-engine} \ No newline at end of file From 8e7e775eefda803aaf36dcddf3435fa3107a0fb7 Mon Sep 17 00:00:00 2001 From: DenisGabriela Date: Mon, 15 Oct 2018 16:08:47 +0300 Subject: [PATCH 5/5] ATS-126 : Expose JVM metrics - eg. CPU & Memory (within jvm process / container) - addressed review comments --- .../src/main/java/org/alfresco/transformer/Application.java | 6 +++--- .../src/main/java/org/alfresco/transformer/Application.java | 6 +++--- .../src/main/java/org/alfresco/transformer/Application.java | 6 +++--- .../src/main/java/org/alfresco/transformer/Application.java | 6 +++--- .../src/main/resources/application.yaml | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java index 3c26f1ea..ec500713 100644 --- a/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-alfresco-pdf-renderer/src/main/java/org/alfresco/transformer/Application.java @@ -24,11 +24,11 @@ import org.springframework.context.annotation.Bean; @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { - @Value("${pod.name}") - private String podName; + @Value("${container.name}") + private String containerName; @Bean MeterRegistryCustomizer metricsCommonTags() { - return registry -> registry.config().commonTags("podName", podName); + return registry -> registry.config().commonTags("containerName", containerName); } public static void main(String[] args) diff --git a/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java index d13e27a2..778b51db 100644 --- a/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-imagemagick/src/main/java/org/alfresco/transformer/Application.java @@ -24,11 +24,11 @@ import org.springframework.context.annotation.Bean; @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { - @Value("${pod.name}") - private String podName; + @Value("${container.name}") + private String containerName; @Bean MeterRegistryCustomizer metricsCommonTags() { - return registry -> registry.config().commonTags("podName", podName); + return registry -> registry.config().commonTags("containerName", containerName); } public static void main(String[] args) diff --git a/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java index 3c26f1ea..ec500713 100644 --- a/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-libreoffice/src/main/java/org/alfresco/transformer/Application.java @@ -24,11 +24,11 @@ import org.springframework.context.annotation.Bean; @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { - @Value("${pod.name}") - private String podName; + @Value("${container.name}") + private String containerName; @Bean MeterRegistryCustomizer metricsCommonTags() { - return registry -> registry.config().commonTags("podName", podName); + return registry -> registry.config().commonTags("containerName", containerName); } public static void main(String[] args) diff --git a/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java b/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java index d13e27a2..778b51db 100644 --- a/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java +++ b/alfresco-docker-tika/src/main/java/org/alfresco/transformer/Application.java @@ -24,11 +24,11 @@ import org.springframework.context.annotation.Bean; @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class Application { - @Value("${pod.name}") - private String podName; + @Value("${container.name}") + private String containerName; @Bean MeterRegistryCustomizer metricsCommonTags() { - return registry -> registry.config().commonTags("podName", podName); + return registry -> registry.config().commonTags("containerName", containerName); } public static void main(String[] args) diff --git a/alfresco-transformer-base/src/main/resources/application.yaml b/alfresco-transformer-base/src/main/resources/application.yaml index d8b69ff4..48825600 100644 --- a/alfresco-transformer-base/src/main/resources/application.yaml +++ b/alfresco-transformer-base/src/main/resources/application.yaml @@ -32,5 +32,5 @@ management: enable[tomcat]: false enable[jvm.classes]: false -pod: - name: ${POD_NAME:t-engine} \ No newline at end of file +container: + name: ${HOSTNAME:t-engine} \ No newline at end of file