Update to OTel 1.13 (#5799)
* Update to OTel 1.13 * Fix test * Foo * Fix app server test and start yak shaving * Yak * Yak * groovy fail * Yak * GROOVY * yak farm
This commit is contained in:
parent
ecfa983658
commit
e58d39d4ad
|
|
@ -11,7 +11,7 @@ data class DependencySet(val group: String, val version: String, val modules: Li
|
|||
val dependencyVersions = hashMapOf<String, String>()
|
||||
rootProject.extra["versions"] = dependencyVersions
|
||||
|
||||
val otelVersion = "1.12.0"
|
||||
val otelVersion = "1.13.0"
|
||||
rootProject.extra["otelVersion"] = otelVersion
|
||||
|
||||
// Need both BOM and groovy jars
|
||||
|
|
@ -99,7 +99,7 @@ val DEPENDENCIES = listOf(
|
|||
"commons-logging:commons-logging:1.2",
|
||||
"commons-validator:commons-validator:1.7",
|
||||
"io.netty:netty:3.10.6.Final",
|
||||
"io.opentelemetry.proto:opentelemetry-proto:0.11.0-alpha",
|
||||
"io.opentelemetry.proto:opentelemetry-proto:0.16.0-alpha",
|
||||
"org.assertj:assertj-core:3.22.0",
|
||||
"org.awaitility:awaitility:4.2.0",
|
||||
"com.google.code.findbugs:annotations:3.0.1u2",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ dependencies {
|
|||
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.11.2")
|
||||
testImplementation("com.google.protobuf:protobuf-java-util:3.12.4")
|
||||
testImplementation("com.squareup.okhttp3:okhttp:3.12.12")
|
||||
testImplementation("io.opentelemetry:opentelemetry-proto:1.6.0-alpha")
|
||||
testImplementation("io.opentelemetry.proto:opentelemetry-proto:0.16.0-alpha")
|
||||
testImplementation("io.opentelemetry:opentelemetry-api:1.6.0")
|
||||
|
||||
testImplementation("ch.qos.logback:logback-classic:1.2.3")
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ abstract class SmokeTest {
|
|||
static void setupSpec() {
|
||||
backend =
|
||||
new GenericContainer<>(
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20210918.1248928123")
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20220411.2147767274")
|
||||
.withExposedPorts(8080)
|
||||
.waitingFor(Wait.forHttp("/health").forPort(8080))
|
||||
.withNetwork(network)
|
||||
|
|
@ -137,7 +137,7 @@ abstract class SmokeTest {
|
|||
protected static Stream<Span> getSpanStream(Collection<ExportTraceServiceRequest> traces) {
|
||||
return traces.stream()
|
||||
.flatMap(it -> it.getResourceSpansList().stream())
|
||||
.flatMap(it -> it.getInstrumentationLibrarySpansList().stream())
|
||||
.flatMap(it -> it.getScopeSpansList().stream())
|
||||
.flatMap(it -> it.getSpansList().stream());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ dependencies {
|
|||
testImplementation("com.google.protobuf:protobuf-java-util:3.12.4")
|
||||
testImplementation("com.squareup.okhttp3:okhttp:3.12.12")
|
||||
testImplementation("io.opentelemetry:opentelemetry-api:${versions.opentelemetry}")
|
||||
testImplementation("io.opentelemetry.proto:opentelemetry-proto:0.11.0-alpha")
|
||||
testImplementation("io.opentelemetry.proto:opentelemetry-proto:0.16.0-alpha")
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2")
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ abstract class IntegrationTest {
|
|||
static void setupSpec() {
|
||||
backend =
|
||||
new GenericContainer<>(
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20210918.1248928123")
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20220411.2147767274")
|
||||
.withExposedPorts(8080)
|
||||
.waitingFor(Wait.forHttp("/health").forPort(8080))
|
||||
.withNetwork(network)
|
||||
|
|
@ -164,7 +164,7 @@ abstract class IntegrationTest {
|
|||
protected static Stream<Span> getSpanStream(Collection<ExportTraceServiceRequest> traces) {
|
||||
return traces.stream()
|
||||
.flatMap(it -> it.getResourceSpansList().stream())
|
||||
.flatMap(it -> it.getInstrumentationLibrarySpansList().stream())
|
||||
.flatMap(it -> it.getScopeSpansList().stream())
|
||||
.flatMap(it -> it.getSpansList().stream());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import io.opentelemetry.context.Context;
|
|||
import io.opentelemetry.instrumentation.api.instrumenter.RequestListener;
|
||||
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
||||
import io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
@ -27,10 +26,7 @@ class HttpClientMetricsTest {
|
|||
void collectsMetrics() {
|
||||
InMemoryMetricReader metricReader = InMemoryMetricReader.create();
|
||||
SdkMeterProvider meterProvider =
|
||||
SdkMeterProvider.builder()
|
||||
.registerMetricReader(metricReader)
|
||||
.setMinimumCollectionInterval(Duration.ZERO)
|
||||
.build();
|
||||
SdkMeterProvider.builder().registerMetricReader(metricReader).build();
|
||||
|
||||
RequestListener listener = HttpClientMetrics.get().create(meterProvider.get("test"));
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import io.opentelemetry.context.Context;
|
|||
import io.opentelemetry.instrumentation.api.instrumenter.RequestListener;
|
||||
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
||||
import io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
@ -27,10 +26,7 @@ class HttpServerMetricsTest {
|
|||
void collectsMetrics() {
|
||||
InMemoryMetricReader metricReader = InMemoryMetricReader.create();
|
||||
SdkMeterProvider meterProvider =
|
||||
SdkMeterProvider.builder()
|
||||
.registerMetricReader(metricReader)
|
||||
.setMinimumCollectionInterval(Duration.ZERO)
|
||||
.build();
|
||||
SdkMeterProvider.builder().registerMetricReader(metricReader).build();
|
||||
|
||||
RequestListener listener = HttpServerMetrics.get().create(meterProvider.get("test"));
|
||||
|
||||
|
|
@ -161,10 +157,7 @@ class HttpServerMetricsTest {
|
|||
// given
|
||||
InMemoryMetricReader metricReader = InMemoryMetricReader.create();
|
||||
SdkMeterProvider meterProvider =
|
||||
SdkMeterProvider.builder()
|
||||
.registerMetricReader(metricReader)
|
||||
.setMinimumCollectionInterval(Duration.ZERO)
|
||||
.build();
|
||||
SdkMeterProvider.builder().registerMetricReader(metricReader).build();
|
||||
|
||||
RequestListener listener = HttpServerMetrics.get().create(meterProvider.get("test"));
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.RequestListener;
|
|||
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
||||
import io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader;
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
@ -28,10 +27,7 @@ class RpcClientMetricsTest {
|
|||
void collectsMetrics() {
|
||||
InMemoryMetricReader metricReader = InMemoryMetricReader.createDelta();
|
||||
SdkMeterProvider meterProvider =
|
||||
SdkMeterProvider.builder()
|
||||
.registerMetricReader(metricReader)
|
||||
.setMinimumCollectionInterval(Duration.ZERO)
|
||||
.build();
|
||||
SdkMeterProvider.builder().registerMetricReader(metricReader).build();
|
||||
|
||||
RequestListener listener = RpcClientMetrics.get().create(meterProvider.get("test"));
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.RequestListener;
|
|||
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
||||
import io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader;
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
@ -28,10 +27,7 @@ class RpcServerMetricsTest {
|
|||
void collectsMetrics() {
|
||||
InMemoryMetricReader metricReader = InMemoryMetricReader.createDelta();
|
||||
SdkMeterProvider meterProvider =
|
||||
SdkMeterProvider.builder()
|
||||
.registerMetricReader(metricReader)
|
||||
.setMinimumCollectionInterval(Duration.ZERO)
|
||||
.build();
|
||||
SdkMeterProvider.builder().registerMetricReader(metricReader).build();
|
||||
|
||||
RequestListener listener = RpcServerMetrics.get().create(meterProvider.get("test"));
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import io.opentelemetry.context.ContextKey;
|
|||
import io.opentelemetry.context.propagation.TextMapGetter;
|
||||
import io.opentelemetry.instrumentation.api.internal.SpanKey;
|
||||
import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
import io.opentelemetry.sdk.trace.data.StatusData;
|
||||
|
|
@ -195,8 +195,7 @@ class InstrumenterTest {
|
|||
span ->
|
||||
span.hasName("span")
|
||||
.hasKind(SpanKind.SERVER)
|
||||
.hasInstrumentationLibraryInfo(
|
||||
InstrumentationLibraryInfo.create("test", null))
|
||||
.hasInstrumentationScopeInfo(InstrumentationScopeInfo.create("test"))
|
||||
.hasTraceId(spanContext.getTraceId())
|
||||
.hasSpanId(spanContext.getSpanId())
|
||||
.hasParentSpanId(SpanId.getInvalid())
|
||||
|
|
@ -305,8 +304,7 @@ class InstrumenterTest {
|
|||
span ->
|
||||
span.hasName("span")
|
||||
.hasKind(SpanKind.CLIENT)
|
||||
.hasInstrumentationLibraryInfo(
|
||||
InstrumentationLibraryInfo.create("test", null))
|
||||
.hasInstrumentationScopeInfo(InstrumentationScopeInfo.create("test"))
|
||||
.hasTraceId(spanContext.getTraceId())
|
||||
.hasSpanId(spanContext.getSpanId())
|
||||
.hasParentSpanId(SpanId.getInvalid())
|
||||
|
|
@ -735,16 +733,15 @@ class InstrumenterTest {
|
|||
instrumenter.end(context, Collections.emptyMap(), Collections.emptyMap(), null);
|
||||
|
||||
// see the test-instrumentation.properties file
|
||||
InstrumentationLibraryInfo expectedLibraryInfo =
|
||||
InstrumentationLibraryInfo.create("test-instrumentation", "1.2.3");
|
||||
InstrumentationScopeInfo expectedLibraryInfo =
|
||||
InstrumentationScopeInfo.create("test-instrumentation", "1.2.3", /* schemaUrl= */ null);
|
||||
|
||||
otelTesting
|
||||
.assertTraces()
|
||||
.hasTracesSatisfyingExactly(
|
||||
trace ->
|
||||
trace.hasSpansSatisfyingExactly(
|
||||
span ->
|
||||
span.hasName("span").hasInstrumentationLibraryInfo(expectedLibraryInfo)));
|
||||
span -> span.hasName("span").hasInstrumentationScopeInfo(expectedLibraryInfo)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -767,8 +764,9 @@ class InstrumenterTest {
|
|||
trace.hasSpansSatisfyingExactly(
|
||||
span ->
|
||||
span.hasName("span")
|
||||
.hasInstrumentationLibraryInfo(
|
||||
InstrumentationLibraryInfo.create("test", "1.0"))));
|
||||
.hasInstrumentationScopeInfo(
|
||||
InstrumentationScopeInfo.create(
|
||||
"test", "1.0", /* schemaUrl= */ null))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -784,15 +782,14 @@ class InstrumenterTest {
|
|||
|
||||
instrumenter.end(context, Collections.emptyMap(), Collections.emptyMap(), null);
|
||||
|
||||
InstrumentationLibraryInfo expectedLibraryInfo =
|
||||
InstrumentationLibraryInfo.create("test", null, "https://opentelemetry.io/schemas/1.0.0");
|
||||
InstrumentationScopeInfo expectedLibraryInfo =
|
||||
InstrumentationScopeInfo.create("test", null, "https://opentelemetry.io/schemas/1.0.0");
|
||||
otelTesting
|
||||
.assertTraces()
|
||||
.hasTracesSatisfyingExactly(
|
||||
trace ->
|
||||
trace.hasSpansSatisfyingExactly(
|
||||
span ->
|
||||
span.hasName("span").hasInstrumentationLibraryInfo(expectedLibraryInfo)));
|
||||
span -> span.hasName("span").hasInstrumentationScopeInfo(expectedLibraryInfo)));
|
||||
}
|
||||
|
||||
private static void validateInstrumentationTypeSpanPresent(SpanKey spanKey, Context context) {
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@ public interface LogBuilder {
|
|||
/** Set the severity text. */
|
||||
LogBuilder setSeverityText(String severityText);
|
||||
|
||||
/** Set the name. */
|
||||
LogBuilder setName(String name);
|
||||
|
||||
/** Set the body string. */
|
||||
LogBuilder setBody(String body);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,6 @@ final class NoopLogBuilder implements LogBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogBuilder setName(String name) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogBuilder setBody(String body) {
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -50,12 +50,6 @@ final class DelegatingLogBuilder implements LogBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogBuilder setName(String name) {
|
||||
delegate.setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogBuilder setBody(String body) {
|
||||
delegate.setBody(body);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class JavaUtilLoggingTest extends AgentInstrumentationSpecification {
|
|||
} else {
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz")
|
||||
}
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(severity)
|
||||
assertThat(log.getSeverityText()).isEqualTo(severityText)
|
||||
if (testArgs == "exception") {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class JbossLogmanagerTest extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(severity)
|
||||
assertThat(log.getSeverityText()).isEqualTo(severityText)
|
||||
if (exception) {
|
||||
|
|
@ -117,7 +117,7 @@ class JbossLogmanagerTest extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(Severity.INFO)
|
||||
assertThat(log.getSeverityText()).isEqualTo("INFO")
|
||||
assertThat(log.getAttributes().size()).isEqualTo(4)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Log4j1Test extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(severity)
|
||||
assertThat(log.getSeverityText()).isEqualTo(severityText)
|
||||
if (exception) {
|
||||
|
|
@ -113,7 +113,7 @@ class Log4j1Test extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(Severity.INFO)
|
||||
assertThat(log.getSeverityText()).isEqualTo("INFO")
|
||||
assertThat(log.getAttributes().size()).isEqualTo(4)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Log4j2Test extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz: 123")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(severity)
|
||||
assertThat(log.getSeverityText()).isEqualTo(severityText)
|
||||
if (exception) {
|
||||
|
|
@ -115,7 +115,7 @@ class Log4j2Test extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz: 123")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(Severity.INFO)
|
||||
assertThat(log.getSeverityText()).isEqualTo("INFO")
|
||||
assertThat(log.getAttributes().size()).isEqualTo(4)
|
||||
|
|
@ -141,7 +141,7 @@ class Log4j2Test extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEmpty()
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(Severity.INFO)
|
||||
assertThat(log.getSeverityText()).isEqualTo("INFO")
|
||||
assertThat(log.getAttributes().size()).isEqualTo(4)
|
||||
|
|
@ -167,7 +167,7 @@ class Log4j2Test extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("val2")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(Severity.INFO)
|
||||
assertThat(log.getSeverityText()).isEqualTo("INFO")
|
||||
assertThat(log.getAttributes().size()).isEqualTo(3)
|
||||
|
|
@ -192,7 +192,7 @@ class Log4j2Test extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("a message")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(Severity.INFO)
|
||||
assertThat(log.getSeverityText()).isEqualTo("INFO")
|
||||
assertThat(log.getAttributes().size()).isEqualTo(4)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import io.opentelemetry.api.common.Attributes;
|
|||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
|
||||
import io.opentelemetry.sdk.logs.SdkLogEmitterProvider;
|
||||
import io.opentelemetry.sdk.logs.data.LogData;
|
||||
import io.opentelemetry.sdk.logs.data.Severity;
|
||||
|
|
@ -39,13 +39,13 @@ class OpenTelemetryAppenderConfigTest {
|
|||
|
||||
private static InMemoryLogExporter logExporter;
|
||||
private static Resource resource;
|
||||
private static InstrumentationLibraryInfo instrumentationLibraryInfo;
|
||||
private static InstrumentationScopeInfo instrumentationScopeInfo;
|
||||
|
||||
@BeforeAll
|
||||
static void setupAll() {
|
||||
logExporter = InMemoryLogExporter.create();
|
||||
resource = Resource.getDefault();
|
||||
instrumentationLibraryInfo = InstrumentationLibraryInfo.create("TestLogger", null);
|
||||
instrumentationScopeInfo = InstrumentationScopeInfo.create("TestLogger");
|
||||
|
||||
SdkLogEmitterProvider logEmitterProvider =
|
||||
SdkLogEmitterProvider.builder()
|
||||
|
|
@ -71,7 +71,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("log message 1");
|
||||
assertThat(logData.getAttributes()).isEqualTo(Attributes.empty());
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("log message 1");
|
||||
assertThat(logData.getEpochNanos())
|
||||
.isGreaterThanOrEqualTo(TimeUnit.MILLISECONDS.toNanos(start.toEpochMilli()))
|
||||
|
|
@ -140,7 +140,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("log message 1");
|
||||
assertThat(logData.getAttributes().size()).isEqualTo(2);
|
||||
assertThat(logData.getAttributes().get(AttributeKey.stringKey("log4j.context_data.key1")))
|
||||
|
|
@ -160,7 +160,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEmpty();
|
||||
assertThat(logData.getAttributes().size()).isEqualTo(2);
|
||||
assertThat(logData.getAttributes().get(AttributeKey.stringKey("key1"))).isEqualTo("val1");
|
||||
|
|
@ -178,7 +178,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("val2");
|
||||
assertThat(logData.getAttributes().size()).isEqualTo(1);
|
||||
assertThat(logData.getAttributes().get(AttributeKey.stringKey("key1"))).isEqualTo("val1");
|
||||
|
|
@ -195,7 +195,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("a message");
|
||||
assertThat(logData.getAttributes().size()).isEqualTo(2);
|
||||
assertThat(logData.getAttributes().get(AttributeKey.stringKey("key1"))).isEqualTo("val1");
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class LogbackTest extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz: 123")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo(loggerName)
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo(loggerName)
|
||||
assertThat(log.getSeverity()).isEqualTo(severity)
|
||||
assertThat(log.getSeverityText()).isEqualTo(severityText)
|
||||
if (exception) {
|
||||
|
|
@ -120,7 +120,7 @@ class LogbackTest extends AgentInstrumentationSpecification {
|
|||
})
|
||||
def log = logs.get(0)
|
||||
assertThat(log.getBody().asString()).isEqualTo("xyz: 123")
|
||||
assertThat(log.getInstrumentationLibraryInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getInstrumentationScopeInfo().getName()).isEqualTo("abc")
|
||||
assertThat(log.getSeverity()).isEqualTo(Severity.INFO)
|
||||
assertThat(log.getSeverityText()).isEqualTo("INFO")
|
||||
assertThat(log.getAttributes().size()).isEqualTo(4)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import io.opentelemetry.api.common.Attributes;
|
|||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
|
||||
import io.opentelemetry.sdk.logs.SdkLogEmitterProvider;
|
||||
import io.opentelemetry.sdk.logs.data.LogData;
|
||||
import io.opentelemetry.sdk.logs.data.Severity;
|
||||
|
|
@ -38,13 +38,13 @@ class OpenTelemetryAppenderConfigTest {
|
|||
|
||||
private static InMemoryLogExporter logExporter;
|
||||
private static Resource resource;
|
||||
private static InstrumentationLibraryInfo instrumentationLibraryInfo;
|
||||
private static InstrumentationScopeInfo instrumentationScopeInfo;
|
||||
|
||||
@BeforeAll
|
||||
static void setupAll() {
|
||||
logExporter = InMemoryLogExporter.create();
|
||||
resource = Resource.getDefault();
|
||||
instrumentationLibraryInfo = InstrumentationLibraryInfo.create("TestLogger", null);
|
||||
instrumentationScopeInfo = InstrumentationScopeInfo.create("TestLogger");
|
||||
|
||||
SdkLogEmitterProvider logEmitterProvider =
|
||||
SdkLogEmitterProvider.builder()
|
||||
|
|
@ -69,7 +69,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("log message 1");
|
||||
assertThat(logData.getAttributes()).isEqualTo(Attributes.empty());
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("log message 1");
|
||||
assertThat(logData.getEpochNanos())
|
||||
.isGreaterThan(TimeUnit.MILLISECONDS.toNanos(start.toEpochMilli()))
|
||||
|
|
@ -138,7 +138,7 @@ class OpenTelemetryAppenderConfigTest {
|
|||
assertThat(logDataList).hasSize(1);
|
||||
LogData logData = logDataList.get(0);
|
||||
assertThat(logData.getResource()).isEqualTo(resource);
|
||||
assertThat(logData.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
assertThat(logData.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
|
||||
assertThat(logData.getBody().asString()).isEqualTo("log message 1");
|
||||
assertThat(logData.getAttributes().size()).isEqualTo(2);
|
||||
AssertionsForClassTypes.assertThat(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import io.opentelemetry.api.metrics.LongHistogram;
|
|||
import io.opentelemetry.api.metrics.LongUpDownCounter;
|
||||
import io.opentelemetry.api.metrics.Meter;
|
||||
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -62,8 +62,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasLongSum()
|
||||
.isMonotonic()
|
||||
.points()
|
||||
|
|
@ -92,8 +93,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasLongSum()
|
||||
.isNotMonotonic()
|
||||
.points()
|
||||
|
|
@ -122,8 +124,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasDoubleSum()
|
||||
.isMonotonic()
|
||||
.points()
|
||||
|
|
@ -152,8 +155,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasDoubleSum()
|
||||
.isNotMonotonic()
|
||||
.points()
|
||||
|
|
@ -182,8 +186,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasDoubleHistogram()
|
||||
.points()
|
||||
.allSatisfy(
|
||||
|
|
@ -212,8 +217,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasDoubleHistogram()
|
||||
.points()
|
||||
.allSatisfy(
|
||||
|
|
@ -244,8 +250,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasLongGauge()
|
||||
.points()
|
||||
.satisfiesExactly(
|
||||
|
|
@ -274,8 +281,9 @@ class MeterTest {
|
|||
assertThat(metric)
|
||||
.hasDescription("d")
|
||||
.hasUnit("u")
|
||||
.hasInstrumentationLibrary(
|
||||
InstrumentationLibraryInfo.create(instrumentationName, "1.2.3"))
|
||||
.hasInstrumentationScope(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationName, "1.2.3", /* schemaUrl= */ null))
|
||||
.hasDoubleGauge()
|
||||
.points()
|
||||
.satisfiesExactly(
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import io.opentelemetry.proto.collector.trace.v1.TraceServiceGrpc
|
|||
import spock.lang.IgnoreIf
|
||||
import spock.lang.Unroll
|
||||
|
||||
import java.time.Duration
|
||||
import java.util.jar.Attributes
|
||||
import java.util.jar.JarFile
|
||||
|
||||
|
|
@ -25,6 +26,11 @@ class GrpcSmokeTest extends SmokeTest {
|
|||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-grpc:jdk$jdk-20211213.1570880329"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Server started.*")
|
||||
}
|
||||
|
||||
@Unroll
|
||||
def "grpc smoke test on JDK #jdk"(int jdk) {
|
||||
setup:
|
||||
|
|
|
|||
|
|
@ -6,12 +6,7 @@
|
|||
package io.opentelemetry.smoketest
|
||||
|
||||
// jetty test with java module system
|
||||
abstract class JettyJpmsSmokeTest extends AppServerTest {
|
||||
|
||||
@Override
|
||||
protected String getTargetImagePrefix() {
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-jetty"
|
||||
}
|
||||
abstract class JettyJpmsSmokeTest extends JettySmokeTest {
|
||||
|
||||
@Override
|
||||
protected String[] getCommand() {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,18 @@
|
|||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import java.time.Duration
|
||||
|
||||
abstract class JettySmokeTest extends AppServerTest {
|
||||
|
||||
protected String getTargetImagePrefix() {
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-jetty"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Started Server.*")
|
||||
}
|
||||
}
|
||||
|
||||
@AppServer(version = "9.4.39", jdk = "8")
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ class LogsSmokeTest extends SmokeTest {
|
|||
|
||||
def logRecords = logs.stream()
|
||||
.flatMap(log -> log.getResourceLogsList().stream())
|
||||
.flatMap(log -> log.getInstrumentationLibraryLogsList().stream())
|
||||
.flatMap(log -> log.getLogsList().stream())
|
||||
.flatMap(log -> log.getScopeLogsList().stream())
|
||||
.flatMap(log -> log.getLogRecordsList().stream())
|
||||
.collect(toList())
|
||||
logRecords.size() >= logs.size()
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class MetricsInspector {
|
|||
boolean hasMetricsNamed(String metricName) {
|
||||
requests.stream()
|
||||
.flatMap({ it.resourceMetricsList.stream() })
|
||||
.flatMap({ it.instrumentationLibraryMetricsList.stream() })
|
||||
.flatMap({ it.scopeMetricsList.stream() })
|
||||
.flatMap({ it.metricsList.stream() })
|
||||
.anyMatch({ it.name == metricName })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ package io.opentelemetry.smoketest
|
|||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
||||
import spock.lang.IgnoreIf
|
||||
|
||||
import java.time.Duration
|
||||
|
||||
import static io.opentelemetry.smoketest.TestContainerManager.useWindowsContainers
|
||||
|
||||
@IgnoreIf({ useWindowsContainers() })
|
||||
|
|
@ -17,6 +19,11 @@ class PlaySmokeTest extends SmokeTest {
|
|||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-play:jdk$jdk-20210917.1246460868"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Listening for HTTP.*")
|
||||
}
|
||||
|
||||
def "play smoke test on JDK #jdk"(int jdk) {
|
||||
setup:
|
||||
startTarget(jdk)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import io.opentelemetry.api.trace.TraceId
|
|||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
||||
import spock.lang.IgnoreIf
|
||||
|
||||
import java.time.Duration
|
||||
|
||||
import static io.opentelemetry.smoketest.TestContainerManager.useWindowsContainers
|
||||
import static java.util.stream.Collectors.toSet
|
||||
|
||||
|
|
@ -19,6 +21,11 @@ abstract class PropagationTest extends SmokeTest {
|
|||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk$jdk-20211213.1570880324"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Started SpringbootApplication in.*")
|
||||
}
|
||||
|
||||
def "Should propagate test"() {
|
||||
setup:
|
||||
startTarget(11)
|
||||
|
|
@ -86,6 +93,11 @@ class OtTracePropagationTest extends SmokeTest {
|
|||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk$jdk-20211213.1570880324"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Started SpringbootApplication in.*")
|
||||
}
|
||||
|
||||
// OtTracer only propagates lower half of trace ID so we have to mangle the trace IDs similar to
|
||||
// the Lightstep backend.
|
||||
def "Should propagate test"() {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
|||
import spock.lang.IgnoreIf
|
||||
import spock.lang.Unroll
|
||||
|
||||
import java.time.Duration
|
||||
import java.util.jar.Attributes
|
||||
import java.util.jar.JarFile
|
||||
|
||||
|
|
@ -22,6 +23,11 @@ class QuarkusSmokeTest extends SmokeTest {
|
|||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-quarkus:jdk$jdk-20211213.1574595137"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Listening on.*")
|
||||
}
|
||||
|
||||
@Unroll
|
||||
def "quarkus smoke test on JDK #jdk"(int jdk) {
|
||||
setup:
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ abstract class SmokeTest extends Specification {
|
|||
protected static Stream<Span> getSpanStream(Collection<ExportTraceServiceRequest> traces) {
|
||||
return traces.stream()
|
||||
.flatMap { it.getResourceSpansList().stream() }
|
||||
.flatMap { it.getInstrumentationLibrarySpansList().stream() }
|
||||
.flatMap { it.getScopeSpansList().stream() }
|
||||
.flatMap { it.getSpansList().stream() }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ package io.opentelemetry.smoketest
|
|||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
||||
import spock.lang.IgnoreIf
|
||||
|
||||
import java.time.Duration
|
||||
|
||||
import static io.opentelemetry.smoketest.TestContainerManager.useWindowsContainers
|
||||
|
||||
@IgnoreIf({ useWindowsContainers() })
|
||||
|
|
@ -21,6 +23,11 @@ class SpringBootWithSamplingSmokeTest extends SmokeTest {
|
|||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk$jdk-20211213.1570880324"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Started SpringbootApplication in.*")
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getExtraEnv() {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -5,11 +5,18 @@
|
|||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import java.time.Duration
|
||||
|
||||
abstract class TomcatSmokeTest extends AppServerTest {
|
||||
|
||||
protected String getTargetImagePrefix() {
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-tomcat"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Server startup in.*")
|
||||
}
|
||||
}
|
||||
|
||||
@AppServer(version = "7.0.109", jdk = "8")
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class TraceInspector {
|
|||
public Stream<Span> getSpanStream() {
|
||||
return traces.stream()
|
||||
.flatMap(it -> it.getResourceSpansList().stream())
|
||||
.flatMap(it -> it.getInstrumentationLibrarySpansList().stream())
|
||||
.flatMap(it -> it.getScopeSpansList().stream())
|
||||
.flatMap(it -> it.getSpansList().stream());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,19 @@ package io.opentelemetry.smoketest
|
|||
import io.opentelemetry.proto.trace.v1.Span
|
||||
import spock.lang.Unroll
|
||||
|
||||
import java.time.Duration
|
||||
|
||||
abstract class WildflySmokeTest extends AppServerTest {
|
||||
|
||||
protected String getTargetImagePrefix() {
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-wildfly"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*started in.*")
|
||||
}
|
||||
|
||||
@Unroll
|
||||
def "JSP smoke test on WildFly"() {
|
||||
when:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class LinuxTestContainerManager extends AbstractTestContainerManager {
|
|||
backend =
|
||||
new GenericContainer<>(
|
||||
DockerImageName.parse(
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20210918.1248928123"))
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20220411.2147767274"))
|
||||
.withExposedPorts(BACKEND_PORT)
|
||||
.waitingFor(Wait.forHttp("/health").forPort(BACKEND_PORT))
|
||||
.withNetwork(network)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class WindowsTestContainerManager extends AbstractTestContainerManager {
|
|||
.getId();
|
||||
|
||||
String backendImageName =
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend-windows:20210918.1248928123";
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend-windows:20220411.2147767274";
|
||||
if (!imageExists(backendImageName)) {
|
||||
pullImage(backendImageName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public final class LibraryTestRunner extends InstrumentationTestRunner {
|
|||
.registerMetricReader(
|
||||
PeriodicMetricReader.builder(testMetricExporter)
|
||||
.setInterval(Duration.ofMillis(100))
|
||||
.newMetricReaderFactory())
|
||||
.build())
|
||||
.build())
|
||||
.setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance()))
|
||||
.buildAndRegisterGlobal();
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public abstract class InstrumentationExtension
|
|||
assertThat(metrics())
|
||||
.filteredOn(
|
||||
data ->
|
||||
data.getInstrumentationLibraryInfo()
|
||||
data.getInstrumentationScopeInfo()
|
||||
.getName()
|
||||
.equals(instrumentationName)
|
||||
&& data.getName().equals(metricName))));
|
||||
|
|
|
|||
|
|
@ -25,25 +25,25 @@ import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;
|
|||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
|
||||
import io.opentelemetry.proto.common.v1.AnyValue;
|
||||
import io.opentelemetry.proto.common.v1.ArrayValue;
|
||||
import io.opentelemetry.proto.common.v1.InstrumentationLibrary;
|
||||
import io.opentelemetry.proto.common.v1.InstrumentationScope;
|
||||
import io.opentelemetry.proto.common.v1.KeyValue;
|
||||
import io.opentelemetry.proto.logs.v1.InstrumentationLibraryLogs;
|
||||
import io.opentelemetry.proto.logs.v1.LogRecord;
|
||||
import io.opentelemetry.proto.logs.v1.ResourceLogs;
|
||||
import io.opentelemetry.proto.logs.v1.ScopeLogs;
|
||||
import io.opentelemetry.proto.logs.v1.SeverityNumber;
|
||||
import io.opentelemetry.proto.metrics.v1.HistogramDataPoint;
|
||||
import io.opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics;
|
||||
import io.opentelemetry.proto.metrics.v1.Metric;
|
||||
import io.opentelemetry.proto.metrics.v1.NumberDataPoint;
|
||||
import io.opentelemetry.proto.metrics.v1.ResourceMetrics;
|
||||
import io.opentelemetry.proto.metrics.v1.ScopeMetrics;
|
||||
import io.opentelemetry.proto.metrics.v1.Sum;
|
||||
import io.opentelemetry.proto.metrics.v1.SummaryDataPoint;
|
||||
import io.opentelemetry.proto.resource.v1.Resource;
|
||||
import io.opentelemetry.proto.trace.v1.InstrumentationLibrarySpans;
|
||||
import io.opentelemetry.proto.trace.v1.ResourceSpans;
|
||||
import io.opentelemetry.proto.trace.v1.ScopeSpans;
|
||||
import io.opentelemetry.proto.trace.v1.Span;
|
||||
import io.opentelemetry.proto.trace.v1.Status;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
|
||||
import io.opentelemetry.sdk.logs.data.LogData;
|
||||
import io.opentelemetry.sdk.logs.data.LogDataBuilder;
|
||||
import io.opentelemetry.sdk.logs.data.Severity;
|
||||
|
|
@ -53,14 +53,17 @@ import io.opentelemetry.sdk.metrics.data.HistogramPointData;
|
|||
import io.opentelemetry.sdk.metrics.data.LongPointData;
|
||||
import io.opentelemetry.sdk.metrics.data.MetricData;
|
||||
import io.opentelemetry.sdk.metrics.data.SummaryPointData;
|
||||
import io.opentelemetry.sdk.metrics.data.ValueAtPercentile;
|
||||
import io.opentelemetry.sdk.metrics.data.ValueAtQuantile;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableDoublePointData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableGaugeData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableHistogramData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableHistogramPointData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableLongPointData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableMetricData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableSumData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableSummaryData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableSummaryPointData;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableValueAtPercentile;
|
||||
import io.opentelemetry.sdk.metrics.internal.data.ImmutableValueAtQuantile;
|
||||
import io.opentelemetry.sdk.testing.trace.TestSpanData;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
|
|
@ -162,9 +165,8 @@ public final class AgentTestingExporterAccess {
|
|||
List<SpanData> spans = new ArrayList<>();
|
||||
for (ResourceSpans resourceSpans : allResourceSpans) {
|
||||
Resource resource = resourceSpans.getResource();
|
||||
for (InstrumentationLibrarySpans ilSpans :
|
||||
resourceSpans.getInstrumentationLibrarySpansList()) {
|
||||
InstrumentationLibrary instrumentationLibrary = ilSpans.getInstrumentationLibrary();
|
||||
for (ScopeSpans ilSpans : resourceSpans.getScopeSpansList()) {
|
||||
InstrumentationScope instrumentationScope = ilSpans.getScope();
|
||||
for (Span span : ilSpans.getSpansList()) {
|
||||
String traceId = bytesToHex(span.getTraceId().toByteArray());
|
||||
spans.add(
|
||||
|
|
@ -185,9 +187,11 @@ public final class AgentTestingExporterAccess {
|
|||
.setResource(
|
||||
io.opentelemetry.sdk.resources.Resource.create(
|
||||
fromProto(resource.getAttributesList())))
|
||||
.setInstrumentationLibraryInfo(
|
||||
InstrumentationLibraryInfo.create(
|
||||
instrumentationLibrary.getName(), instrumentationLibrary.getVersion()))
|
||||
.setInstrumentationScopeInfo(
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationScope.getName(),
|
||||
instrumentationScope.getVersion(),
|
||||
/* schemaUrl= */ null))
|
||||
.setName(span.getName())
|
||||
.setStartEpochNanos(span.getStartTimeUnixNano())
|
||||
.setEndEpochNanos(span.getEndTimeUnixNano())
|
||||
|
|
@ -255,17 +259,18 @@ public final class AgentTestingExporterAccess {
|
|||
List<MetricData> metrics = new ArrayList<>();
|
||||
for (ResourceMetrics resourceMetrics : allResourceMetrics) {
|
||||
Resource resource = resourceMetrics.getResource();
|
||||
for (InstrumentationLibraryMetrics ilMetrics :
|
||||
resourceMetrics.getInstrumentationLibraryMetricsList()) {
|
||||
InstrumentationLibrary instrumentationLibrary = ilMetrics.getInstrumentationLibrary();
|
||||
for (ScopeMetrics ilMetrics : resourceMetrics.getScopeMetricsList()) {
|
||||
InstrumentationScope instrumentationScope = ilMetrics.getScope();
|
||||
for (Metric metric : ilMetrics.getMetricsList()) {
|
||||
metrics.add(
|
||||
createMetricData(
|
||||
metric,
|
||||
io.opentelemetry.sdk.resources.Resource.create(
|
||||
fromProto(resource.getAttributesList())),
|
||||
InstrumentationLibraryInfo.create(
|
||||
instrumentationLibrary.getName(), instrumentationLibrary.getVersion())));
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationScope.getName(),
|
||||
instrumentationScope.getVersion(),
|
||||
/* schemaUrl= */ null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -296,16 +301,18 @@ public final class AgentTestingExporterAccess {
|
|||
List<LogData> logs = new ArrayList<>();
|
||||
for (ResourceLogs resourceLogs : allResourceLogs) {
|
||||
Resource resource = resourceLogs.getResource();
|
||||
for (InstrumentationLibraryLogs ilLogs : resourceLogs.getInstrumentationLibraryLogsList()) {
|
||||
InstrumentationLibrary instrumentationLibrary = ilLogs.getInstrumentationLibrary();
|
||||
for (LogRecord logRecord : ilLogs.getLogsList()) {
|
||||
for (ScopeLogs ilLogs : resourceLogs.getScopeLogsList()) {
|
||||
InstrumentationScope instrumentationScope = ilLogs.getScope();
|
||||
for (LogRecord logRecord : ilLogs.getLogRecordsList()) {
|
||||
logs.add(
|
||||
createLogData(
|
||||
logRecord,
|
||||
io.opentelemetry.sdk.resources.Resource.create(
|
||||
fromProto(resource.getAttributesList())),
|
||||
InstrumentationLibraryInfo.create(
|
||||
instrumentationLibrary.getName(), instrumentationLibrary.getVersion())));
|
||||
InstrumentationScopeInfo.create(
|
||||
instrumentationScope.getName(),
|
||||
instrumentationScope.getVersion(),
|
||||
/* schemaUrl= */ null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -315,13 +322,13 @@ public final class AgentTestingExporterAccess {
|
|||
private static MetricData createMetricData(
|
||||
Metric metric,
|
||||
io.opentelemetry.sdk.resources.Resource resource,
|
||||
InstrumentationLibraryInfo instrumentationLibraryInfo) {
|
||||
InstrumentationScopeInfo instrumentationScopeInfo) {
|
||||
switch (metric.getDataCase()) {
|
||||
case GAUGE:
|
||||
if (isDouble(metric.getGauge().getDataPointsList())) {
|
||||
return MetricData.createDoubleGauge(
|
||||
return ImmutableMetricData.createDoubleGauge(
|
||||
resource,
|
||||
instrumentationLibraryInfo,
|
||||
instrumentationScopeInfo,
|
||||
metric.getName(),
|
||||
metric.getDescription(),
|
||||
metric.getUnit(),
|
||||
|
|
@ -329,9 +336,9 @@ public final class AgentTestingExporterAccess {
|
|||
ImmutableGaugeData.create(
|
||||
getDoublePointDatas(metric.getGauge().getDataPointsList())));
|
||||
} else {
|
||||
return MetricData.createLongGauge(
|
||||
return ImmutableMetricData.createLongGauge(
|
||||
resource,
|
||||
instrumentationLibraryInfo,
|
||||
instrumentationScopeInfo,
|
||||
metric.getName(),
|
||||
metric.getDescription(),
|
||||
metric.getUnit(),
|
||||
|
|
@ -340,9 +347,9 @@ public final class AgentTestingExporterAccess {
|
|||
case SUM:
|
||||
if (isDouble(metric.getSum().getDataPointsList())) {
|
||||
Sum doubleSum = metric.getSum();
|
||||
return MetricData.createDoubleSum(
|
||||
return ImmutableMetricData.createDoubleSum(
|
||||
resource,
|
||||
instrumentationLibraryInfo,
|
||||
instrumentationScopeInfo,
|
||||
metric.getName(),
|
||||
metric.getDescription(),
|
||||
metric.getUnit(),
|
||||
|
|
@ -352,9 +359,9 @@ public final class AgentTestingExporterAccess {
|
|||
getDoublePointDatas(metric.getSum().getDataPointsList())));
|
||||
} else {
|
||||
Sum longSum = metric.getSum();
|
||||
return MetricData.createLongSum(
|
||||
return ImmutableMetricData.createLongSum(
|
||||
resource,
|
||||
instrumentationLibraryInfo,
|
||||
instrumentationScopeInfo,
|
||||
metric.getName(),
|
||||
metric.getDescription(),
|
||||
metric.getUnit(),
|
||||
|
|
@ -364,9 +371,9 @@ public final class AgentTestingExporterAccess {
|
|||
getLongPointDatas(metric.getSum().getDataPointsList())));
|
||||
}
|
||||
case HISTOGRAM:
|
||||
return MetricData.createDoubleHistogram(
|
||||
return ImmutableMetricData.createDoubleHistogram(
|
||||
resource,
|
||||
instrumentationLibraryInfo,
|
||||
instrumentationScopeInfo,
|
||||
metric.getName(),
|
||||
metric.getDescription(),
|
||||
metric.getUnit(),
|
||||
|
|
@ -374,9 +381,9 @@ public final class AgentTestingExporterAccess {
|
|||
getTemporality(metric.getHistogram().getAggregationTemporality()),
|
||||
getDoubleHistogramDataPoints(metric.getHistogram().getDataPointsList())));
|
||||
case SUMMARY:
|
||||
return MetricData.createDoubleSummary(
|
||||
return ImmutableMetricData.createDoubleSummary(
|
||||
resource,
|
||||
instrumentationLibraryInfo,
|
||||
instrumentationScopeInfo,
|
||||
metric.getName(),
|
||||
metric.getDescription(),
|
||||
metric.getUnit(),
|
||||
|
|
@ -390,8 +397,8 @@ public final class AgentTestingExporterAccess {
|
|||
private static LogData createLogData(
|
||||
LogRecord logRecord,
|
||||
io.opentelemetry.sdk.resources.Resource resource,
|
||||
InstrumentationLibraryInfo instrumentationLibraryInfo) {
|
||||
return LogDataBuilder.create(resource, instrumentationLibraryInfo)
|
||||
InstrumentationScopeInfo instrumentationScopeInfo) {
|
||||
return LogDataBuilder.create(resource, instrumentationScopeInfo)
|
||||
.setEpoch(logRecord.getTimeUnixNano(), TimeUnit.NANOSECONDS)
|
||||
.setSpanContext(
|
||||
SpanContext.create(
|
||||
|
|
@ -427,7 +434,7 @@ public final class AgentTestingExporterAccess {
|
|||
value = point.getAsDouble();
|
||||
break;
|
||||
}
|
||||
return DoublePointData.create(
|
||||
return ImmutableDoublePointData.create(
|
||||
point.getStartTimeUnixNano(),
|
||||
point.getTimeUnixNano(),
|
||||
fromProto(point.getAttributesList()),
|
||||
|
|
@ -450,7 +457,7 @@ public final class AgentTestingExporterAccess {
|
|||
value = (long) point.getAsDouble();
|
||||
break;
|
||||
}
|
||||
return LongPointData.create(
|
||||
return ImmutableLongPointData.create(
|
||||
point.getStartTimeUnixNano(),
|
||||
point.getTimeUnixNano(),
|
||||
fromProto(point.getAttributesList()),
|
||||
|
|
@ -469,6 +476,9 @@ public final class AgentTestingExporterAccess {
|
|||
point.getTimeUnixNano(),
|
||||
fromProto(point.getAttributesList()),
|
||||
point.getSum(),
|
||||
// TODO(anuraaga): Read min/max from proto with 0.17.0 release.
|
||||
/* min= */ null,
|
||||
/* max= */ null,
|
||||
point.getExplicitBoundsList(),
|
||||
point.getBucketCountsList()))
|
||||
.collect(toList());
|
||||
|
|
@ -489,9 +499,9 @@ public final class AgentTestingExporterAccess {
|
|||
.collect(toList());
|
||||
}
|
||||
|
||||
private static List<ValueAtPercentile> getValues(SummaryDataPoint point) {
|
||||
private static List<ValueAtQuantile> getValues(SummaryDataPoint point) {
|
||||
return point.getQuantileValuesList().stream()
|
||||
.map(v -> ImmutableValueAtPercentile.create(v.getQuantile(), v.getValue()))
|
||||
.map(v -> ImmutableValueAtQuantile.create(v.getQuantile(), v.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@ public class AgentTestingCustomizer implements AutoConfigurationCustomizerProvid
|
|||
meterProvider.registerMetricReader(
|
||||
PeriodicMetricReader.builder(AgentTestingExporterFactory.metricExporter)
|
||||
.setInterval(Duration.ofMillis(100))
|
||||
.newMetricReaderFactory()));
|
||||
.build()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ package io.opentelemetry.javaagent.testing.exporter;
|
|||
|
||||
import io.opentelemetry.exporter.internal.otlp.metrics.MetricsRequestMarshaler;
|
||||
import io.opentelemetry.sdk.common.CompletableResultCode;
|
||||
import io.opentelemetry.sdk.metrics.InstrumentType;
|
||||
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
|
||||
import io.opentelemetry.sdk.metrics.data.MetricData;
|
||||
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
@ -30,6 +32,11 @@ class OtlpInMemoryMetricExporter implements MetricExporter {
|
|||
collectedRequests.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AggregationTemporality getAggregationTemporality(InstrumentType instrumentType) {
|
||||
return AggregationTemporality.CUMULATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableResultCode export(Collection<MetricData> metrics) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
|
|
|
|||
Loading…
Reference in New Issue