Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate old extensions #3825

Merged
merged 6 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agent-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions examples/extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private GenericContainer<?> buildTargetContainer(String agentPath, String extens
//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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ private static void maybeConfigureExporterJar(SdkTracerProviderBuilder sdkTracer
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
// 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
Expand All @@ -47,7 +49,11 @@ public static ClassLoader getInstance(ClassLoader parent, File javaagentFile) {

includeEmbeddedExtensionsIfFound(parent, extensions, javaagentFile);

// TODO add support for old deprecated property otel.javaagent.experimental.exporter.jar
extensions.addAll(
parseLocation(
System.getProperty(EXTENSIONS_CONFIG, System.getenv("OTEL_JAVAAGENT_EXTENSIONS")),
javaagentFile));

extensions.addAll(
parseLocation(
System.getProperty(
Expand Down