Rename (and split up) classloaders module (#2787)
* Rename classloaders module * Move under common internal dir * Add all internal modules to testing agent
This commit is contained in:
parent
cad3c761a6
commit
06832d84fc
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.javaclassloader;
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.classloader;
|
||||
|
||||
import static io.opentelemetry.javaagent.tooling.bytebuddy.matcher.AgentElementMatchers.extendsClass;
|
||||
import static io.opentelemetry.javaagent.tooling.bytebuddy.matcher.NameMatchers.namedNoneOf;
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.javaclassloader;
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.classloader;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||
@AutoService(InstrumentationModule.class)
|
||||
public class ClassLoaderInstrumentationModule extends InstrumentationModule {
|
||||
public ClassLoaderInstrumentationModule() {
|
||||
super("classloader");
|
||||
super("internal-class-loader");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,10 +25,6 @@ public class ClassLoaderInstrumentationModule extends InstrumentationModule {
|
|||
|
||||
@Override
|
||||
public List<TypeInstrumentation> typeInstrumentations() {
|
||||
return asList(
|
||||
new ClassLoaderInstrumentation(),
|
||||
new UrlClassLoaderInstrumentation(),
|
||||
new ProxyInstrumentation(),
|
||||
new ResourceInjectionInstrumentation());
|
||||
return asList(new ClassLoaderInstrumentation(), new ResourceInjectionInstrumentation());
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.javaclassloader;
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.classloader;
|
||||
|
||||
import static io.opentelemetry.javaagent.tooling.bytebuddy.matcher.AgentElementMatchers.extendsClass;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
|
@ -1,6 +1,6 @@
|
|||
apply from: "$rootDir/gradle/java.gradle"
|
||||
|
||||
dependencies {
|
||||
testImplementation project(':instrumentation:classloaders:javaagent')
|
||||
testImplementation project(':instrumentation:internal:internal-proxy:javaagent')
|
||||
testImplementation project(':javaagent-bootstrap')
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import io.opentelemetry.javaagent.bootstrap.FieldBackedContextStoreAppliedMarker
|
||||
import io.opentelemetry.javaagent.instrumentation.javaclassloader.ProxyHelper
|
||||
import io.opentelemetry.javaagent.instrumentation.internal.proxy.ProxyHelper
|
||||
import java.util.concurrent.Callable
|
||||
import spock.lang.Specification
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
dependencies {
|
||||
compileOnly project(':javaagent-bootstrap')
|
||||
|
||||
testImplementation project(':javaagent-bootstrap')
|
||||
|
||||
// This is the earliest version that has org.apache.catalina.loader.ParallelWebappClassLoader
|
||||
// which is used in the test
|
||||
testLibrary group: 'org.apache.tomcat', name: 'tomcat-catalina', version: '8.0.14'
|
||||
|
||||
testImplementation group: 'org.jboss.modules', name: 'jboss-modules', version: '1.3.10.Final'
|
||||
|
||||
// TODO: we should separate core and Eclipse tests at some point,
|
||||
// but right now core-specific tests are quite dumb and are run with
|
||||
// core version provided by Eclipse implementation.
|
||||
//testImplementation group: 'org.osgi', name: 'org.osgi.core', version: '4.0.0'
|
||||
testImplementation group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.13.200'
|
||||
testImplementation group: 'org.apache.felix', name: 'org.apache.felix.framework', version: '6.0.2'
|
||||
}
|
||||
|
||||
// TODO (trask) ResourceInjectionTest is sort of hybrid integration/unit test
|
||||
// maybe cleaner turning it into integration test with its own test instrumentation,
|
||||
// similar to :testing-common:integration-tests
|
||||
// then wouldn't need this shadowJar and wouldn't need HelperInjectorAccess
|
||||
shadowJar {
|
||||
from("src/test/resources/")
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.javaclassloader;
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.proxy;
|
||||
|
||||
import io.opentelemetry.javaagent.bootstrap.FieldBackedContextStoreAppliedMarker;
|
||||
import java.util.Arrays;
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.javaclassloader;
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.proxy;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.proxy;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.javaagent.tooling.InstrumentationModule;
|
||||
import io.opentelemetry.javaagent.tooling.TypeInstrumentation;
|
||||
import java.util.List;
|
||||
|
||||
@AutoService(InstrumentationModule.class)
|
||||
public class ProxyInstrumentationModule extends InstrumentationModule {
|
||||
public ProxyInstrumentationModule() {
|
||||
super("internal-proxy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TypeInstrumentation> typeInstrumentations() {
|
||||
return singletonList(new ProxyInstrumentation());
|
||||
}
|
||||
}
|
|
@ -5,4 +5,6 @@ apply from: "$rootDir/gradle/instrumentation.gradle"
|
|||
dependencies {
|
||||
testImplementation group: "org.apache.commons", name: "commons-lang3", version: "3.12.0"
|
||||
testImplementation group: "commons-io", name: "commons-io", version: "2.8.0"
|
||||
|
||||
testInstrumentation project(":instrumentation:internal:internal-url-class-loader:javaagent")
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
dependencies {
|
||||
compileOnly project(':javaagent-bootstrap')
|
||||
|
||||
testImplementation project(':javaagent-bootstrap')
|
||||
|
||||
// This is the earliest version that has org.apache.catalina.loader.ParallelWebappClassLoader
|
||||
// which is used in the test
|
||||
testLibrary group: 'org.apache.tomcat', name: 'tomcat-catalina', version: '8.0.14'
|
||||
|
||||
testImplementation group: 'org.jboss.modules', name: 'jboss-modules', version: '1.3.10.Final'
|
||||
|
||||
// TODO: we should separate core and Eclipse tests at some point,
|
||||
// but right now core-specific tests are quite dumb and are run with
|
||||
// core version provided by Eclipse implementation.
|
||||
//testImplementation group: 'org.osgi', name: 'org.osgi.core', version: '4.0.0'
|
||||
testImplementation group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.13.200'
|
||||
testImplementation group: 'org.apache.felix', name: 'org.apache.felix.framework', version: '6.0.2'
|
||||
}
|
||||
|
||||
// TODO (trask) ResourceInjectionTest is sort of hybrid integration/unit test
|
||||
// maybe cleaner turning it into integration test with its own test instrumentation,
|
||||
// similar to :testing-common:integration-tests
|
||||
// then wouldn't need this shadowJar and wouldn't need HelperInjectorAccess
|
||||
shadowJar {
|
||||
from("src/test/resources/")
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.javaclassloader;
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.urlclassloader;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.internal.urlclassloader;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.javaagent.tooling.InstrumentationModule;
|
||||
import io.opentelemetry.javaagent.tooling.TypeInstrumentation;
|
||||
import java.util.List;
|
||||
|
||||
@AutoService(InstrumentationModule.class)
|
||||
public class UrlClassLoaderInstrumentationModule extends InstrumentationModule {
|
||||
public UrlClassLoaderInstrumentationModule() {
|
||||
super("internal-url-class-loader");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TypeInstrumentation> typeInstrumentations() {
|
||||
return singletonList(new UrlClassLoaderInstrumentation());
|
||||
}
|
||||
}
|
|
@ -85,9 +85,11 @@ include ':instrumentation:aws-sdk:aws-sdk-2.2:testing'
|
|||
include ':instrumentation:cassandra:cassandra-3.0:javaagent'
|
||||
include ':instrumentation:cassandra:cassandra-4.0:javaagent'
|
||||
include ':instrumentation:cdi-testing'
|
||||
include ':instrumentation:classloaders:javaagent'
|
||||
include ':instrumentation:classloaders:javaagent-integration-tests'
|
||||
include ':instrumentation:classloaders:javaagent-unit-tests'
|
||||
include ':instrumentation:internal:internal-class-loader:javaagent'
|
||||
include ':instrumentation:internal:internal-proxy:javaagent'
|
||||
include ':instrumentation:internal:internal-proxy:javaagent-unit-tests'
|
||||
include ':instrumentation:internal:internal-url-class-loader:javaagent'
|
||||
include ':instrumentation:internal:internal-url-class-loader:javaagent-integration-tests'
|
||||
include ':instrumentation:couchbase:couchbase-2.0:javaagent'
|
||||
include ':instrumentation:couchbase:couchbase-2.0:javaagent-unit-tests'
|
||||
include ':instrumentation:couchbase:couchbase-2.6:javaagent'
|
||||
|
@ -277,9 +279,12 @@ include ':benchmark-integration:jetty-perftest'
|
|||
include ':benchmark-e2e'
|
||||
|
||||
def setBuildFile(project) {
|
||||
// javaagent-unit-tests modules are needed until those projects have library modules
|
||||
// at which time those unit tests can be moved to the library modules
|
||||
if (['javaagent', 'javaagent-unit-tests', 'library', 'testing'].contains(project.projectDir.name) && project.path != ':javaagent') {
|
||||
// javaagent-unittests modules are needed until those projects have library modules
|
||||
// at which time those unittests can be moved to the library modules
|
||||
//
|
||||
// javaagent-integration-tests modules are only needed by "internal-" instrumentation
|
||||
// which needs to be tested by creating some other "test" instrumentation
|
||||
if (['javaagent', 'javaagent-unit-tests', 'javaagent-integration-tests', 'library', 'testing'].contains(project.projectDir.name) && project.path != ':javaagent') {
|
||||
project.buildFileName = "${project.projectDir.parentFile.name}-${project.projectDir.name}.gradle"
|
||||
} else {
|
||||
project.buildFileName = "${project.name}.gradle"
|
||||
|
|
|
@ -24,7 +24,9 @@ dependencies {
|
|||
implementation project(':instrumentation:executors:javaagent')
|
||||
// FIXME: we should enable this, but currently this fails tests for google http client
|
||||
//testImplementation project(':instrumentation:http-url-connection:javaagent')
|
||||
implementation project(':instrumentation:classloaders:javaagent')
|
||||
implementation project(':instrumentation:internal:internal-class-loader:javaagent')
|
||||
implementation project(':instrumentation:internal:internal-proxy:javaagent')
|
||||
implementation project(':instrumentation:internal:internal-url-class-loader:javaagent')
|
||||
|
||||
// Many tests use OpenTelemetry API calls, e.g., via TraceUtils.runUnderTrace
|
||||
implementation project(':instrumentation:opentelemetry-annotations-1.0:javaagent')
|
||||
|
|
Loading…
Reference in New Issue