From 72d2d5deba7a3b09a377d612f55deb7eac11ca51 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Wed, 10 Apr 2024 10:08:42 +0200 Subject: [PATCH 1/4] Update the OpenTelemetry SDK version to 1.37.0 (#11066) Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Trask Stalnaker Co-authored-by: Lauri Tulmin --- dependencyManagement/build.gradle.kts | 2 +- examples/distro/agent/build.gradle | 5 +- examples/distro/build.gradle | 2 +- .../testing/agent-for-testing/build.gradle | 5 +- examples/extension/build.gradle | 2 +- instrumentation-api-semconv/build.gradle.kts | 2 +- instrumentation-api/build.gradle.kts | 2 +- .../micrometer-1.5/library/build.gradle.kts | 2 +- .../micrometer/v1_5/HistogramAdviceUtil.java | 2 +- .../trace/ApplicationSpan.java | 14 + .../v1_27/ApplicationOpenTelemetry127.java | 10 +- .../javaagent/build.gradle.kts | 5 +- ...OpenTelemetryApiInstrumentationModule.java | 8 + .../ApplicationDoubleCounterBuilder131.java | 2 +- .../ApplicationDoubleGaugeBuilder131.java | 7 +- .../ApplicationDoubleHistogramBuilder131.java | 2 +- ...licationDoubleUpDownCounterBuilder131.java | 2 +- .../ApplicationLongCounterBuilder131.java | 2 +- .../ApplicationLongGaugeBuilder131.java | 7 +- .../ApplicationLongHistogramBuilder131.java | 2 +- ...pplicationLongUpDownCounterBuilder131.java | 2 +- .../javaagent/build.gradle.kts | 4 +- ...ionDoubleHistogramBuilder132Incubator.java | 2 +- ...ationLongHistogramBuilder132Incubator.java | 2 +- .../javaagent/build.gradle.kts | 32 ++ .../v1_37/incubator/metrics/MeterTest.java | 468 ++++++++++++++++++ ...etryApiIncubatorInstrumentationModule.java | 40 ++ ...OpenTelemetryIncubatorInstrumentation.java | 40 ++ ...ionDoubleHistogramBuilder137Incubator.java | 44 ++ ...ationLongHistogramBuilder137Incubator.java | 38 ++ .../metrics/ApplicationMeter137Incubator.java | 24 + .../ApplicationMeterFactory137Incubator.java | 18 + .../ApplicationDoubleCounterBuilder137.java | 31 ++ .../ApplicationDoubleGaugeBuilder137.java | 56 +++ .../ApplicationDoubleHistogramBuilder137.java | 44 ++ ...licationDoubleUpDownCounterBuilder137.java | 31 ++ .../ApplicationLongCounterBuilder137.java | 36 ++ .../ApplicationLongGaugeBuilder137.java | 49 ++ .../ApplicationLongHistogramBuilder137.java | 38 ++ ...pplicationLongUpDownCounterBuilder137.java | 37 ++ .../v1_37/metrics/ApplicationMeter137.java | 42 ++ .../metrics/ApplicationMeterFactory137.java | 18 + .../v1_37/metrics/MeterTest.java | 116 +++++ .../javaagent/build.gradle.kts | 2 +- .../runtimemetrics/java8/JarAnalyzer.java | 32 +- .../java8/JarAnalyzerInstallerTest.java | 28 +- .../library/build.gradle.kts | 1 - .../testing/build.gradle.kts | 2 +- .../runtimemetrics/java8/JarAnalyzerTest.java | 15 +- javaagent-tooling/build.gradle.kts | 2 +- .../tooling/OpenTelemetryInstallerTest.groovy | 6 +- .../ConfigurationPropertiesSupplierTest.java | 4 +- javaagent/build.gradle.kts | 9 +- licenses/licenses.md | 112 ++--- .../build.gradle.kts | 24 + settings.gradle.kts | 1 + 56 files changed, 1388 insertions(+), 147 deletions(-) create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/incubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryApiIncubatorInstrumentationModule.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryIncubatorInstrumentation.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationDoubleHistogramBuilder137Incubator.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationLongHistogramBuilder137Incubator.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeter137Incubator.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeterFactory137Incubator.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleCounterBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleGaugeBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleHistogramBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleUpDownCounterBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongCounterBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongGaugeBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongHistogramBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongUpDownCounterBuilder137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeter137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeterFactory137.java create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/MeterTest.java diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index eecc76d7d113..61abb38c1337 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -8,7 +8,7 @@ val dependencyVersions = hashMapOf() rootProject.extra["versions"] = dependencyVersions // this line is managed by .github/scripts/update-sdk-version.sh -val otelSdkVersion = "1.36.0" +val otelSdkVersion = "1.37.0" val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1") // Need both BOM and groovy jars diff --git a/examples/distro/agent/build.gradle b/examples/distro/agent/build.gradle index 32dceefe8a26..096b0d0439e5 100644 --- a/examples/distro/agent/build.gradle +++ b/examples/distro/agent/build.gradle @@ -73,10 +73,9 @@ tasks { // exclude known bootstrap dependencies - they can't appear in the inst/ directory dependencies { exclude("io.opentelemetry:opentelemetry-api") - exclude("io.opentelemetry:opentelemetry-api-events") exclude("io.opentelemetry:opentelemetry-context") - // metrics advice API - exclude("io.opentelemetry:opentelemetry-extension-incubator") + // events API and metrics advice API + exclude("io.opentelemetry:opentelemetry-api-incubator") } } diff --git a/examples/distro/build.gradle b/examples/distro/build.gradle index 85e07fbb7535..e4137d08b6ed 100644 --- a/examples/distro/build.gradle +++ b/examples/distro/build.gradle @@ -27,7 +27,7 @@ subprojects { ext { versions = [ // this line is managed by .github/scripts/update-sdk-version.sh - opentelemetrySdk : "1.35.0", + opentelemetrySdk : "1.37.0", // these lines are managed by .github/scripts/update-version.sh opentelemetryJavaagent : "1.33.1", diff --git a/examples/distro/testing/agent-for-testing/build.gradle b/examples/distro/testing/agent-for-testing/build.gradle index 69c194414345..0879f3985de4 100644 --- a/examples/distro/testing/agent-for-testing/build.gradle +++ b/examples/distro/testing/agent-for-testing/build.gradle @@ -70,10 +70,9 @@ tasks { // exclude known bootstrap dependencies - they can't appear in the inst/ directory dependencies { exclude("io.opentelemetry:opentelemetry-api") - exclude("io.opentelemetry:opentelemetry-api-events") exclude("io.opentelemetry:opentelemetry-context") - // metrics advice API - exclude("io.opentelemetry:opentelemetry-extension-incubator") + // events API and metrics advice API + exclude("io.opentelemetry:opentelemetry-api-incubator") } } diff --git a/examples/extension/build.gradle b/examples/extension/build.gradle index b032ace66c8c..7b16e254193a 100644 --- a/examples/extension/build.gradle +++ b/examples/extension/build.gradle @@ -23,7 +23,7 @@ version '1.0' ext { versions = [ // this line is managed by .github/scripts/update-sdk-version.sh - opentelemetrySdk : "1.35.0", + opentelemetrySdk : "1.37.0", // these lines are managed by .github/scripts/update-version.sh opentelemetryJavaagent : "1.33.1", diff --git a/instrumentation-api-semconv/build.gradle.kts b/instrumentation-api-semconv/build.gradle.kts index fd51e449e7ac..94636dfedbcc 100644 --- a/instrumentation-api-semconv/build.gradle.kts +++ b/instrumentation-api-semconv/build.gradle.kts @@ -13,7 +13,7 @@ group = "io.opentelemetry.instrumentation" dependencies { api("io.opentelemetry.semconv:opentelemetry-semconv") api(project(":instrumentation-api")) - implementation("io.opentelemetry:opentelemetry-extension-incubator") + implementation("io.opentelemetry:opentelemetry-api-incubator") compileOnly("com.google.auto.value:auto-value-annotations") annotationProcessor("com.google.auto.value:auto-value") diff --git a/instrumentation-api/build.gradle.kts b/instrumentation-api/build.gradle.kts index 876742ff1043..0812b80fb324 100644 --- a/instrumentation-api/build.gradle.kts +++ b/instrumentation-api/build.gradle.kts @@ -13,7 +13,7 @@ group = "io.opentelemetry.instrumentation" dependencies { api("io.opentelemetry:opentelemetry-api") - implementation("io.opentelemetry:opentelemetry-extension-incubator") + implementation("io.opentelemetry:opentelemetry-api-incubator") compileOnly("com.google.auto.value:auto-value-annotations") annotationProcessor("com.google.auto.value:auto-value") diff --git a/instrumentation/micrometer/micrometer-1.5/library/build.gradle.kts b/instrumentation/micrometer/micrometer-1.5/library/build.gradle.kts index 997677f7de3f..a8782fcac158 100644 --- a/instrumentation/micrometer/micrometer-1.5/library/build.gradle.kts +++ b/instrumentation/micrometer/micrometer-1.5/library/build.gradle.kts @@ -3,7 +3,7 @@ plugins { } dependencies { - compileOnly("io.opentelemetry:opentelemetry-extension-incubator") + compileOnly("io.opentelemetry:opentelemetry-api-incubator") library("io.micrometer:micrometer-core:1.5.0") diff --git a/instrumentation/micrometer/micrometer-1.5/library/src/main/java/io/opentelemetry/instrumentation/micrometer/v1_5/HistogramAdviceUtil.java b/instrumentation/micrometer/micrometer-1.5/library/src/main/java/io/opentelemetry/instrumentation/micrometer/v1_5/HistogramAdviceUtil.java index cb377f64e547..0c25f318e1c6 100644 --- a/instrumentation/micrometer/micrometer-1.5/library/src/main/java/io/opentelemetry/instrumentation/micrometer/v1_5/HistogramAdviceUtil.java +++ b/instrumentation/micrometer/micrometer-1.5/library/src/main/java/io/opentelemetry/instrumentation/micrometer/v1_5/HistogramAdviceUtil.java @@ -9,8 +9,8 @@ import io.micrometer.core.instrument.distribution.DistributionStatisticConfig; import io.micrometer.core.instrument.util.TimeUtils; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; import io.opentelemetry.api.metrics.DoubleHistogramBuilder; -import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder; import java.util.ArrayList; import java.util.List; import java.util.NavigableSet; diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationSpan.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationSpan.java index 5897c6dc2537..ffdd8c46a6fd 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationSpan.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationSpan.java @@ -100,6 +100,20 @@ public Span addEvent( return this; } + @Override + @CanIgnoreReturnValue + public Span addLink(SpanContext spanContext) { + agentSpan.addLink(Bridging.toAgent(spanContext)); + return this; + } + + @Override + @CanIgnoreReturnValue + public Span addLink(SpanContext spanContext, Attributes attributes) { + agentSpan.addLink(Bridging.toAgent(spanContext), Bridging.toAgent(attributes)); + return this; + } + @Override @CanIgnoreReturnValue public Span setStatus(StatusCode status) { diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java index bb9663677b3b..0b7834173169 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java @@ -63,10 +63,16 @@ public ContextPropagators getPropagators() { } private static ApplicationMeterFactory getMeterFactory() { - // this class is defined in opentelemetry-api-1.32 + // this class is defined in opentelemetry-api-1.37 ApplicationMeterFactory meterFactory = getMeterFactory( - "io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_32.incubator.metrics.ApplicationMeterFactory132Incubator"); + "io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics.ApplicationMeterFactory137Incubator"); + if (meterFactory == null) { + // this class is defined in opentelemetry-api-1.32 + meterFactory = + getMeterFactory( + "io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_32.incubator.metrics.ApplicationMeterFactory132Incubator"); + } if (meterFactory == null) { // this class is defined in opentelemetry-api-1.32 meterFactory = diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/build.gradle.kts index 6968e8bb3206..9af4f089d39e 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/build.gradle.kts @@ -4,7 +4,7 @@ plugins { dependencies { compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "v1_31")) - compileOnly("io.opentelemetry:opentelemetry-extension-incubator") + compileOnly("io.opentelemetry:opentelemetry-api-incubator") implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent")) @@ -12,14 +12,13 @@ dependencies { implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.27:javaagent")) - testImplementation("io.opentelemetry:opentelemetry-extension-incubator") + testImplementation("io.opentelemetry:opentelemetry-extension-incubator:1.31.0-alpha") } configurations.configureEach { if (name == "testRuntimeClasspath" || name == "testCompileClasspath") { resolutionStrategy { force("io.opentelemetry:opentelemetry-api:1.31.0") - force("io.opentelemetry:opentelemetry-extension-incubator:1.31.0-alpha") } } } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/OpenTelemetryApiInstrumentationModule.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/OpenTelemetryApiInstrumentationModule.java index 6facc1371841..3649c744a71a 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/OpenTelemetryApiInstrumentationModule.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/OpenTelemetryApiInstrumentationModule.java @@ -5,12 +5,14 @@ package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_31; +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; import static java.util.Collections.singletonList; import com.google.auto.service.AutoService; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; @AutoService(InstrumentationModule.class) public class OpenTelemetryApiInstrumentationModule extends InstrumentationModule { @@ -27,4 +29,10 @@ public boolean isIndyModule() { public List typeInstrumentations() { return singletonList(new OpenTelemetryInstrumentation()); } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + return hasClassesNamed( + "application.io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder"); + } } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleCounterBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleCounterBuilder131.java index a74b4d072048..0e1abdc89670 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleCounterBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleCounterBuilder131.java @@ -24,7 +24,7 @@ final class ApplicationDoubleCounterBuilder131 extends ApplicationDoubleCounterB @Override public ExtendedDoubleCounterBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleCounterBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleCounterBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleGaugeBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleGaugeBuilder131.java index f952e88f0c77..9b4c840436e4 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleGaugeBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleGaugeBuilder131.java @@ -31,9 +31,8 @@ public LongGaugeBuilder ofLongs() { @Override public DoubleGauge build() { - io.opentelemetry.extension.incubator.metrics.DoubleGauge agentDoubleGauge = - ((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder) - .build(); + io.opentelemetry.api.incubator.metrics.DoubleGauge agentDoubleGauge = + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder).build(); return new DoubleGauge() { @Override @@ -50,7 +49,7 @@ public void set(double value, Attributes attributes) { @Override public ExtendedDoubleGaugeBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleHistogramBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleHistogramBuilder131.java index 485ac714929b..d248443de671 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleHistogramBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleHistogramBuilder131.java @@ -37,7 +37,7 @@ public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice( @Override public ExtendedDoubleHistogramBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleUpDownCounterBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleUpDownCounterBuilder131.java index 0af2c3d65855..eddddd7b33b0 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleUpDownCounterBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationDoubleUpDownCounterBuilder131.java @@ -24,7 +24,7 @@ final class ApplicationDoubleUpDownCounterBuilder131 extends ApplicationDoubleUp @Override public ExtendedDoubleUpDownCounterBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleUpDownCounterBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleUpDownCounterBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongCounterBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongCounterBuilder131.java index 3cfd5d76bd83..5644730e4ba7 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongCounterBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongCounterBuilder131.java @@ -29,7 +29,7 @@ public DoubleCounterBuilder ofDoubles() { @Override public ExtendedLongCounterBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedLongCounterBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedLongCounterBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongGaugeBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongGaugeBuilder131.java index 3bd702950387..a0c6529cd825 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongGaugeBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongGaugeBuilder131.java @@ -25,9 +25,8 @@ final class ApplicationLongGaugeBuilder131 extends ApplicationLongGaugeBuilder @Override public LongGauge build() { - io.opentelemetry.extension.incubator.metrics.LongGauge agentLongGauge = - ((io.opentelemetry.extension.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder) - .build(); + io.opentelemetry.api.incubator.metrics.LongGauge agentLongGauge = + ((io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder).build(); return new LongGauge() { @Override public void set(long value) { @@ -43,7 +42,7 @@ public void set(long value, Attributes attributes) { @Override public ExtendedLongGaugeBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongHistogramBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongHistogramBuilder131.java index d46fc99d08c1..e7b56520a743 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongHistogramBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongHistogramBuilder131.java @@ -31,7 +31,7 @@ public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice( @Override public ExtendedLongHistogramBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongUpDownCounterBuilder131.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongUpDownCounterBuilder131.java index 352097a25225..cd73b6780aeb 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongUpDownCounterBuilder131.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.31/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_31/metrics/ApplicationLongUpDownCounterBuilder131.java @@ -30,7 +30,7 @@ public DoubleUpDownCounterBuilder ofDoubles() { @Override public ExtendedLongUpDownCounterBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts index fc59c934fdc9..cad00243d6ae 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts @@ -4,7 +4,7 @@ plugins { dependencies { compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "v1_32")) - compileOnly("io.opentelemetry:opentelemetry-extension-incubator") + compileOnly("io.opentelemetry:opentelemetry-api-incubator") implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent")) @@ -18,7 +18,7 @@ testing { suites { val incubatorTest by registering(JvmTestSuite::class) { dependencies { - implementation("io.opentelemetry:opentelemetry-extension-incubator") + implementation("io.opentelemetry:opentelemetry-extension-incubator:1.32.0-alpha") } } } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationDoubleHistogramBuilder132Incubator.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationDoubleHistogramBuilder132Incubator.java index c4d6ee6df52f..89e04a3b7026 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationDoubleHistogramBuilder132Incubator.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationDoubleHistogramBuilder132Incubator.java @@ -37,7 +37,7 @@ public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice( @Override public ExtendedDoubleHistogramBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationLongHistogramBuilder132Incubator.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationLongHistogramBuilder132Incubator.java index 4f6882cf6670..96a39a978bb3 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationLongHistogramBuilder132Incubator.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_32/incubator/metrics/ApplicationLongHistogramBuilder132Incubator.java @@ -31,7 +31,7 @@ public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice( @Override public ExtendedLongHistogramBuilder setAttributesAdvice(List> attributes) { - ((io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder) + ((io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder) .setAttributesAdvice(Bridging.toAgent(attributes)); return this; } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts new file mode 100644 index 000000000000..3b9ac093ff70 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts @@ -0,0 +1,32 @@ +plugins { + id("otel.javaagent-instrumentation") +} + +dependencies { + compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "v1_37")) + compileOnly("io.opentelemetry:opentelemetry-api-incubator") + + implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent")) + implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent")) + implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent")) + implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent")) + implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.27:javaagent")) + implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.31:javaagent")) + implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.32:javaagent")) +} + +testing { + suites { + val incubatorTest by registering(JvmTestSuite::class) { + dependencies { + implementation("io.opentelemetry:opentelemetry-api-incubator:1.37.0-alpha") + } + } + } +} + +tasks { + check { + dependsOn(testing.suites) + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/incubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/incubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java new file mode 100644 index 000000000000..84cc8c400360 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/incubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java @@ -0,0 +1,468 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics; + +import static io.opentelemetry.api.common.AttributeKey.stringKey; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static java.util.Collections.singletonList; +import static org.assertj.core.api.Assertions.assertThat; + +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.incubator.metrics.DoubleGauge; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleCounterBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleUpDownCounterBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongCounterBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder; +import io.opentelemetry.api.incubator.metrics.LongGauge; +import io.opentelemetry.api.metrics.DoubleCounter; +import io.opentelemetry.api.metrics.DoubleCounterBuilder; +import io.opentelemetry.api.metrics.DoubleGaugeBuilder; +import io.opentelemetry.api.metrics.DoubleHistogram; +import io.opentelemetry.api.metrics.DoubleHistogramBuilder; +import io.opentelemetry.api.metrics.DoubleUpDownCounter; +import io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder; +import io.opentelemetry.api.metrics.LongCounter; +import io.opentelemetry.api.metrics.LongCounterBuilder; +import io.opentelemetry.api.metrics.LongGaugeBuilder; +import io.opentelemetry.api.metrics.LongHistogram; +import io.opentelemetry.api.metrics.LongHistogramBuilder; +import io.opentelemetry.api.metrics.LongUpDownCounter; +import io.opentelemetry.api.metrics.LongUpDownCounterBuilder; +import io.opentelemetry.api.metrics.Meter; +import io.opentelemetry.api.metrics.ObservableDoubleGauge; +import io.opentelemetry.api.metrics.ObservableLongGauge; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import org.assertj.core.api.AbstractIterableAssert; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.extension.RegisterExtension; + +class MeterTest { + + @RegisterExtension + static final AgentInstrumentationExtension testing = AgentInstrumentationExtension.create(); + + private String instrumentationName; + private Meter meter; + + @BeforeEach + void setupMeter(TestInfo test) { + instrumentationName = "test-" + test.getDisplayName(); + meter = + testing + .getOpenTelemetry() + .getMeterProvider() + .meterBuilder(instrumentationName) + .setInstrumentationVersion("1.2.3") + .setSchemaUrl("http://schema.org") + .build(); + } + + @Test + void longCounter() { + LongCounterBuilder builder = meter.counterBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongCounterBuilder.class); + ExtendedLongCounterBuilder extendedBuilder = (ExtendedLongCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongCounter instrument = builder.build(); + + instrument.add(5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongSumSatisfying( + sum -> + sum.isMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(11) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void doubleCounter() { + DoubleCounterBuilder builder = + meter.counterBuilder("test").ofDoubles().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleCounterBuilder.class); + ExtendedDoubleCounterBuilder extendedBuilder = (ExtendedDoubleCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleCounter instrument = builder.build(); + + instrument.add(5.5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6.6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleSumSatisfying( + sum -> + sum.isMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(12.1) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void longUpDownCounter() { + LongUpDownCounterBuilder builder = + meter.upDownCounterBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongUpDownCounterBuilder.class); + ExtendedLongUpDownCounterBuilder extendedBuilder = (ExtendedLongUpDownCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongUpDownCounter instrument = builder.build(); + + instrument.add(5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongSumSatisfying( + sum -> + sum.isNotMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(11) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void doubleUpDownCounter() { + DoubleUpDownCounterBuilder builder = + meter.upDownCounterBuilder("test").ofDoubles().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleUpDownCounterBuilder.class); + ExtendedDoubleUpDownCounterBuilder extendedBuilder = + (ExtendedDoubleUpDownCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleUpDownCounter instrument = builder.build(); + + instrument.add(5.5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6.6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleSumSatisfying( + sum -> + sum.isNotMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(12.1) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void longHistogram() { + LongHistogramBuilder builder = + meter.histogramBuilder("test").ofLongs().setDescription("d").setUnit("u"); + builder.setExplicitBucketBoundariesAdvice(singletonList(10L)); + assertThat(builder).isInstanceOf(ExtendedLongHistogramBuilder.class); + ExtendedLongHistogramBuilder extendedBuilder = (ExtendedLongHistogramBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongHistogram instrument = builder.build(); + + instrument.record(5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.record(6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasHistogramSatisfying( + histogram -> + histogram.hasPointsSatisfying( + point -> + point + .hasSum(11.0) + .hasBucketBoundaries(10.0) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void doubleHistogram() { + DoubleHistogramBuilder builder = + meter.histogramBuilder("test").setDescription("d").setUnit("u"); + builder.setExplicitBucketBoundariesAdvice(singletonList(10.0)); + assertThat(builder).isInstanceOf(ExtendedDoubleHistogramBuilder.class); + ExtendedDoubleHistogramBuilder extendedBuilder = (ExtendedDoubleHistogramBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleHistogram instrument = builder.build(); + + instrument.record(5.5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.record(6.6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasHistogramSatisfying( + histogram -> + histogram.hasPointsSatisfying( + point -> + point + .hasSum(12.1) + .hasBucketBoundaries(10.0) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void longGauge() throws InterruptedException { + LongGaugeBuilder builder = + meter.gaugeBuilder("test").ofLongs().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongGaugeBuilder.class); + ExtendedLongGaugeBuilder extendedBuilder = (ExtendedLongGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + ObservableLongGauge observableGauge = + builder.buildWithCallback( + result -> + result.record(123, Attributes.of(stringKey("test"), "test", stringKey("q"), "r"))); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> + point + .hasValue(123) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + observableGauge.close(); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } + + @Test + void syncLongGauge() throws InterruptedException { + LongGaugeBuilder builder = + meter.gaugeBuilder("test").ofLongs().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongGaugeBuilder.class); + ExtendedLongGaugeBuilder extendedBuilder = (ExtendedLongGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongGauge longGauge = extendedBuilder.build(); + longGauge.set(321); + longGauge.set(123, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> point.hasValue(321).hasAttributes(Attributes.empty()), + point -> + point + .hasValue(123) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } + + @Test + void doubleGauge() throws InterruptedException { + DoubleGaugeBuilder builder = meter.gaugeBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleGaugeBuilder.class); + ExtendedDoubleGaugeBuilder extendedBuilder = (ExtendedDoubleGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + ObservableDoubleGauge observableGauge = + builder.buildWithCallback( + result -> + result.record(1.23, Attributes.of(stringKey("test"), "test", stringKey("q"), "r"))); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> + point + .hasValue(1.23) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + observableGauge.close(); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } + + @Test + void syncDoubleGauge() throws InterruptedException { + DoubleGaugeBuilder builder = meter.gaugeBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleGaugeBuilder.class); + ExtendedDoubleGaugeBuilder extendedBuilder = (ExtendedDoubleGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleGauge doubleGauge = extendedBuilder.build(); + doubleGauge.set(3.21); + doubleGauge.set(1.23, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> point.hasValue(3.21).hasAttributes(Attributes.empty()), + point -> + point + .hasValue(1.23) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryApiIncubatorInstrumentationModule.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryApiIncubatorInstrumentationModule.java new file mode 100644 index 000000000000..5fb8680c31ba --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryApiIncubatorInstrumentationModule.java @@ -0,0 +1,40 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static java.util.Collections.singletonList; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; + +@AutoService(InstrumentationModule.class) +public class OpenTelemetryApiIncubatorInstrumentationModule extends InstrumentationModule { + public OpenTelemetryApiIncubatorInstrumentationModule() { + super("opentelemetry-api", "opentelemetry-api-1.37", "opentelemetry-api-incubator-1.37"); + } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + // skip instrumentation when opentelemetry-api-incubator is not present, instrumentation + // is handled by OpenTelemetryApiInstrumentationModule + return hasClassesNamed( + "application.io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder"); + } + + @Override + public boolean isIndyModule() { + return false; + } + + @Override + public List typeInstrumentations() { + return singletonList(new OpenTelemetryIncubatorInstrumentation()); + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryIncubatorInstrumentation.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryIncubatorInstrumentation.java new file mode 100644 index 000000000000..655df3855b53 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/OpenTelemetryIncubatorInstrumentation.java @@ -0,0 +1,40 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator; + +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.none; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics.ApplicationMeterFactory137Incubator; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; + +public class OpenTelemetryIncubatorInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("application.io.opentelemetry.api.GlobalOpenTelemetry"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + none(), OpenTelemetryIncubatorInstrumentation.class.getName() + "$InitAdvice"); + } + + @SuppressWarnings({"ReturnValueIgnored", "unused"}) + public static class InitAdvice { + @Advice.OnMethodEnter + public static void init() { + // the sole purpose of this advice is to ensure that ApplicationMeterFactory137Incubator + // is recognized as helper class and injected into class loader + ApplicationMeterFactory137Incubator.class.getName(); + } + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationDoubleHistogramBuilder137Incubator.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationDoubleHistogramBuilder137Incubator.java new file mode 100644 index 000000000000..737c62fedf4a --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationDoubleHistogramBuilder137Incubator.java @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; +import application.io.opentelemetry.api.metrics.LongHistogramBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationDoubleHistogramBuilder; +import java.util.List; + +class ApplicationDoubleHistogramBuilder137Incubator extends ApplicationDoubleHistogramBuilder + implements ExtendedDoubleHistogramBuilder { + + private final io.opentelemetry.api.metrics.DoubleHistogramBuilder agentBuilder; + + ApplicationDoubleHistogramBuilder137Incubator( + io.opentelemetry.api.metrics.DoubleHistogramBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public LongHistogramBuilder ofLongs() { + return new ApplicationLongHistogramBuilder137Incubator(agentBuilder.ofLongs()); + } + + @Override + public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice( + List bucketBoundaries) { + agentBuilder.setExplicitBucketBoundariesAdvice(bucketBoundaries); + return this; + } + + @Override + public ExtendedDoubleHistogramBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationLongHistogramBuilder137Incubator.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationLongHistogramBuilder137Incubator.java new file mode 100644 index 000000000000..1b4b8e8a0d48 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationLongHistogramBuilder137Incubator.java @@ -0,0 +1,38 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationLongHistogramBuilder; +import java.util.List; + +class ApplicationLongHistogramBuilder137Incubator extends ApplicationLongHistogramBuilder + implements ExtendedLongHistogramBuilder { + + private final io.opentelemetry.api.metrics.LongHistogramBuilder agentBuilder; + + ApplicationLongHistogramBuilder137Incubator( + io.opentelemetry.api.metrics.LongHistogramBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice( + List bucketBoundaries) { + agentBuilder.setExplicitBucketBoundariesAdvice(bucketBoundaries); + return this; + } + + @Override + public ExtendedLongHistogramBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeter137Incubator.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeter137Incubator.java new file mode 100644 index 000000000000..120d23ff0dc2 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeter137Incubator.java @@ -0,0 +1,24 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics; + +import application.io.opentelemetry.api.metrics.DoubleHistogramBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics.ApplicationMeter137; + +class ApplicationMeter137Incubator extends ApplicationMeter137 { + + private final io.opentelemetry.api.metrics.Meter agentMeter; + + ApplicationMeter137Incubator(io.opentelemetry.api.metrics.Meter agentMeter) { + super(agentMeter); + this.agentMeter = agentMeter; + } + + @Override + public DoubleHistogramBuilder histogramBuilder(String name) { + return new ApplicationDoubleHistogramBuilder137Incubator(agentMeter.histogramBuilder(name)); + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeterFactory137Incubator.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeterFactory137Incubator.java new file mode 100644 index 000000000000..2e250b24fa31 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationMeterFactory137Incubator.java @@ -0,0 +1,18 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics; + +import io.opentelemetry.api.metrics.Meter; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationMeter; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationMeterFactory; + +// this class is used from opentelemetry-api-1.27 via reflection +public final class ApplicationMeterFactory137Incubator implements ApplicationMeterFactory { + @Override + public ApplicationMeter newMeter(Meter agentMeter) { + return new ApplicationMeter137Incubator(agentMeter); + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleCounterBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleCounterBuilder137.java new file mode 100644 index 000000000000..32f803372278 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleCounterBuilder137.java @@ -0,0 +1,31 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedDoubleCounterBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationDoubleCounterBuilder; +import java.util.List; + +final class ApplicationDoubleCounterBuilder137 extends ApplicationDoubleCounterBuilder + implements ExtendedDoubleCounterBuilder { + + private final io.opentelemetry.api.metrics.DoubleCounterBuilder agentBuilder; + + ApplicationDoubleCounterBuilder137( + io.opentelemetry.api.metrics.DoubleCounterBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public ExtendedDoubleCounterBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleCounterBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleGaugeBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleGaugeBuilder137.java new file mode 100644 index 000000000000..b7606b672a23 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleGaugeBuilder137.java @@ -0,0 +1,56 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.common.Attributes; +import application.io.opentelemetry.api.incubator.metrics.DoubleGauge; +import application.io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder; +import application.io.opentelemetry.api.metrics.LongGaugeBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationDoubleGaugeBuilder; +import java.util.List; + +final class ApplicationDoubleGaugeBuilder137 extends ApplicationDoubleGaugeBuilder + implements ExtendedDoubleGaugeBuilder { + + private final io.opentelemetry.api.metrics.DoubleGaugeBuilder agentBuilder; + + ApplicationDoubleGaugeBuilder137(io.opentelemetry.api.metrics.DoubleGaugeBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public LongGaugeBuilder ofLongs() { + return new ApplicationLongGaugeBuilder137(agentBuilder.ofLongs()); + } + + @Override + public DoubleGauge build() { + io.opentelemetry.api.incubator.metrics.DoubleGauge agentDoubleGauge = + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder).build(); + return new DoubleGauge() { + + @Override + public void set(double value) { + agentDoubleGauge.set(value); + } + + @Override + public void set(double value, Attributes attributes) { + agentDoubleGauge.set(value, Bridging.toAgent(attributes)); + } + }; + } + + @Override + public ExtendedDoubleGaugeBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleHistogramBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleHistogramBuilder137.java new file mode 100644 index 000000000000..c9e8de50c2de --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleHistogramBuilder137.java @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; +import application.io.opentelemetry.api.metrics.LongHistogramBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationDoubleHistogramBuilder; +import java.util.List; + +final class ApplicationDoubleHistogramBuilder137 extends ApplicationDoubleHistogramBuilder + implements ExtendedDoubleHistogramBuilder { + + private final io.opentelemetry.api.metrics.DoubleHistogramBuilder agentBuilder; + + ApplicationDoubleHistogramBuilder137( + io.opentelemetry.api.metrics.DoubleHistogramBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public LongHistogramBuilder ofLongs() { + return new ApplicationLongHistogramBuilder137(agentBuilder.ofLongs()); + } + + @Override + public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice( + List bucketBoundaries) { + agentBuilder.setExplicitBucketBoundariesAdvice(bucketBoundaries); + return this; + } + + @Override + public ExtendedDoubleHistogramBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleUpDownCounterBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleUpDownCounterBuilder137.java new file mode 100644 index 000000000000..01fddfec825b --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationDoubleUpDownCounterBuilder137.java @@ -0,0 +1,31 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedDoubleUpDownCounterBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationDoubleUpDownCounterBuilder; +import java.util.List; + +final class ApplicationDoubleUpDownCounterBuilder137 extends ApplicationDoubleUpDownCounterBuilder + implements ExtendedDoubleUpDownCounterBuilder { + + private final io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder agentBuilder; + + ApplicationDoubleUpDownCounterBuilder137( + io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public ExtendedDoubleUpDownCounterBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedDoubleUpDownCounterBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongCounterBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongCounterBuilder137.java new file mode 100644 index 000000000000..253ddbab1187 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongCounterBuilder137.java @@ -0,0 +1,36 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedLongCounterBuilder; +import application.io.opentelemetry.api.metrics.DoubleCounterBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationLongCounterBuilder; +import java.util.List; + +final class ApplicationLongCounterBuilder137 extends ApplicationLongCounterBuilder + implements ExtendedLongCounterBuilder { + + private final io.opentelemetry.api.metrics.LongCounterBuilder agentBuilder; + + ApplicationLongCounterBuilder137(io.opentelemetry.api.metrics.LongCounterBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public DoubleCounterBuilder ofDoubles() { + return new ApplicationDoubleCounterBuilder137(agentBuilder.ofDoubles()); + } + + @Override + public ExtendedLongCounterBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedLongCounterBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongGaugeBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongGaugeBuilder137.java new file mode 100644 index 000000000000..5d17f6ca0328 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongGaugeBuilder137.java @@ -0,0 +1,49 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.common.Attributes; +import application.io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder; +import application.io.opentelemetry.api.incubator.metrics.LongGauge; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationLongGaugeBuilder; +import java.util.List; + +final class ApplicationLongGaugeBuilder137 extends ApplicationLongGaugeBuilder + implements ExtendedLongGaugeBuilder { + + private final io.opentelemetry.api.metrics.LongGaugeBuilder agentBuilder; + + ApplicationLongGaugeBuilder137(io.opentelemetry.api.metrics.LongGaugeBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public LongGauge build() { + io.opentelemetry.api.incubator.metrics.LongGauge agentLongGauge = + ((io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder).build(); + return new LongGauge() { + @Override + public void set(long value) { + agentLongGauge.set(value); + } + + @Override + public void set(long value, Attributes attributes) { + agentLongGauge.set(value, Bridging.toAgent(attributes)); + } + }; + } + + @Override + public ExtendedLongGaugeBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongHistogramBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongHistogramBuilder137.java new file mode 100644 index 000000000000..77ea41cb7b78 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongHistogramBuilder137.java @@ -0,0 +1,38 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationLongHistogramBuilder; +import java.util.List; + +final class ApplicationLongHistogramBuilder137 extends ApplicationLongHistogramBuilder + implements ExtendedLongHistogramBuilder { + + private final io.opentelemetry.api.metrics.LongHistogramBuilder agentBuilder; + + ApplicationLongHistogramBuilder137( + io.opentelemetry.api.metrics.LongHistogramBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice( + List bucketBoundaries) { + agentBuilder.setExplicitBucketBoundariesAdvice(bucketBoundaries); + return this; + } + + @Override + public ExtendedLongHistogramBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongUpDownCounterBuilder137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongUpDownCounterBuilder137.java new file mode 100644 index 000000000000..6beebef2bdc2 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationLongUpDownCounterBuilder137.java @@ -0,0 +1,37 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.common.AttributeKey; +import application.io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder; +import application.io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationLongUpDownCounterBuilder; +import java.util.List; + +final class ApplicationLongUpDownCounterBuilder137 extends ApplicationLongUpDownCounterBuilder + implements ExtendedLongUpDownCounterBuilder { + + private final io.opentelemetry.api.metrics.LongUpDownCounterBuilder agentBuilder; + + ApplicationLongUpDownCounterBuilder137( + io.opentelemetry.api.metrics.LongUpDownCounterBuilder agentBuilder) { + super(agentBuilder); + this.agentBuilder = agentBuilder; + } + + @Override + public DoubleUpDownCounterBuilder ofDoubles() { + return new ApplicationDoubleUpDownCounterBuilder137(agentBuilder.ofDoubles()); + } + + @Override + public ExtendedLongUpDownCounterBuilder setAttributesAdvice(List> attributes) { + ((io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder) agentBuilder) + .setAttributesAdvice(Bridging.toAgent(attributes)); + return this; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeter137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeter137.java new file mode 100644 index 000000000000..3d0e6da1add7 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeter137.java @@ -0,0 +1,42 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import application.io.opentelemetry.api.metrics.DoubleGaugeBuilder; +import application.io.opentelemetry.api.metrics.DoubleHistogramBuilder; +import application.io.opentelemetry.api.metrics.LongCounterBuilder; +import application.io.opentelemetry.api.metrics.LongUpDownCounterBuilder; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_15.metrics.ApplicationMeter115; + +public class ApplicationMeter137 extends ApplicationMeter115 { + + private final io.opentelemetry.api.metrics.Meter agentMeter; + + protected ApplicationMeter137(io.opentelemetry.api.metrics.Meter agentMeter) { + super(agentMeter); + this.agentMeter = agentMeter; + } + + @Override + public LongCounterBuilder counterBuilder(String name) { + return new ApplicationLongCounterBuilder137(agentMeter.counterBuilder(name)); + } + + @Override + public LongUpDownCounterBuilder upDownCounterBuilder(String name) { + return new ApplicationLongUpDownCounterBuilder137(agentMeter.upDownCounterBuilder(name)); + } + + @Override + public DoubleHistogramBuilder histogramBuilder(String name) { + return new ApplicationDoubleHistogramBuilder137(agentMeter.histogramBuilder(name)); + } + + @Override + public DoubleGaugeBuilder gaugeBuilder(String name) { + return new ApplicationDoubleGaugeBuilder137(agentMeter.gaugeBuilder(name)); + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeterFactory137.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeterFactory137.java new file mode 100644 index 000000000000..4075696e7a1d --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/ApplicationMeterFactory137.java @@ -0,0 +1,18 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import io.opentelemetry.api.metrics.Meter; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationMeter; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationMeterFactory; + +// this class is used from opentelemetry-api-1.27 via reflection +public final class ApplicationMeterFactory137 implements ApplicationMeterFactory { + @Override + public ApplicationMeter newMeter(Meter agentMeter) { + return new ApplicationMeter137(agentMeter); + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/MeterTest.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/MeterTest.java new file mode 100644 index 000000000000..519656f2b27b --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/metrics/MeterTest.java @@ -0,0 +1,116 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.metrics; + +import static io.opentelemetry.api.common.AttributeKey.stringKey; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static java.util.Collections.singletonList; + +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.metrics.DoubleHistogram; +import io.opentelemetry.api.metrics.DoubleHistogramBuilder; +import io.opentelemetry.api.metrics.LongHistogram; +import io.opentelemetry.api.metrics.LongHistogramBuilder; +import io.opentelemetry.api.metrics.Meter; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.extension.RegisterExtension; + +class MeterTest { + + @RegisterExtension + static final AgentInstrumentationExtension testing = AgentInstrumentationExtension.create(); + + private String instrumentationName; + private Meter meter; + + @BeforeEach + void setupMeter(TestInfo test) { + instrumentationName = "test-" + test.getDisplayName(); + meter = + testing + .getOpenTelemetry() + .getMeterProvider() + .meterBuilder(instrumentationName) + .setInstrumentationVersion("1.2.3") + .setSchemaUrl("http://schema.org") + .build(); + } + + @Test + void longHistogram() { + LongHistogramBuilder builder = + meter.histogramBuilder("test").ofLongs().setDescription("d").setUnit("u"); + builder.setExplicitBucketBoundariesAdvice(singletonList(10L)); + + LongHistogram instrument = builder.build(); + + instrument.record(5, Attributes.of(stringKey("test"), "test")); + instrument.record(6, Attributes.of(stringKey("test"), "test")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasHistogramSatisfying( + histogram -> + histogram.hasPointsSatisfying( + point -> + point + .hasSum(11.0) + .hasBucketBoundaries(10.0) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void doubleHistogram() { + DoubleHistogramBuilder builder = + meter.histogramBuilder("test").setDescription("d").setUnit("u"); + builder.setExplicitBucketBoundariesAdvice(singletonList(10.0)); + + DoubleHistogram instrument = builder.build(); + + instrument.record(5.5, Attributes.of(stringKey("test"), "test")); + instrument.record(6.6, Attributes.of(stringKey("test"), "test")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasHistogramSatisfying( + histogram -> + histogram.hasPointsSatisfying( + point -> + point + .hasSum(12.1) + .hasBucketBoundaries(10.0) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } +} diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/build.gradle.kts b/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/build.gradle.kts index 610cf61305d4..aa1653528255 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/build.gradle.kts +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/build.gradle.kts @@ -4,9 +4,9 @@ plugins { dependencies { implementation(project(":instrumentation:runtime-telemetry:runtime-telemetry-java8:library")) - implementation("io.opentelemetry:opentelemetry-api-events") compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") + compileOnly("io.opentelemetry:opentelemetry-api-incubator") } tasks { diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/main/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzer.java b/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/main/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzer.java index ad3f2ea8cda0..8ba588790500 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/main/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzer.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/main/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzer.java @@ -13,8 +13,8 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.api.events.EventEmitter; -import io.opentelemetry.api.events.GlobalEventEmitterProvider; +import io.opentelemetry.api.incubator.events.EventLogger; +import io.opentelemetry.api.incubator.events.GlobalEventLoggerProvider; import io.opentelemetry.instrumentation.runtimemetrics.java8.internal.JmxRuntimeMetricsUtil; import io.opentelemetry.sdk.common.Clock; import io.opentelemetry.sdk.internal.DaemonThreadFactory; @@ -42,8 +42,7 @@ final class JarAnalyzer implements ClassFileTransformer { private static final Logger logger = Logger.getLogger(JarAnalyzer.class.getName()); - private static final String EVENT_DOMAIN_PACKAGE = "package"; - private static final String EVENT_NAME_INFO = "info"; + private static final String EVENT_NAME_INFO = "package.info"; static final AttributeKey PACKAGE_NAME = AttributeKey.stringKey("package.name"); static final AttributeKey PACKAGE_VERSION = AttributeKey.stringKey("package.version"); static final AttributeKey PACKAGE_TYPE = AttributeKey.stringKey("package.type"); @@ -58,14 +57,13 @@ final class JarAnalyzer implements ClassFileTransformer { private final BlockingQueue toProcess = new LinkedBlockingDeque<>(); private JarAnalyzer(OpenTelemetry unused, int jarsPerSecond) { - // TODO(jack-berg): Use OpenTelemetry to obtain EventEmitter when event API is stable - EventEmitter eventEmitter = - GlobalEventEmitterProvider.get() - .eventEmitterBuilder(JmxRuntimeMetricsUtil.getInstrumentationName()) + // TODO(jack-berg): Use OpenTelemetry to obtain EventLogger when event API is stable + EventLogger eventLogger = + GlobalEventLoggerProvider.get() + .eventLoggerBuilder(JmxRuntimeMetricsUtil.getInstrumentationName()) .setInstrumentationVersion(JmxRuntimeMetricsUtil.getInstrumentationVersion()) - .setEventDomain(EVENT_DOMAIN_PACKAGE) .build(); - Worker worker = new Worker(eventEmitter, toProcess, jarsPerSecond); + Worker worker = new Worker(eventLogger, toProcess, jarsPerSecond); Thread workerThread = new DaemonThreadFactory(JarAnalyzer.class.getSimpleName() + "_WorkerThread") .newThread(worker); @@ -137,12 +135,12 @@ private void handle(ProtectionDomain protectionDomain) { private static final class Worker implements Runnable { - private final EventEmitter eventEmitter; + private final EventLogger eventLogger; private final BlockingQueue toProcess; private final io.opentelemetry.sdk.internal.RateLimiter rateLimiter; - private Worker(EventEmitter eventEmitter, BlockingQueue toProcess, int jarsPerSecond) { - this.eventEmitter = eventEmitter; + private Worker(EventLogger eventLogger, BlockingQueue toProcess, int jarsPerSecond) { + this.eventLogger = eventLogger; this.toProcess = toProcess; this.rateLimiter = new io.opentelemetry.sdk.internal.RateLimiter( @@ -151,7 +149,7 @@ private Worker(EventEmitter eventEmitter, BlockingQueue toProcess, int jars /** * Continuously poll the {@link #toProcess} for archive {@link URL}s, and process each wit - * {@link #processUrl(EventEmitter, URL)}. + * {@link #processUrl(EventLogger, URL)}. */ @Override public void run() { @@ -172,7 +170,7 @@ public void run() { try { // TODO(jack-berg): add ability to optionally re-process urls periodically to re-emit // events - processUrl(eventEmitter, archiveUrl); + processUrl(eventLogger, archiveUrl); } catch (Throwable e) { logger.log(Level.WARNING, "Unexpected error processing archive URL: " + archiveUrl, e); } @@ -185,7 +183,7 @@ public void run() { * Process the {@code archiveUrl}, extracting metadata from it and emitting an event with the * content. */ - static void processUrl(EventEmitter eventEmitter, URL archiveUrl) { + static void processUrl(EventLogger eventLogger, URL archiveUrl) { JarDetails jarDetails; try { jarDetails = JarDetails.forUrl(archiveUrl); @@ -224,6 +222,6 @@ static void processUrl(EventEmitter eventEmitter, URL archiveUrl) { builder.put(PACKAGE_CHECKSUM, packageChecksum); builder.put(PACKAGE_CHECKSUM_ALGORITHM, "SHA1"); - eventEmitter.emit(EVENT_NAME_INFO, builder.build()); + eventLogger.builder(EVENT_NAME_INFO).setAttributes(builder.build()).emit(); } } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerInstallerTest.java b/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerInstallerTest.java index a763bed2f042..5d341ef80bc2 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerInstallerTest.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java8/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerInstallerTest.java @@ -9,7 +9,6 @@ import static java.util.stream.Collectors.toList; import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.common.Attributes; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.sdk.logs.data.LogRecordData; @@ -35,23 +34,16 @@ void jarAnalyzerEnabled() throws InterruptedException { List events = Awaitility.await() .until( - () -> { - List logRecordData = testing.logRecords(); - List eventList = - logRecordData.stream() - .filter( - record -> { - Attributes attributes = record.getAttributes(); - return "package" - .equals( - attributes.get(AttributeKey.stringKey("event.domain"))) - && "info" - .equals( - attributes.get(AttributeKey.stringKey("event.name"))); - }) - .collect(toList()); - return eventList; - }, + () -> + testing.logRecords().stream() + .filter( + record -> + "package.info" + .equals( + record + .getAttributes() + .get(AttributeKey.stringKey("event.name")))) + .collect(toList()), (eventList) -> !eventList.isEmpty()); assertThat(events) diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java8/library/build.gradle.kts b/instrumentation/runtime-telemetry/runtime-telemetry-java8/library/build.gradle.kts index c5a2027d7cf5..05bc4da693f6 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java8/library/build.gradle.kts +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java8/library/build.gradle.kts @@ -4,7 +4,6 @@ plugins { dependencies { implementation(project(":instrumentation-api")) - implementation("io.opentelemetry:opentelemetry-extension-incubator") testImplementation(project(":testing-common")) } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/build.gradle.kts b/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/build.gradle.kts index 20f7e2cefbc8..dc808ed744aa 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/build.gradle.kts +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/build.gradle.kts @@ -7,11 +7,11 @@ plugins { dependencies { testImplementation(project(":instrumentation:runtime-telemetry:runtime-telemetry-java8:javaagent")) - testImplementation("io.opentelemetry:opentelemetry-api-events") testImplementation("io.opentelemetry:opentelemetry-sdk-testing") // Bring in various archives to test introspection logic testImplementation("io.opentelemetry:opentelemetry-api") + testImplementation("io.opentelemetry:opentelemetry-api-incubator") testImplementation("org.springframework:spring-webmvc:3.1.0.RELEASE") testImplementation("com.google.guava:guava") } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerTest.java b/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerTest.java index 04778527a4ab..f49aba1cbe40 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerTest.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java8/testing/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java8/JarAnalyzerTest.java @@ -13,13 +13,16 @@ import static io.opentelemetry.instrumentation.javaagent.runtimemetrics.java8.JarAnalyzer.PACKAGE_TYPE; import static io.opentelemetry.instrumentation.javaagent.runtimemetrics.java8.JarAnalyzer.PACKAGE_VERSION; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableMap; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.api.events.EventEmitter; +import io.opentelemetry.api.incubator.events.EventBuilder; +import io.opentelemetry.api.incubator.events.EventLogger; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.sdk.testing.assertj.AttributesAssert; import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; @@ -39,11 +42,15 @@ class JarAnalyzerTest { @ParameterizedTest @MethodSource("processUrlArguments") void processUrl_EmitsEvents(URL archiveUrl, Consumer attributesConsumer) { - EventEmitter eventEmitter = mock(EventEmitter.class); - JarAnalyzer.processUrl(eventEmitter, archiveUrl); + EventLogger eventLogger = mock(EventLogger.class); + EventBuilder builder = mock(EventBuilder.class); + when(eventLogger.builder(eq("package.info"))).thenReturn(builder); + when(builder.setAttributes(any())).thenReturn(builder); + + JarAnalyzer.processUrl(eventLogger, archiveUrl); ArgumentCaptor attributesArgumentCaptor = ArgumentCaptor.forClass(Attributes.class); - verify(eventEmitter).emit(eq("info"), attributesArgumentCaptor.capture()); + verify(builder).setAttributes(attributesArgumentCaptor.capture()); attributesConsumer.accept( OpenTelemetryAssertions.assertThat(attributesArgumentCaptor.getValue())); diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index 54c3e483f9d2..57702f165a92 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { implementation(project(":muzzle")) implementation("io.opentelemetry:opentelemetry-api") - testImplementation("io.opentelemetry:opentelemetry-api-events") + testImplementation("io.opentelemetry:opentelemetry-api-incubator") implementation("io.opentelemetry:opentelemetry-sdk") implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") implementation("io.opentelemetry:opentelemetry-extension-kotlin") diff --git a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy index dc3533d55e92..614daa9be8b1 100755 --- a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy +++ b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy @@ -7,19 +7,19 @@ package io.opentelemetry.javaagent.tooling import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.OpenTelemetry -import io.opentelemetry.api.events.GlobalEventEmitterProvider +import io.opentelemetry.api.incubator.events.GlobalEventLoggerProvider import spock.lang.Specification class OpenTelemetryInstallerTest extends Specification { void setup() { GlobalOpenTelemetry.resetForTest() - GlobalEventEmitterProvider.resetForTest() + GlobalEventLoggerProvider.resetForTest() } void cleanup() { GlobalOpenTelemetry.resetForTest() - GlobalEventEmitterProvider.resetForTest() + GlobalEventLoggerProvider.resetForTest() } def "should initialize GlobalOpenTelemetry"() { diff --git a/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java b/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java index a1280a91b6c2..2b0ae675ecdc 100644 --- a/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java +++ b/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java @@ -10,7 +10,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.GlobalOpenTelemetry; -import io.opentelemetry.api.events.GlobalEventEmitterProvider; +import io.opentelemetry.api.incubator.events.GlobalEventLoggerProvider; import io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.internal.AutoConfigureUtil; @@ -33,7 +33,7 @@ class ConfigurationPropertiesSupplierTest { @AfterAll static void cleanUp() { GlobalOpenTelemetry.resetForTest(); - GlobalEventEmitterProvider.resetForTest(); + GlobalEventLoggerProvider.resetForTest(); } // regression for https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/6696 diff --git a/javaagent/build.gradle.kts b/javaagent/build.gradle.kts index 2d0afe36e557..0af705805cc5 100644 --- a/javaagent/build.gradle.kts +++ b/javaagent/build.gradle.kts @@ -34,10 +34,9 @@ val javaagentLibs by configurations.creating { listOf(baseJavaagentLibs, javaagentLibs).forEach { it.run { exclude("io.opentelemetry", "opentelemetry-api") - exclude("io.opentelemetry", "opentelemetry-api-events") exclude("io.opentelemetry.semconv", "opentelemetry-semconv") - // metrics advice API - exclude("io.opentelemetry", "opentelemetry-extension-incubator") + // events API and metrics advice API + exclude("io.opentelemetry", "opentelemetry-api-incubator") } } @@ -48,8 +47,8 @@ val licenseReportDependencies by configurations.creating { dependencies { bootstrapLibs(project(":instrumentation-api")) - // opentelemetry-api is an api dependency of :instrumentation-api, but opentelemetry-api-events is not - bootstrapLibs("io.opentelemetry:opentelemetry-api-events") + // opentelemetry-api is an api dependency of :instrumentation-api, but opentelemetry-api-incubator is not + bootstrapLibs("io.opentelemetry:opentelemetry-api-incubator") bootstrapLibs(project(":instrumentation-api-semconv")) bootstrapLibs(project(":instrumentation-annotations-support")) bootstrapLibs(project(":javaagent-bootstrap")) diff --git a/licenses/licenses.md b/licenses/licenses.md index bc03a5ff4107..442a14f6bb23 100644 --- a/licenses/licenses.md +++ b/licenses/licenses.md @@ -1,7 +1,7 @@ # javaagent ## Dependency License Report -_2024-03-29 11:20:52 EET_ +_2024-04-12 11:26:43 EEST_ ## Apache License, Version 2.0 **1** **Group:** `com.blogspot.mydailyjava` **Name:** `weak-lock-free` **Version:** `0.18` @@ -51,256 +51,252 @@ _2024-03-29 11:20:52 EET_ > - **POM Project URL**: [https://github.com/square/okio/](https://github.com/square/okio/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**9** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api` **Version:** `1.36.0` +**9** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**10** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api-events` **Version:** `1.36.0-alpha` +**10** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api-incubator` **Version:** `1.37.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**11** **Group:** `io.opentelemetry` **Name:** `opentelemetry-context` **Version:** `1.36.0` +**11** **Group:** `io.opentelemetry` **Name:** `opentelemetry-context` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**12** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-common` **Version:** `1.36.0` +**12** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-common` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**13** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging` **Version:** `1.36.0` +**13** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**14** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging-otlp` **Version:** `1.36.0` +**14** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging-otlp` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**15** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp` **Version:** `1.36.0` +**15** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**16** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp-common` **Version:** `1.36.0` +**16** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp-common` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**17** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-prometheus` **Version:** `1.36.0-alpha` +**17** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-prometheus` **Version:** `1.37.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**18** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-sender-okhttp` **Version:** `1.36.0` +**18** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-sender-okhttp` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**19** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-zipkin` **Version:** `1.36.0` +**19** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-zipkin` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**20** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-incubator` **Version:** `1.36.0-alpha` -> - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) -> - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) - -**21** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-kotlin` **Version:** `1.36.0` +**20** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-kotlin` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**22** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-trace-propagators` **Version:** `1.36.0` +**21** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-trace-propagators` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**23** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk` **Version:** `1.36.0` +**22** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**24** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-common` **Version:** `1.36.0` +**23** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-common` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**25** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure` **Version:** `1.36.0` +**24** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**26** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure-spi` **Version:** `1.36.0` +**25** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure-spi` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**27** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-incubator` **Version:** `1.36.0-alpha` +**26** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-incubator` **Version:** `1.37.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**28** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-jaeger-remote-sampler` **Version:** `1.36.0` +**27** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-jaeger-remote-sampler` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**29** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-logs` **Version:** `1.36.0` +**28** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-logs` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**30** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-metrics` **Version:** `1.36.0` +**29** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-metrics` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**31** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-trace` **Version:** `1.36.0` +**30** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-trace` **Version:** `1.37.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**32** **Group:** `io.opentelemetry.contrib` **Name:** `opentelemetry-aws-xray-propagator` **Version:** `1.34.0-alpha` +**31** **Group:** `io.opentelemetry.contrib` **Name:** `opentelemetry-aws-xray-propagator` **Version:** `1.34.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java-contrib](https://github.com/open-telemetry/opentelemetry-java-contrib) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**33** **Group:** `io.opentelemetry.semconv` **Name:** `opentelemetry-semconv` **Version:** `1.23.1-alpha` +**32** **Group:** `io.opentelemetry.semconv` **Name:** `opentelemetry-semconv` **Version:** `1.23.1-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/semantic-conventions-java](https://github.com/open-telemetry/semantic-conventions-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**34** **Group:** `io.prometheus` **Name:** `prometheus-metrics-config` **Version:** `1.1.0` +**33** **Group:** `io.prometheus` **Name:** `prometheus-metrics-config` **Version:** `1.2.1` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**35** **Group:** `io.prometheus` **Name:** `prometheus-metrics-exporter-common` **Version:** `1.1.0` +**34** **Group:** `io.prometheus` **Name:** `prometheus-metrics-exporter-common` **Version:** `1.2.1` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**36** **Group:** `io.prometheus` **Name:** `prometheus-metrics-exporter-httpserver` **Version:** `1.1.0` +**35** **Group:** `io.prometheus` **Name:** `prometheus-metrics-exporter-httpserver` **Version:** `1.2.1` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**37** **Group:** `io.prometheus` **Name:** `prometheus-metrics-exposition-formats` **Version:** `1.1.0` +**36** **Group:** `io.prometheus` **Name:** `prometheus-metrics-exposition-formats` **Version:** `1.2.1` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**38** **Group:** `io.prometheus` **Name:** `prometheus-metrics-model` **Version:** `1.1.0` +**37** **Group:** `io.prometheus` **Name:** `prometheus-metrics-model` **Version:** `1.2.1` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**39** **Group:** `io.prometheus` **Name:** `prometheus-metrics-shaded-protobuf` **Version:** `1.1.0` +**38** **Group:** `io.prometheus` **Name:** `prometheus-metrics-shaded-protobuf` **Version:** `1.2.1` > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**40** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-reporter` **Version:** `3.3.0` +**39** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-reporter` **Version:** `3.3.0` > - **Manifest Project URL**: [https://zipkin.io/](https://zipkin.io/) > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [zipkin-reporter-3.3.0.jar/META-INF/LICENSE](zipkin-reporter-3.3.0.jar/META-INF/LICENSE) -**41** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-sender-okhttp3` **Version:** `3.3.0` +**40** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-sender-okhttp3` **Version:** `3.3.0` > - **Manifest Project URL**: [https://zipkin.io/](https://zipkin.io/) > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [zipkin-sender-okhttp3-3.3.0.jar/META-INF/LICENSE](zipkin-sender-okhttp3-3.3.0.jar/META-INF/LICENSE) -**42** **Group:** `io.zipkin.zipkin2` **Name:** `zipkin` **Version:** `2.27.1` +**41** **Group:** `io.zipkin.zipkin2` **Name:** `zipkin` **Version:** `2.27.1` > - **Manifest Project URL**: [http://zipkin.io/](http://zipkin.io/) > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [zipkin-2.27.1.jar/META-INF/LICENSE](zipkin-2.27.1.jar/META-INF/LICENSE) -**43** **Group:** `net.bytebuddy` **Name:** `byte-buddy-dep` **Version:** `1.14.13` +**42** **Group:** `net.bytebuddy` **Name:** `byte-buddy-dep` **Version:** `1.14.13` > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [byte-buddy-dep-1.14.13.jar/META-INF/LICENSE](byte-buddy-dep-1.14.13.jar/META-INF/LICENSE) - [byte-buddy-dep-1.14.13.jar/META-INF/NOTICE](byte-buddy-dep-1.14.13.jar/META-INF/NOTICE) -**44** **Group:** `org.jetbrains` **Name:** `annotations` **Version:** `13.0` +**43** **Group:** `org.jetbrains` **Name:** `annotations` **Version:** `13.0` > - **POM Project URL**: [http://www.jetbrains.org](http://www.jetbrains.org) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**45** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib` **Version:** `1.9.23` +**44** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib` **Version:** `1.9.23` > - **POM Project URL**: [https://kotlinlang.org/](https://kotlinlang.org/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**46** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk7` **Version:** `1.9.23` +**45** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk7` **Version:** `1.9.23` > - **POM Project URL**: [https://kotlinlang.org/](https://kotlinlang.org/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**47** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk8` **Version:** `1.9.23` +**46** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk8` **Version:** `1.9.23` > - **POM Project URL**: [https://kotlinlang.org/](https://kotlinlang.org/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**48** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.7` +**47** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**49** **Group:** `org.ow2.asm` **Name:** `asm-analysis` **Version:** `9.7` +**48** **Group:** `org.ow2.asm` **Name:** `asm-analysis` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**50** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.6` +**49** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.6` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**51** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.7` +**50** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**52** **Group:** `org.ow2.asm` **Name:** `asm-util` **Version:** `9.7` +**51** **Group:** `org.ow2.asm` **Name:** `asm-util` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**53** **Group:** `org.snakeyaml` **Name:** `snakeyaml-engine` **Version:** `2.7` +**52** **Group:** `org.snakeyaml` **Name:** `snakeyaml-engine` **Version:** `2.7` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM Project URL**: [https://bitbucket.org/snakeyaml/snakeyaml-engine](https://bitbucket.org/snakeyaml/snakeyaml-engine) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**54** **Group:** `org.yaml` **Name:** `snakeyaml` **Version:** `2.2` +**53** **Group:** `org.yaml` **Name:** `snakeyaml` **Version:** `2.2` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM Project URL**: [https://bitbucket.org/snakeyaml/snakeyaml](https://bitbucket.org/snakeyaml/snakeyaml) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) ## MIT License -**55** **Group:** `org.slf4j` **Name:** `slf4j-api` **Version:** `2.0.12` +**54** **Group:** `org.slf4j` **Name:** `slf4j-api` **Version:** `2.0.12` > - **Project URL**: [http://www.slf4j.org](http://www.slf4j.org) > - **POM License**: MIT License - [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) > - **Embedded license files**: [slf4j-api-2.0.12.jar/META-INF/LICENSE.txt](slf4j-api-2.0.12.jar/META-INF/LICENSE.txt) -**56** **Group:** `org.slf4j` **Name:** `slf4j-simple` **Version:** `2.0.12` +**55** **Group:** `org.slf4j` **Name:** `slf4j-simple` **Version:** `2.0.12` > - **Project URL**: [http://www.slf4j.org](http://www.slf4j.org) > - **POM License**: MIT License - [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) > - **Embedded license files**: [slf4j-simple-2.0.12.jar/META-INF/LICENSE.txt](slf4j-simple-2.0.12.jar/META-INF/LICENSE.txt) ## The 3-Clause BSD License -**57** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.7` +**56** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**58** **Group:** `org.ow2.asm` **Name:** `asm-analysis` **Version:** `9.7` +**57** **Group:** `org.ow2.asm` **Name:** `asm-analysis` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**59** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.6` +**58** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.6` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**60** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.7` +**59** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**61** **Group:** `org.ow2.asm` **Name:** `asm-util` **Version:** `9.7` +**60** **Group:** `org.ow2.asm` **Name:** `asm-util` **Version:** `9.7` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) @@ -309,4 +305,4 @@ _2024-03-29 11:20:52 EET_ ## Unknown -**62** **Group:** `com.squareup.okio` **Name:** `okio` **Version:** `3.9.0` +**61** **Group:** `com.squareup.okio` **Name:** `okio` **Version:** `3.9.0` diff --git a/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts b/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts index 8075e3ebd2d5..eb21d040ba5a 100644 --- a/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts +++ b/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts @@ -45,6 +45,13 @@ val v1_32Deps by configurations.creating { exclude("io.opentelemetry", "opentelemetry-bom") exclude("io.opentelemetry", "opentelemetry-bom-alpha") } +val v1_37Deps by configurations.creating { + isCanBeResolved = true + isCanBeConsumed = false + // exclude the bom added by dependencyManagement + exclude("io.opentelemetry", "opentelemetry-bom") + exclude("io.opentelemetry", "opentelemetry-bom-alpha") +} // configuration for publishing the shadowed artifact val v1_10 by configurations.creating { @@ -67,6 +74,10 @@ val v1_32 by configurations.creating { isCanBeConsumed = true isCanBeResolved = false } +val v1_37 by configurations.creating { + isCanBeConsumed = true + isCanBeResolved = false +} dependencies { latestDeps("io.opentelemetry:opentelemetry-api") @@ -111,6 +122,14 @@ dependencies { } } } + + listOf("opentelemetry-api-incubator").forEach { + v1_37Deps("io.opentelemetry:$it") { + version { + strictly("1.37.0-alpha") + } + } + } } // OpenTelemetry API shaded so that it can be used in instrumentation of OpenTelemetry API itself, @@ -145,6 +164,10 @@ tasks { configurations = listOf(v1_32Deps) archiveClassifier.set("v1_32") } + val v1_37Shadow by registering(ShadowJar::class) { + configurations = listOf(v1_37Deps) + archiveClassifier.set("v1_37") + } artifacts { add(v1_10.name, v1_10Shadow) @@ -152,5 +175,6 @@ tasks { add(v1_27.name, v1_27Shadow) add(v1_31.name, v1_31Shadow) add(v1_32.name, v1_32Shadow) + add(v1_37.name, v1_37Shadow) } } diff --git a/settings.gradle.kts b/settings.gradle.kts index cc39ae7f1718..dcf48ce8e418 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -396,6 +396,7 @@ include(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent") include(":instrumentation:opentelemetry-api:opentelemetry-api-1.27:javaagent") include(":instrumentation:opentelemetry-api:opentelemetry-api-1.31:javaagent") include(":instrumentation:opentelemetry-api:opentelemetry-api-1.32:javaagent") +include(":instrumentation:opentelemetry-api:opentelemetry-api-1.37:javaagent") include(":instrumentation:opentelemetry-extension-annotations-1.0:javaagent") include(":instrumentation:opentelemetry-extension-kotlin-1.0:javaagent") include(":instrumentation:opentelemetry-instrumentation-annotations-1.16:javaagent") From 2aee33086d4fc5c5645fbff85318076d2df5c247 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Wed, 10 Apr 2024 15:21:01 +0300 Subject: [PATCH 2/4] Run opentelemetry api bridge tests agains the bridged api version (#11085) --- .../javaagent/build.gradle.kts | 9 ++++++++ .../javaagent/build.gradle.kts | 8 +++++++ .../v1_10/metrics/MeterTest.java | 23 ++++++++++++++----- .../javaagent/build.gradle.kts | 8 +++++++ .../javaagent/build.gradle.kts | 8 +++++++ .../javaagent/build.gradle.kts | 8 +++++++ .../javaagent/build.gradle.kts | 8 +++++++ .../javaagent/build.gradle.kts | 8 +++++++ 8 files changed, 74 insertions(+), 6 deletions(-) diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts index c686848ad94c..6dd1f7455f1f 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts @@ -42,3 +42,12 @@ dependencies { // @WithSpan annotation is used to generate spans in ContextBridgeTest testImplementation(project(":instrumentation-annotations")) } + +configurations.configureEach { + if (name == "testRuntimeClasspath" || name == "testCompileClasspath") { + resolutionStrategy { + // earliest version that works with out test harness + force("io.opentelemetry:opentelemetry-api:1.4.0") + } + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/build.gradle.kts index de5df0b95397..fd028894c92f 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/build.gradle.kts @@ -7,3 +7,11 @@ dependencies { implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent")) } + +configurations.configureEach { + if (name == "testRuntimeClasspath" || name == "testCompileClasspath") { + resolutionStrategy { + force("io.opentelemetry:opentelemetry-api:1.10.0") + } + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/metrics/MeterTest.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/metrics/MeterTest.java index 65a798b93bec..2213bac3006f 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/metrics/MeterTest.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/metrics/MeterTest.java @@ -25,6 +25,7 @@ import io.opentelemetry.api.metrics.ObservableLongUpDownCounter; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import java.lang.reflect.Method; import org.assertj.core.api.AbstractIterableAssert; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -116,7 +117,7 @@ void observableLongCounter() throws InterruptedException { .hasAttributesSatisfying( equalTo(AttributeKey.stringKey("q"), "r")))))); - observableCounter.close(); + close(observableCounter); // sleep exporter interval Thread.sleep(100); @@ -192,7 +193,7 @@ void observableDoubleCounter() throws InterruptedException { .hasAttributesSatisfying( equalTo(AttributeKey.stringKey("q"), "r")))))); - observableCounter.close(); + close(observableCounter); // sleep exporter interval Thread.sleep(100); @@ -267,7 +268,7 @@ void observableLongUpDownCounter() throws InterruptedException { .hasAttributesSatisfying( equalTo(AttributeKey.stringKey("q"), "r")))))); - observableCounter.close(); + close(observableCounter); // sleep exporter interval Thread.sleep(100); @@ -343,7 +344,7 @@ void observableDoubleUpDownCounter() throws InterruptedException { .hasAttributesSatisfying( equalTo(AttributeKey.stringKey("q"), "r")))))); - observableCounter.close(); + close(observableCounter); // sleep exporter interval Thread.sleep(100); @@ -448,7 +449,7 @@ void longGauge() throws InterruptedException { .hasAttributesSatisfying( equalTo(AttributeKey.stringKey("q"), "r")))))); - observableGauge.close(); + close(observableGauge); // sleep exporter interval Thread.sleep(100); @@ -490,7 +491,7 @@ void doubleGauge() throws InterruptedException { .hasAttributesSatisfying( equalTo(AttributeKey.stringKey("q"), "r")))))); - observableGauge.close(); + close(observableGauge); // sleep exporter interval Thread.sleep(100); @@ -499,4 +500,14 @@ void doubleGauge() throws InterruptedException { testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); } + + private static void close(Object observableInstrument) { + // our bridge includes close method, although it was added in 1.12 + try { + Method close = observableInstrument.getClass().getDeclaredMethod("close"); + close.invoke(observableInstrument); + } catch (Exception exception) { + throw new IllegalStateException("Failed to call close", exception); + } + } } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.15/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.15/javaagent/build.gradle.kts index d4a4f8701cb6..4b91c4e5f5da 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.15/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.15/javaagent/build.gradle.kts @@ -8,3 +8,11 @@ dependencies { implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent")) } + +configurations.configureEach { + if (name == "testRuntimeClasspath" || name == "testCompileClasspath") { + resolutionStrategy { + force("io.opentelemetry:opentelemetry-api:1.15.0") + } + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts index fd89755d62b1..bbbb75e6da99 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts @@ -9,3 +9,11 @@ dependencies { implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent")) } + +configurations.configureEach { + if (name == "testRuntimeClasspath" || name == "testCompileClasspath") { + resolutionStrategy { + force("io.opentelemetry:opentelemetry-api:1.27.0") + } + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts index cad00243d6ae..eb7a3bf0a370 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.32/javaagent/build.gradle.kts @@ -14,6 +14,14 @@ dependencies { implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.31:javaagent")) } +configurations.configureEach { + if (name.endsWith("testRuntimeClasspath", true) || name.endsWith("testCompileClasspath", true)) { + resolutionStrategy { + force("io.opentelemetry:opentelemetry-api:1.32.0") + } + } +} + testing { suites { val incubatorTest by registering(JvmTestSuite::class) { diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts index 3b9ac093ff70..9973242b4298 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts @@ -15,6 +15,14 @@ dependencies { implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.32:javaagent")) } +configurations.configureEach { + if (name.endsWith("testRuntimeClasspath", true) || name.endsWith("testCompileClasspath", true)) { + resolutionStrategy { + force("io.opentelemetry:opentelemetry-api:1.37.0") + } + } +} + testing { suites { val incubatorTest by registering(JvmTestSuite::class) { diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.4/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.4/javaagent/build.gradle.kts index 357b795da7be..5861e77b22de 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.4/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.4/javaagent/build.gradle.kts @@ -6,3 +6,11 @@ dependencies { compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "shadow")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent")) } + +configurations.configureEach { + if (name == "testRuntimeClasspath" || name == "testCompileClasspath") { + resolutionStrategy { + force("io.opentelemetry:opentelemetry-api:1.4.0") + } + } +} From b62e08bdec278ad0bc32ba205f24ba09b62e3444 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Wed, 10 Apr 2024 14:22:12 +0200 Subject: [PATCH 3/4] add a test for old and new metrics incubator api (#11084) --- .../javaagent/build.gradle.kts | 6 + .../v1_37/incubator/metrics/MeterTest.java | 468 ++++++++++++++++++ 2 files changed, 474 insertions(+) create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/oldAndNewIncubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts index 9973242b4298..e0112dd55120 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/build.gradle.kts @@ -30,6 +30,12 @@ testing { implementation("io.opentelemetry:opentelemetry-api-incubator:1.37.0-alpha") } } + val oldAndNewIncubatorTest by registering(JvmTestSuite::class) { + dependencies { + implementation("io.opentelemetry:opentelemetry-api-incubator:1.37.0-alpha") + implementation("io.opentelemetry:opentelemetry-extension-incubator:1.32.0-alpha") + } + } } } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/oldAndNewIncubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/oldAndNewIncubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java new file mode 100644 index 000000000000..84cc8c400360 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/oldAndNewIncubatorTest/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/MeterTest.java @@ -0,0 +1,468 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics; + +import static io.opentelemetry.api.common.AttributeKey.stringKey; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static java.util.Collections.singletonList; +import static org.assertj.core.api.Assertions.assertThat; + +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.incubator.metrics.DoubleGauge; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleCounterBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleUpDownCounterBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongCounterBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder; +import io.opentelemetry.api.incubator.metrics.LongGauge; +import io.opentelemetry.api.metrics.DoubleCounter; +import io.opentelemetry.api.metrics.DoubleCounterBuilder; +import io.opentelemetry.api.metrics.DoubleGaugeBuilder; +import io.opentelemetry.api.metrics.DoubleHistogram; +import io.opentelemetry.api.metrics.DoubleHistogramBuilder; +import io.opentelemetry.api.metrics.DoubleUpDownCounter; +import io.opentelemetry.api.metrics.DoubleUpDownCounterBuilder; +import io.opentelemetry.api.metrics.LongCounter; +import io.opentelemetry.api.metrics.LongCounterBuilder; +import io.opentelemetry.api.metrics.LongGaugeBuilder; +import io.opentelemetry.api.metrics.LongHistogram; +import io.opentelemetry.api.metrics.LongHistogramBuilder; +import io.opentelemetry.api.metrics.LongUpDownCounter; +import io.opentelemetry.api.metrics.LongUpDownCounterBuilder; +import io.opentelemetry.api.metrics.Meter; +import io.opentelemetry.api.metrics.ObservableDoubleGauge; +import io.opentelemetry.api.metrics.ObservableLongGauge; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import org.assertj.core.api.AbstractIterableAssert; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.extension.RegisterExtension; + +class MeterTest { + + @RegisterExtension + static final AgentInstrumentationExtension testing = AgentInstrumentationExtension.create(); + + private String instrumentationName; + private Meter meter; + + @BeforeEach + void setupMeter(TestInfo test) { + instrumentationName = "test-" + test.getDisplayName(); + meter = + testing + .getOpenTelemetry() + .getMeterProvider() + .meterBuilder(instrumentationName) + .setInstrumentationVersion("1.2.3") + .setSchemaUrl("http://schema.org") + .build(); + } + + @Test + void longCounter() { + LongCounterBuilder builder = meter.counterBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongCounterBuilder.class); + ExtendedLongCounterBuilder extendedBuilder = (ExtendedLongCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongCounter instrument = builder.build(); + + instrument.add(5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongSumSatisfying( + sum -> + sum.isMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(11) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void doubleCounter() { + DoubleCounterBuilder builder = + meter.counterBuilder("test").ofDoubles().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleCounterBuilder.class); + ExtendedDoubleCounterBuilder extendedBuilder = (ExtendedDoubleCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleCounter instrument = builder.build(); + + instrument.add(5.5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6.6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleSumSatisfying( + sum -> + sum.isMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(12.1) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void longUpDownCounter() { + LongUpDownCounterBuilder builder = + meter.upDownCounterBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongUpDownCounterBuilder.class); + ExtendedLongUpDownCounterBuilder extendedBuilder = (ExtendedLongUpDownCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongUpDownCounter instrument = builder.build(); + + instrument.add(5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongSumSatisfying( + sum -> + sum.isNotMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(11) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void doubleUpDownCounter() { + DoubleUpDownCounterBuilder builder = + meter.upDownCounterBuilder("test").ofDoubles().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleUpDownCounterBuilder.class); + ExtendedDoubleUpDownCounterBuilder extendedBuilder = + (ExtendedDoubleUpDownCounterBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleUpDownCounter instrument = builder.build(); + + instrument.add(5.5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.add(6.6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleSumSatisfying( + sum -> + sum.isNotMonotonic() + .hasPointsSatisfying( + point -> + point + .hasValue(12.1) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void longHistogram() { + LongHistogramBuilder builder = + meter.histogramBuilder("test").ofLongs().setDescription("d").setUnit("u"); + builder.setExplicitBucketBoundariesAdvice(singletonList(10L)); + assertThat(builder).isInstanceOf(ExtendedLongHistogramBuilder.class); + ExtendedLongHistogramBuilder extendedBuilder = (ExtendedLongHistogramBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongHistogram instrument = builder.build(); + + instrument.record(5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.record(6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasHistogramSatisfying( + histogram -> + histogram.hasPointsSatisfying( + point -> + point + .hasSum(11.0) + .hasBucketBoundaries(10.0) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void doubleHistogram() { + DoubleHistogramBuilder builder = + meter.histogramBuilder("test").setDescription("d").setUnit("u"); + builder.setExplicitBucketBoundariesAdvice(singletonList(10.0)); + assertThat(builder).isInstanceOf(ExtendedDoubleHistogramBuilder.class); + ExtendedDoubleHistogramBuilder extendedBuilder = (ExtendedDoubleHistogramBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleHistogram instrument = builder.build(); + + instrument.record(5.5, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + instrument.record(6.6, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasHistogramSatisfying( + histogram -> + histogram.hasPointsSatisfying( + point -> + point + .hasSum(12.1) + .hasBucketBoundaries(10.0) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + } + + @Test + void longGauge() throws InterruptedException { + LongGaugeBuilder builder = + meter.gaugeBuilder("test").ofLongs().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongGaugeBuilder.class); + ExtendedLongGaugeBuilder extendedBuilder = (ExtendedLongGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + ObservableLongGauge observableGauge = + builder.buildWithCallback( + result -> + result.record(123, Attributes.of(stringKey("test"), "test", stringKey("q"), "r"))); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> + point + .hasValue(123) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + observableGauge.close(); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } + + @Test + void syncLongGauge() throws InterruptedException { + LongGaugeBuilder builder = + meter.gaugeBuilder("test").ofLongs().setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedLongGaugeBuilder.class); + ExtendedLongGaugeBuilder extendedBuilder = (ExtendedLongGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + LongGauge longGauge = extendedBuilder.build(); + longGauge.set(321); + longGauge.set(123, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasLongGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> point.hasValue(321).hasAttributes(Attributes.empty()), + point -> + point + .hasValue(123) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } + + @Test + void doubleGauge() throws InterruptedException { + DoubleGaugeBuilder builder = meter.gaugeBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleGaugeBuilder.class); + ExtendedDoubleGaugeBuilder extendedBuilder = (ExtendedDoubleGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + ObservableDoubleGauge observableGauge = + builder.buildWithCallback( + result -> + result.record(1.23, Attributes.of(stringKey("test"), "test", stringKey("q"), "r"))); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> + point + .hasValue(1.23) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + observableGauge.close(); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } + + @Test + void syncDoubleGauge() throws InterruptedException { + DoubleGaugeBuilder builder = meter.gaugeBuilder("test").setDescription("d").setUnit("u"); + assertThat(builder).isInstanceOf(ExtendedDoubleGaugeBuilder.class); + ExtendedDoubleGaugeBuilder extendedBuilder = (ExtendedDoubleGaugeBuilder) builder; + extendedBuilder.setAttributesAdvice(singletonList(stringKey("test"))); + + DoubleGauge doubleGauge = extendedBuilder.build(); + doubleGauge.set(3.21); + doubleGauge.set(1.23, Attributes.of(stringKey("test"), "test", stringKey("q"), "r")); + + testing.waitAndAssertMetrics( + instrumentationName, + "test", + metrics -> + metrics.anySatisfy( + metric -> + OpenTelemetryAssertions.assertThat(metric) + .hasDescription("d") + .hasUnit("u") + .hasInstrumentationScope( + InstrumentationScopeInfo.builder(instrumentationName) + .setVersion("1.2.3") + .build()) + .hasDoubleGaugeSatisfying( + gauge -> + gauge.hasPointsSatisfying( + point -> point.hasValue(3.21).hasAttributes(Attributes.empty()), + point -> + point + .hasValue(1.23) + .hasAttributesSatisfying( + equalTo(stringKey("test"), "test")))))); + + // sleep exporter interval + Thread.sleep(100); + testing.clearData(); + Thread.sleep(100); + + testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty); + } +} From 3e41a82392601300bdb61fb206e4f26c28e45410 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Fri, 12 Apr 2024 13:45:59 +0300 Subject: [PATCH 4/4] fix imports --- .../api/instrumenter/http/HttpMetricsAdvice.java | 6 +++--- .../api/instrumenter/http/HttpMetricsUtil.java | 6 +----- .../api/instrumenter/rpc/RpcMetricsAdvice.java | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsAdvice.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsAdvice.java index 90721e1550a4..2560be9a0e8b 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsAdvice.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsAdvice.java @@ -7,12 +7,12 @@ import static java.util.Arrays.asList; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder; +import io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder; import io.opentelemetry.api.metrics.DoubleHistogramBuilder; import io.opentelemetry.api.metrics.LongHistogramBuilder; import io.opentelemetry.api.metrics.LongUpDownCounterBuilder; -import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder; -import io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder; -import io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder; import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes; import io.opentelemetry.semconv.SemanticAttributes; diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsUtil.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsUtil.java index 8960e1e67fd4..e1eeba5a2ea0 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsUtil.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpMetricsUtil.java @@ -10,7 +10,6 @@ import io.opentelemetry.api.metrics.DoubleHistogramBuilder; import io.opentelemetry.api.metrics.Meter; -import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder; import java.util.List; final class HttpMetricsUtil { @@ -24,10 +23,7 @@ static DoubleHistogramBuilder createStableDurationHistogramBuilder( DoubleHistogramBuilder durationBuilder = meter.histogramBuilder(name).setUnit("s").setDescription(description); // don't set custom buckets if milliseconds are still used - if (durationBuilder instanceof ExtendedDoubleHistogramBuilder) { - ((ExtendedDoubleHistogramBuilder) durationBuilder) - .setExplicitBucketBoundariesAdvice(DURATION_SECONDS_BUCKETS); - } + durationBuilder.setExplicitBucketBoundariesAdvice(DURATION_SECONDS_BUCKETS); return durationBuilder; } diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcMetricsAdvice.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcMetricsAdvice.java index 9db1771fe8b4..1f959aa17eca 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcMetricsAdvice.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcMetricsAdvice.java @@ -6,8 +6,8 @@ package io.opentelemetry.instrumentation.api.instrumenter.rpc; import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder; import io.opentelemetry.api.metrics.DoubleHistogramBuilder; -import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder; import io.opentelemetry.instrumentation.api.internal.SemconvStability; import io.opentelemetry.semconv.SemanticAttributes; import java.util.ArrayList;