Skip to content

Commit

Permalink
Merge branch 'open-telemetry:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-suhorukov authored Aug 1, 2024
2 parents c25f989 + f8c383c commit 22c6082
Show file tree
Hide file tree
Showing 27 changed files with 1,690 additions and 1,132 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Learn about membership in OpenTelemetry community:
# https://github.com/open-telemetry/community/blob/main/community-membership.md
# https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md
#
#
# Learn about CODEOWNERS file format:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Emeritus maintainers:
- [Tyler Benson](https://github.com/tylerbenson)

Learn more about roles in
the [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md).
the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md).

Thanks to all the people who already contributed!

Expand Down
4 changes: 2 additions & 2 deletions benchmark-overhead/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ repositories {
dependencies {
implementation(enforcedPlatform("org.junit:junit-bom:5.10.3"))

testImplementation("org.testcontainers:testcontainers:1.20.0")
testImplementation("org.testcontainers:postgresql:1.20.0")
testImplementation("org.testcontainers:testcontainers:1.20.1")
testImplementation("org.testcontainers:postgresql:1.20.1")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
Expand Down
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ val DEPENDENCY_BOMS = listOf(
"io.opentelemetry:opentelemetry-bom:${otelSdkVersion}",
"io.opentelemetry:opentelemetry-bom-alpha:${otelSdkAlphaVersion}",
"org.junit:junit-bom:5.10.3",
"org.testcontainers:testcontainers-bom:1.20.0",
"org.testcontainers:testcontainers-bom:1.20.1",
"org.spockframework:spock-bom:2.4-M4-groovy-4.0"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/distro/smoke-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
testImplementation("org.testcontainers:testcontainers:1.20.0")
testImplementation("org.testcontainers:testcontainers:1.20.1")
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.17.2")
testImplementation("com.google.protobuf:protobuf-java-util:3.25.4")
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
Expand Down
2 changes: 1 addition & 1 deletion examples/extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.15.0'

//All dependencies below are only for tests
testImplementation("org.testcontainers:testcontainers:1.20.0")
testImplementation("org.testcontainers:testcontainers:1.20.1")
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.17.2")
testImplementation("com.google.protobuf:protobuf-java-util:3.25.4")
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,32 @@ dependencies {
testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
}

otelJava {
// AHC uses Unsafe and so does not run on later java version
maxJavaVersionForTests.set(JavaVersion.VERSION_1_8)
val latestDepTest = findProperty("testLatestDeps") as Boolean
val testJavaVersion =
gradle.startParameter.projectProperties["testJavaVersion"]?.let(JavaVersion::toVersion)
?: JavaVersion.current()

if (!latestDepTest) {
otelJava {
// AHC uses Unsafe and so does not run on later java version
maxJavaVersionForTests.set(JavaVersion.VERSION_1_8)
}
}

tasks.withType<Test>().configureEach {
systemProperty("testLatestDeps", latestDepTest)
// async-http-client 3.0 requires java 11
// We are not using minJavaVersionSupported for latestDepTest because that way the instrumentation
// gets compiled with java 11 when running latestDepTest. This causes play-mvc-2.4 latest dep tests
// to fail because they require java 8 and instrumentation compiled with java 11 won't apply.
if (latestDepTest && testJavaVersion.isJava8) {
enabled = false
}
}

// async-http-client 2.0.0 does not work with Netty versions newer than this due to referencing an
// internal file.
if (!(findProperty("testLatestDeps") as Boolean)) {
if (!latestDepTest) {
configurations.configureEach {
if (!name.contains("muzzle")) {
resolutionStrategy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientResult;
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions;
import java.lang.reflect.Method;
import java.net.URI;
import java.time.Duration;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.asynchttpclient.AsyncCompletionHandler;
import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.DefaultAsyncHttpClientConfig;
import org.asynchttpclient.Dsl;
import org.asynchttpclient.Request;
import org.asynchttpclient.RequestBuilder;
Expand All @@ -31,11 +34,26 @@ class AsyncHttpClientTest extends AbstractHttpClientTest<Request> {
private static final int CONNECTION_TIMEOUT_MS = (int) CONNECTION_TIMEOUT.toMillis();

// request timeout is needed in addition to connect timeout on async-http-client versions 2.1.0+
private static final AsyncHttpClient client =
Dsl.asyncHttpClient(
Dsl.config()
.setConnectTimeout(CONNECTION_TIMEOUT_MS)
.setRequestTimeout(CONNECTION_TIMEOUT_MS));
private static final AsyncHttpClient client = Dsl.asyncHttpClient(configureTimeout(Dsl.config()));

private static DefaultAsyncHttpClientConfig.Builder configureTimeout(
DefaultAsyncHttpClientConfig.Builder builder) {
setTimeout(builder, "setConnectTimeout", CONNECTION_TIMEOUT_MS);
setTimeout(builder, "setRequestTimeout", CONNECTION_TIMEOUT_MS);
return builder;
}

private static void setTimeout(
DefaultAsyncHttpClientConfig.Builder builder, String methodName, int timeout) {
boolean testLatestDeps = Boolean.getBoolean("testLatestDeps");
try {
Method method =
builder.getClass().getMethod(methodName, testLatestDeps ? Duration.class : int.class);
method.invoke(builder, testLatestDeps ? Duration.ofMillis(timeout) : timeout);
} catch (Exception exception) {
throw new IllegalStateException("Failed to set timeout " + methodName, exception);
}
}

@Override
public Request buildRequest(String method, URI uri, Map<String, String> headers) {
Expand Down
Loading

0 comments on commit 22c6082

Please sign in to comment.