Rename Pre-Main class
MODIFY
docs/contributing/javaagent-jar-components.md
docs/contributing/javaagent-jar-components.md
@@ -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.

MODIFY
javaagent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/Agent.java
javaagent-bootstrap/src/main/java/io/opentelemetry/auto/bootstrap/Agent.java
@@ -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.

MODIFY
javaagent/javaagent.gradle
javaagent/javaagent.gradle
@@ -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,
)

RENAME
javaagent/src/main/java/io/opentelemetry/auto/bootstrap/AgentBootstrap.java
javaagent/src/main/java/io/opentelemetry/javaagent/OpenTelemetryAgent.java
* 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);

MODIFY
javaagent/src/test/groovy/io/opentelemetry/auto/AgentLoadedIntoBootstrapTest.groovy
javaagent/src/test/groovy/io/opentelemetry/auto/AgentLoadedIntoBootstrapTest.groovy
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

MODIFY
javaagent/src/test/groovy/io/opentelemetry/auto/integration/classloading/ShadowPackageRenamingTest.groovy
javaagent/src/test/groovy/io/opentelemetry/auto/integration/classloading/ShadowPackageRenamingTest.groovy
@@ -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())
}

Rename Pre-Main class (#955)