Deprecate old extensions
* Introduce stable property for external extensions
* Update docs to use stable extension property.
Also log a warning if deprecated otel.javaagent.experimental.exporter.jar is used.
* Format
* Format
* Polish
MODIFY
docs/agent-config.md
docs/agent-config.md
@@ -58,7 +58,7 @@ You can enable [extensions](../examples/extension/README.md) by setting the corr
| System property | Environment variable | Description |
|--------------------------------------|--------------------------------------|----------------------------------------------------------------------------------|
-| `otel.javaagent.experimental.extensions` | `OTEL_JAVAAGENT_EXPERIMENTAL_EXTENSIONS` | Path to a an extension jar file or folder, containing jar files. If pointing to a folder, every jar file in that folder will be treated as separate, independent extension|
+| `otel.javaagent.extensions` | `OTEL_JAVAAGENT_EXTENSIONS` | Path to a an extension jar file or folder, containing jar files. If pointing to a folder, every jar file in that folder will be treated as separate, independent extension|
## Peer service name

MODIFY
examples/extension/README.md
examples/extension/README.md
@@ -17,12 +17,12 @@ To add the extension to the instrumentation agent:
```bash
java -javaagent:path/to/opentelemetry-javaagent-all.jar \
- -Dotel.javaagent.experimental.extensions=build/libs/opentelemetry-java-instrumentation-extension-demo-1.0-all.jar
+ -Dotel.javaagent.extensions=build/libs/opentelemetry-java-instrumentation-extension-demo-1.0-all.jar
-jar myapp.jar
```
## Embed extensions in the OpenTelemetry Agent
-To simplify deployment, you can embed extensions into the OpenTelemetry Java Agent to produce a single jar file. With an integrated extension, you no longer need the `-Dotel.javaagent.experimental.extensions` command line option.
+To simplify deployment, you can embed extensions into the OpenTelemetry Java Agent to produce a single jar file. With an integrated extension, you no longer need the `-Dotel.javaagent.extensions` command line option.
For more information, see the `extendedAgent` task in [build.gradle](build.gradle).
## Extensions examples

MODIFY
examples/extension/src/test/java/com/example/javaagent/smoketest/IntegrationTest.java
examples/extension/src/test/java/com/example/javaagent/smoketest/IntegrationTest.java
@@ -112,7 +112,7 @@ abstract class IntegrationTest {
//Asks instrumentation agent to include extensions from given location into its runtime
result = result.withCopyFileToContainer(
MountableFile.forHostPath(extensionPath), "/opentelemetry-extensions.jar")
- .withEnv("OTEL_JAVAAGENT_EXPERIMENTAL_EXTENSIONS", extensionLocation);
+ .withEnv("OTEL_JAVAAGENT_EXTENSIONS", extensionLocation);
}
return result;
}

MODIFY
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java
@@ -74,8 +74,13 @@ public class AgentTracerProviderConfigurer implements SdkTracerProviderConfigure
installExportersFromJar(exporterJar, config, sdkTracerProviderBuilder);
}
+ // TODO remove in 1.6
private static synchronized void installExportersFromJar(
String exporterJar, Config config, SdkTracerProviderBuilder builder) {
+ logger.warn(
+ "{} is deprecated and will be removed soon! Please use {}",
+ EXPORTER_JAR_CONFIG,
+ ExtensionClassLoader.EXTENSIONS_CONFIG);
URL url;
try {
url = new File(exporterJar).toURI().toURL();

MODIFY
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ExtensionClassLoader.java
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ExtensionClassLoader.java
@@ -34,6 +34,8 @@ import net.bytebuddy.dynamic.loading.MultipleParentClassLoader;
// Used by AgentInitializer
@SuppressWarnings({"unused", "SystemOut"})
public class ExtensionClassLoader extends URLClassLoader {
+ public static final String EXTENSIONS_CONFIG = "otel.javaagent.extensions";
+
// NOTE it's important not to use slf4j in this class, because this class is used before slf4j is
// configured, and so using slf4j here would initialize slf4j-simple before we have a chance to
// configure the logging levels
@@ -47,12 +49,11 @@ public class ExtensionClassLoader extends URLClassLoader {
includeEmbeddedExtensionsIfFound(parent, extensions, javaagentFile);
- // TODO add support for old deprecated property otel.javaagent.experimental.exporter.jar
extensions.addAll(
parseLocation(
- System.getProperty(
- "otel.javaagent.extensions", System.getenv("OTEL_JAVAAGENT_EXTENSIONS")),
+ System.getProperty(EXTENSIONS_CONFIG, System.getenv("OTEL_JAVAAGENT_EXTENSIONS")),
javaagentFile));
+
extensions.addAll(
parseLocation(
System.getProperty(

Deprecate old extensions (#3825)

* Introduce stable property for external extensions

* Update docs to use stable extension property.

Also log a warning if deprecated otel.javaagent.experimental.exporter.jar is used.

* Format

* Format

* Polish