Rename Pre-Main class (#955)
This commit is contained in:
parent
89577a168a
commit
a0dc9ba19c
|
@ -12,7 +12,7 @@ into 3 parts:
|
|||
#### `javaagent` module
|
||||
|
||||
This module consists of single class
|
||||
`io.opentelemetry.auto.bootstrap.AgentBootstrap` which implements [Java
|
||||
`io.opentelemetry.javaagent.OpenTelemetryAgent` which implements [Java
|
||||
instrumentation
|
||||
agent](https://docs.oracle.com/javase/7/docs/api/java/lang/instrument/package-summary.html).
|
||||
This class is loaded during application startup by application classloader.
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Agent start up logic.
|
||||
*
|
||||
* <p>This class is loaded and called by {@code io.opentelemetry.auto.bootstrap.AgentBootstrap}
|
||||
* <p>This class is loaded and called by {@code io.opentelemetry.javaagent.OpenTelemetryAgent}
|
||||
*
|
||||
* <p>The intention is for this class to be loaded by bootstrap classloader to make sure we have
|
||||
* unimpeded access to the rest of agent parts.
|
||||
|
|
|
@ -18,9 +18,9 @@ configurations {
|
|||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
"Main-Class": "io.opentelemetry.auto.bootstrap.AgentBootstrap",
|
||||
"Agent-Class": "io.opentelemetry.auto.bootstrap.AgentBootstrap",
|
||||
"Premain-Class": "io.opentelemetry.auto.bootstrap.AgentBootstrap",
|
||||
"Main-Class": "io.opentelemetry.javaagent.OpenTelemetryAgent",
|
||||
"Agent-Class": "io.opentelemetry.javaagent.OpenTelemetryAgent",
|
||||
"Premain-Class": "io.opentelemetry.javaagent.OpenTelemetryAgent",
|
||||
"Can-Redefine-Classes": true,
|
||||
"Can-Retransform-Classes": true,
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.auto.bootstrap;
|
||||
package io.opentelemetry.javaagent;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
|
@ -55,8 +55,8 @@ import java.util.regex.Pattern;
|
|||
* <li>Do dot touch any logging facilities here so we can configure them later
|
||||
* </ul>
|
||||
*/
|
||||
public class AgentBootstrap {
|
||||
private static final Class<?> thisClass = AgentBootstrap.class;
|
||||
public class OpenTelemetryAgent {
|
||||
private static final Class<?> thisClass = OpenTelemetryAgent.class;
|
||||
|
||||
public static void premain(final String agentArgs, final Instrumentation inst) {
|
||||
agentmain(agentArgs, inst);
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package io.opentelemetry.auto
|
||||
|
||||
import io.opentelemetry.auto.bootstrap.AgentBootstrap
|
||||
import io.opentelemetry.auto.test.IntegrationTestUtils
|
||||
import io.opentelemetry.javaagent.OpenTelemetryAgent
|
||||
import jvmbootstraptest.AgentLoadedChecker
|
||||
import jvmbootstraptest.MyClassLoaderIsNotBootstrap
|
||||
import spock.lang.Specification
|
||||
|
@ -50,7 +50,7 @@ class AgentLoadedIntoBootstrapTest extends Specification {
|
|||
def mainClassName = MyClassLoaderIsNotBootstrap.getName()
|
||||
def pathToJar = IntegrationTestUtils.createJarWithClasses(mainClassName,
|
||||
MyClassLoaderIsNotBootstrap,
|
||||
AgentBootstrap).getPath()
|
||||
OpenTelemetryAgent).getPath()
|
||||
|
||||
expect:
|
||||
IntegrationTestUtils.runOnSeparateJvm(mainClassName
|
||||
|
|
|
@ -73,6 +73,13 @@ class ShadowPackageRenamingTest extends Specification {
|
|||
break
|
||||
}
|
||||
}
|
||||
if (info.getName() == 'io.opentelemetry.javaagent.OpenTelemetryAgent') {
|
||||
// io.opentelemetry.javaagent.OpenTelemetryAgent isn't needed in the bootstrap prefixes
|
||||
// because it doesn't live in the bootstrap class loader, but it's still "good" for the
|
||||
// purpose of this test which is just checking all the classes sitting directly inside of
|
||||
// the agent jar
|
||||
goodPrefix = true
|
||||
}
|
||||
if (!goodPrefix) {
|
||||
badBootstrapPrefixes.add(info.getName())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue