diff --git a/implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/v2/DynatraceExporterV2.java b/implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/v2/DynatraceExporterV2.java index da1ece537a..ef42bc66ef 100644 --- a/implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/v2/DynatraceExporterV2.java +++ b/implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/v2/DynatraceExporterV2.java @@ -304,13 +304,13 @@ Stream toFunctionCounterLine(FunctionCounter meter) { Stream toFunctionTimerLine(FunctionTimer meter) { long count = (long) meter.count(); - double total = meter.totalTime(getBaseTimeUnit()); - if (count == 0) { logger.debug("Timer with 0 count dropped: {}", meter.getId().getName()); return Stream.empty(); } - else if (count == 1) { + + double total = meter.totalTime(getBaseTimeUnit()); + if (count == 1) { // Between calling count, totalTime, and mean values can be recorded so the // reported values might be inconsistent. In the Dynatrace API, // this might lead to rejections, because the ingested data's validity is diff --git a/implementations/micrometer-registry-dynatrace/src/test/java/io/micrometer/dynatrace/v2/DynatraceExporterV2Test.java b/implementations/micrometer-registry-dynatrace/src/test/java/io/micrometer/dynatrace/v2/DynatraceExporterV2Test.java index 0857e4de44..ab8c6603a8 100644 --- a/implementations/micrometer-registry-dynatrace/src/test/java/io/micrometer/dynatrace/v2/DynatraceExporterV2Test.java +++ b/implementations/micrometer-registry-dynatrace/src/test/java/io/micrometer/dynatrace/v2/DynatraceExporterV2Test.java @@ -366,7 +366,8 @@ void longTaskTimerWithSingleValueExportsConsistentData() throws InterruptedExcep // the Dynatrace specification). Therefore, for this test we need to use the // system clock. DynatraceConfig config = createDefaultDynatraceConfig(); - DynatraceMeterRegistry registry = DynatraceMeterRegistry.builder(config).clock(Clock.SYSTEM).build(); + Clock clock = Clock.SYSTEM; + DynatraceMeterRegistry registry = DynatraceMeterRegistry.builder(config).clock(clock).build(); DynatraceExporterV2 exporter = new DynatraceExporterV2(config, clock, httpClient); LongTaskTimer ltt = LongTaskTimer.builder("ltt").register(registry); @@ -397,7 +398,8 @@ void longTaskTimerWithMultipleValuesExportsConsistentData() throws InterruptedEx // For this test we need to use the system clock. // See longTaskTimerWithSingleValueExportsConsistentData for more info DynatraceConfig config = createDefaultDynatraceConfig(); - DynatraceMeterRegistry registry = DynatraceMeterRegistry.builder(config).clock(Clock.SYSTEM).build(); + Clock clock = Clock.SYSTEM; + DynatraceMeterRegistry registry = DynatraceMeterRegistry.builder(config).clock(clock).build(); DynatraceExporterV2 exporter = new DynatraceExporterV2(config, clock, httpClient); LongTaskTimer ltt = LongTaskTimer.builder("ltt").register(registry); @@ -417,8 +419,6 @@ void longTaskTimerWithMultipleValuesExportsConsistentData() throws InterruptedEx // export complete, can shut down active background thread. executorService.shutdownNow(); - assertThat(lines).hasSize(1); - // assertions assertThat(lines).hasSize(1); // ltt,dt.metrics.source=micrometer gauge,min=5,max=5,sum=5,count=1 1694133659649 diff --git a/settings.gradle b/settings.gradle index 8329b2c020..3eab784867 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,7 +5,7 @@ pluginManagement { } plugins { - id 'com.gradle.enterprise' version '3.14.1' + id 'com.gradle.enterprise' version '3.15' id 'io.spring.ge.conventions' version '0.0.14' id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' }