From 3d7aa9abed9000a2b1305c17e589addfb2dd2e99 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 27 Sep 2024 14:31:44 +0200 Subject: [PATCH] Add OTLP for metrics entry Closes gh-1598 --- .../ObservabilityActuatorBuildCustomizer.java | 2 +- .../springmodulith/SpringModulithBuildCustomizer.java | 2 +- start-site/src/main/resources/application.yml | 10 ++++++++++ .../ObservabilityActuatorBuildCustomizerTests.java | 4 ++-- .../SpringModulithBuildCustomizerTests.java | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizer.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizer.java index 8f870b3ab92..a199ce069c8 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizer.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizer.java @@ -31,7 +31,7 @@ class ObservabilityActuatorBuildCustomizer implements BuildCustomizer { private static final List STANDARD_REGISTRY_IDS = Arrays.asList("datadog", "distributed-tracing", - "dynatrace", "graphite", "influx", "new-relic", "wavefront", "zipkin"); + "dynatrace", "graphite", "influx", "new-relic", "otlp-metrics", "wavefront", "zipkin"); @Override public void customize(Build build) { diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizer.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizer.java index 91604af4cd3..c5f0a5fe659 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizer.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizer.java @@ -37,7 +37,7 @@ class SpringModulithBuildCustomizer implements BuildCustomizer { private static final Collection OBSERVABILITY_DEPENDENCIES = List.of("actuator", "datadog", "graphite", - "influx", "new-relic", "prometheus", "wavefront", "zipkin"); + "influx", "new-relic", "otlp-metrics", "prometheus", "wavefront", "zipkin"); private static final Collection PERSISTENCE = List.of("jdbc", "jpa", "mongodb"); diff --git a/start-site/src/main/resources/application.yml b/start-site/src/main/resources/application.yml index e07563c3f88..87b497a06f5 100644 --- a/start-site/src/main/resources/application.yml +++ b/start-site/src/main/resources/application.yml @@ -995,6 +995,16 @@ initializr: links: - rel: reference href: https://docs.spring.io/spring-boot/docs/{bootVersion}/reference/htmlsingle/index.html#actuator.metrics.export.newrelic + - name: OTLP for metrics + id: otlp-metrics + groupId: io.micrometer + artifactId: micrometer-registry-otlp + scope: runtime + starter: false + description: Publish Micrometer metrics to an OTLP capable backend. + links: + - rel: reference + href: https://docs.spring.io/spring-boot/reference/actuator/metrics.html#actuator.metrics.export.otlp - name: Prometheus id: prometheus groupId: io.micrometer diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizerTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizerTests.java index bc75bcf8e5b..ed0002ca4b6 100644 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizerTests.java +++ b/start-site/src/test/java/io/spring/start/site/extension/dependency/observability/ObservabilityActuatorBuildCustomizerTests.java @@ -34,8 +34,8 @@ class ObservabilityActuatorBuildCustomizerTests extends AbstractExtensionTests { private static final String SPRING_BOOT_VERSION = "3.3.0"; @ParameterizedTest - @ValueSource(strings = { "datadog", "dynatrace", "influx", "graphite", "new-relic", "distributed-tracing", "zipkin", - "wavefront" }) + @ValueSource(strings = { "datadog", "dynatrace", "influx", "graphite", "new-relic", "otlp-metrics", + "distributed-tracing", "zipkin", "wavefront" }) void actuatorIsAddedWithObservabilityEntries(String dependency) { assertThat(generateProject(SPRING_BOOT_VERSION, dependency)).mavenBuild() .hasDependency(getDependency("actuator")); diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizerTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizerTests.java index 81ac376dfbe..86ce6f09e4a 100644 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizerTests.java +++ b/start-site/src/test/java/io/spring/start/site/extension/dependency/springmodulith/SpringModulithBuildCustomizerTests.java @@ -55,8 +55,8 @@ void registersActuatorStarterIfActuatorsIsPresent() { } @ParameterizedTest - @ValueSource( - strings = { "actuator", "datadog", "graphite", "influx", "new-relic", "prometheus", "wavefront", "zipkin" }) + @ValueSource(strings = { "actuator", "datadog", "graphite", "influx", "new-relic", "otlp-metrics", "prometheus", + "wavefront", "zipkin" }) void registersObservabilityStarterIfObservabilityDependencyIsPresent(String dependency) { Build build = createBuild("modulith"); build.dependencies().add(dependency);