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

Package renaming part 2 #988

Merged
merged 2 commits into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ The OpenTelemetry API exposes SPI [hooks](https://github.com/open-telemetry/open
for customizing its behavior, such as the `Resource` attached to spans or the `Sampler`.

Because the auto instrumentation runs in a separate classpath than the instrumented application, it is not possible for customization in the application to take advantage of this customization. In order to provide such customization, you can
provide the path to a JAR file including an SPI implementation using the system property `otel.initializer.jar`. Note that this JAR will need to shade the OpenTelemetry API in the same way as the agent does. The simplest way to do this is to use the same shading configuration as the agent from [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/cfade733b899a2f02cfec7033c6a1efd7c54fd8b/java-agent/java-agent.gradle#L39). In addition, you will have to specify the `io.opentelemetry.auto.shaded.io.opentelemetry.trace.spi.TraceProvider` to the name of the class that implements the SPI.
provide the path to a JAR file including an SPI implementation using the system property `otel.initializer.jar`. Note that this JAR will need to shade the OpenTelemetry API in the same way as the agent does. The simplest way to do this is to use the same shading configuration as the agent from [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/cfade733b899a2f02cfec7033c6a1efd7c54fd8b/java-agent/java-agent.gradle#L39). In addition, you will have to specify the `io.opentelemetry.javaagent.shaded.io.opentelemetry.trace.spi.TraceProvider` to the name of the class that implements the SPI.

## Supported Java libraries and frameworks

Expand Down Expand Up @@ -301,7 +301,7 @@ and you want to suppress some of them without modifying the code.

To turn on the agent's internal debug logging:

`-Dio.opentelemetry.auto.slf4j.simpleLogger.defaultLogLevel=debug`
`-Dio.opentelemetry.javaagent.slf4j.simpleLogger.defaultLogLevel=debug`

Note these logs are extremely verbose. Enable debug logging only when needed.
Debug logging negatively impacts the performance of your application.
Expand Down
18 changes: 9 additions & 9 deletions auto-exporters/auto-exporters.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ shadowJar {
exclude '**/module-info.class'

// Prevents conflict with other SLF4J instances. Important for premain.
relocate 'org.slf4j', 'io.opentelemetry.auto.slf4j'
relocate 'org.slf4j', 'io.opentelemetry.javaagent.slf4j'
// rewrite dependencies calling Logger.getLogger
relocate 'java.util.logging.Logger', 'io.opentelemetry.auto.bootstrap.PatchLogger'
relocate 'java.util.logging.Logger', 'io.opentelemetry.javaagent.bootstrap.PatchLogger'

// relocate OpenTelemetry API usage
relocate "io.opentelemetry.OpenTelemetry", "io.opentelemetry.auto.shaded.io.opentelemetry.OpenTelemetry"
relocate "io.opentelemetry.common", "io.opentelemetry.auto.shaded.io.opentelemetry.common"
relocate "io.opentelemetry.context", "io.opentelemetry.auto.shaded.io.opentelemetry.context"
relocate "io.opentelemetry.correlationcontext", "io.opentelemetry.auto.shaded.io.opentelemetry.correlationcontext"
relocate "io.opentelemetry.internal", "io.opentelemetry.auto.shaded.io.opentelemetry.internal"
relocate "io.opentelemetry.metrics", "io.opentelemetry.auto.shaded.io.opentelemetry.metrics"
relocate "io.opentelemetry.trace", "io.opentelemetry.auto.shaded.io.opentelemetry.trace"
relocate "io.opentelemetry.OpenTelemetry", "io.opentelemetry.javaagent.shaded.io.opentelemetry.OpenTelemetry"
relocate "io.opentelemetry.common", "io.opentelemetry.javaagent.shaded.io.opentelemetry.common"
relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context"
relocate "io.opentelemetry.correlationcontext", "io.opentelemetry.javaagent.shaded.io.opentelemetry.correlationcontext"
relocate "io.opentelemetry.internal", "io.opentelemetry.javaagent.shaded.io.opentelemetry.internal"
relocate "io.opentelemetry.metrics", "io.opentelemetry.javaagent.shaded.io.opentelemetry.metrics"
relocate "io.opentelemetry.trace", "io.opentelemetry.javaagent.shaded.io.opentelemetry.trace"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.opentelemetry.auto.exporters.jaeger;
package io.opentelemetry.javaagent.exporters.jaeger;

import io.opentelemetry.exporters.jaeger.JaegerGrpcSpanExporter;
import io.opentelemetry.sdk.extensions.auto.config.Config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.opentelemetry.auto.exporters.jaeger.JaegerExporterFactory
io.opentelemetry.javaagent.exporters.jaeger.JaegerExporterFactory
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.opentelemetry.auto.exporters.logging;
package io.opentelemetry.javaagent.exporters.logging;

import io.opentelemetry.common.AttributeValue;
import io.opentelemetry.common.ReadableKeyValuePairs.KeyValueConsumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.opentelemetry.auto.exporters.logging;
package io.opentelemetry.javaagent.exporters.logging;

import io.opentelemetry.sdk.extensions.auto.config.Config;
import io.opentelemetry.sdk.extensions.auto.config.SpanExporterFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.opentelemetry.auto.exporters.logging.LoggingExporterFactory
io.opentelemetry.javaagent.exporters.logging.LoggingExporterFactory
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.opentelemetry.auto.exporters.otlp;
package io.opentelemetry.javaagent.exporters.otlp;

import io.opentelemetry.exporters.otlp.OtlpGrpcMetricExporter;
import io.opentelemetry.sdk.extensions.auto.config.Config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.opentelemetry.auto.exporters.otlp;
package io.opentelemetry.javaagent.exporters.otlp;

import io.opentelemetry.exporters.otlp.OtlpGrpcSpanExporter;
import io.opentelemetry.sdk.extensions.auto.config.Config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.opentelemetry.auto.exporters.otlp.OtlpMetricExporterFactory
io.opentelemetry.javaagent.exporters.otlp.OtlpMetricExporterFactory
Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.opentelemetry.auto.exporters.otlp.OtlpSpanExporterFactory
io.opentelemetry.javaagent.exporters.otlp.OtlpSpanExporterFactory
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import io.opentelemetry.auto.tooling.ExporterClassLoader
import io.opentelemetry.javaagent.tooling.ExporterClassLoader
import io.opentelemetry.sdk.extensions.auto.config.SpanExporterFactory
import spock.lang.Shared
import spock.lang.Specification
Expand Down Expand Up @@ -71,9 +71,9 @@ class ExporterAdaptersTest extends Specification {

where:
exporter | classname
otlpExporterJar | 'io.opentelemetry.auto.exporters.otlp.OtlpSpanExporterFactory'
jaegerExporterJar | 'io.opentelemetry.auto.exporters.jaeger.JaegerExporterFactory'
loggingExporterJar | 'io.opentelemetry.auto.exporters.logging.LoggingExporterFactory'
zipkinExporterJar | 'io.opentelemetry.auto.exporters.zipkin.ZipkinExporterFactory'
otlpExporterJar | 'io.opentelemetry.javaagent.exporters.otlp.OtlpSpanExporterFactory'
jaegerExporterJar | 'io.opentelemetry.javaagent.exporters.jaeger.JaegerExporterFactory'
loggingExporterJar | 'io.opentelemetry.javaagent.exporters.logging.LoggingExporterFactory'
zipkinExporterJar | 'io.opentelemetry.javaagent.exporters.zipkin.ZipkinExporterFactory'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.opentelemetry.auto.exporters.zipkin;
package io.opentelemetry.javaagent.exporters.zipkin;

import io.opentelemetry.exporters.zipkin.ZipkinSpanExporter;
import io.opentelemetry.sdk.extensions.auto.config.Config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.opentelemetry.auto.exporters.zipkin.ZipkinExporterFactory
io.opentelemetry.javaagent.exporters.zipkin.ZipkinExporterFactory
2 changes: 1 addition & 1 deletion benchmark-integration/run-perf-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function start_server {
agent_jar="$1"
javaagent_arg=""
if [ "$agent_jar" != "" -a -f "$agent_jar" ]; then
javaagent_arg="-javaagent:$agent_jar -Dio.opentelemetry.auto.slf4j.simpleLogger.defaultLogLevel=off"
javaagent_arg="-javaagent:$agent_jar -Dio.opentelemetry.javaagent.slf4j.simpleLogger.defaultLogLevel=off"
fi

if [ "$server_type" = "jar" ]; then
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/groovy/MuzzlePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class MuzzlePlugin implements Plugin<Project> {
project.getLogger().info('No muzzle pass directives configured. Asserting pass against instrumentation compile-time dependencies')
ClassLoader userCL = createCompileDepsClassLoader(project, bootstrapProject)
ClassLoader instrumentationCL = createInstrumentationClassloader(project, toolingProject)
Method assertionMethod = instrumentationCL.loadClass('io.opentelemetry.auto.tooling.muzzle.MuzzleVersionScanPlugin')
Method assertionMethod = instrumentationCL.loadClass('io.opentelemetry.javaagent.tooling.muzzle.MuzzleVersionScanPlugin')
.getMethod('assertInstrumentationMuzzled', ClassLoader.class, ClassLoader.class, boolean.class)
assertionMethod.invoke(null, instrumentationCL, userCL, true)
}
Expand All @@ -82,7 +82,7 @@ class MuzzlePlugin implements Plugin<Project> {
description = "Print references created by instrumentation muzzle"
doLast {
ClassLoader instrumentationCL = createInstrumentationClassloader(project, toolingProject)
Method assertionMethod = instrumentationCL.loadClass('io.opentelemetry.auto.tooling.muzzle.MuzzleVersionScanPlugin')
Method assertionMethod = instrumentationCL.loadClass('io.opentelemetry.javaagent.tooling.muzzle.MuzzleVersionScanPlugin')
.getMethod('printMuzzleReferences', ClassLoader.class)
assertionMethod.invoke(null, instrumentationCL)
}
Expand Down Expand Up @@ -336,7 +336,7 @@ class MuzzlePlugin implements Plugin<Project> {
ClassLoader userCL = createClassLoaderForTask(instrumentationProject, bootstrapProject, taskName)
try {
// find all instrumenters, get muzzle, and assert
Method assertionMethod = instrumentationCL.loadClass('io.opentelemetry.auto.tooling.muzzle.MuzzleVersionScanPlugin')
Method assertionMethod = instrumentationCL.loadClass('io.opentelemetry.javaagent.tooling.muzzle.MuzzleVersionScanPlugin')
.getMethod('assertInstrumentationMuzzled', ClassLoader.class, ClassLoader.class, boolean.class)
assertionMethod.invoke(null, instrumentationCL, userCL, muzzleDirective.assertPass)
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
public class AutoInstrumentationPlugin implements Plugin<Project> {

/**
* An exact copy of {@code io.opentelemetry.auto.tooling.Constants#BOOTSTRAP_PACKAGE_PREFIXES}. We
* An exact copy of {@code io.opentelemetry.javaagent.tooling.Constants#BOOTSTRAP_PACKAGE_PREFIXES}. We
* can't reference it directly since this file needs to be compiled before the other packages.
*/
public static final String[] BOOTSTRAP_PACKAGE_PREFIXES_COPY = {
"io.opentelemetry.auto.common.exec",
"io.opentelemetry.auto.slf4j",
"io.opentelemetry.auto.bootstrap",
"io.opentelemetry.auto.shaded",
"io.opentelemetry.javaagent.common.exec",
"io.opentelemetry.javaagent.slf4j",
"io.opentelemetry.javaagent.bootstrap",
"io.opentelemetry.javaagent.shaded",
"io.opentelemetry.instrumentation.auto.api",
};

Expand Down
18 changes: 9 additions & 9 deletions docs/contributing/javaagent-jar-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ agent](https://docs.oracle.com/javase/7/docs/api/java/lang/instrument/package-su
This class is loaded during application startup by application classloader.
Its sole responsibility is to push agent's classes into JVM's bootstrap
classloader and immediately delegate to
`io.opentelemetry.auto.bootstrap.Agent` (now in the bootstrap class loader)
`io.opentelemetry.javaagent.bootstrap.Agent` (now in the bootstrap class loader)
class from there.

### Modules that live in the bootstrap class loader

#### `javaagent-bootstrap` module

`io.opentelemetry.auto.bootstrap.Agent` and a few other classes that live in the bootstrap class
`io.opentelemetry.javaagent.bootstrap.Agent` and a few other classes that live in the bootstrap class
loader but are not used directly by auto-instrumentation

#### `instrumentation-api` and `auto-api` modules
Expand Down Expand Up @@ -56,9 +56,9 @@ host application. This is achieved in the following way:
folder inside final jar file, called`inst`.
In addition, the extension of all class files is changed from `class` to `classdata`.
This ensures that general classloaders cannot find nor load these classes.
- When `io.opentelemetry.auto.bootstrap.Agent` starts up, it creates an
- When `io.opentelemetry.javaagent.bootstrap.Agent` starts up, it creates an
instance of `io.opentelemetry.instrumentation.auto.api.AgentClassLoader`, loads an
`io.opentelemetry.auto.tooling.AgentInstaller` from that `AgentClassLoader`
`io.opentelemetry.javaagent.tooling.AgentInstaller` from that `AgentClassLoader`
and then passes control on to the `AgentInstaller` (now in the
`AgentClassLoader`). The `AgentInstaller` then installs all of the
instrumentations with the help of ByteBuddy.
Expand All @@ -76,18 +76,18 @@ following "clusters" of classes:

Available in the system class loader:

- `io/opentelemetry/auto/bootstrap/AgentBootstrap` - the one class from `javaagent`
- `io/opentelemetry/javaagent/bootstrap/AgentBootstrap` - the one class from `javaagent`
module

Available in the bootstrap class loader:

- `io/opentelemetry/auto/bootstrap/` - contains the `javaagent-bootstrap` module
- `io/opentelemetry/javaagent/bootstrap/` - contains the `javaagent-bootstrap` module
- `io/opentelemetry/instrumentation/auto/api/` - contains the `auto-api` module
- `io/opentelemetry/auto/shaded/instrumentation/api/` - contains the `instrumentation-api` module,
- `io/opentelemetry/javaagent/shaded/instrumentation/api/` - contains the `instrumentation-api` module,
shaded during creation of `javaagent` jar file by Shadow Gradle plugin
- `io/opentelemetry/auto/shaded/io/` - contains the OpenTelemetry API and its dependency gRPC
- `io/opentelemetry/javaagent/shaded/io/` - contains the OpenTelemetry API and its dependency gRPC
Context, both shaded during creation of `javaagent` jar file by Shadow Gradle plugin
- `io/opentelemetry/auto/slf4j/` - contains SLF4J and its simple logger implementation, shaded
- `io/opentelemetry/javaagent/slf4j/` - contains SLF4J and its simple logger implementation, shaded
during creation of `javaagent` jar file by Shadow Gradle plugin

Available in the agent class loader:
Expand Down
4 changes: 2 additions & 2 deletions gradle/instrumentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ byteBuddy {
transformation {
// Applying NoOp optimizes build by applying bytebuddy plugin to only compileJava task
tasks = ['compileJava', 'compileScala', 'compileKotlin']
plugin = 'io.opentelemetry.auto.tooling.muzzle.MuzzleGradlePlugin$NoOp'
plugin = 'io.opentelemetry.javaagent.tooling.muzzle.MuzzleGradlePlugin$NoOp'
}
}

Expand All @@ -30,7 +30,7 @@ afterEvaluate {
byteBuddy {
transformation {
tasks = ['compileJava', 'compileScala', 'compileKotlin']
plugin = 'io.opentelemetry.auto.tooling.muzzle.MuzzleGradlePlugin'
plugin = 'io.opentelemetry.javaagent.tooling.muzzle.MuzzleGradlePlugin'
classPath = project(':javaagent-tooling').configurations.instrumentationMuzzle + configurations.runtimeClasspath + sourceSets.main.output
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import akka.dispatch.forkjoin.ForkJoinTask;
import com.google.auto.service.AutoService;
import io.grpc.Context;
import io.opentelemetry.auto.tooling.Instrumenter;
import io.opentelemetry.instrumentation.auto.api.ContextStore;
import io.opentelemetry.instrumentation.auto.api.InstrumentationContext;
import io.opentelemetry.instrumentation.auto.api.concurrent.ExecutorInstrumentationUtils;
import io.opentelemetry.instrumentation.auto.api.concurrent.State;
import io.opentelemetry.instrumentation.auto.javaconcurrent.AbstractExecutorInstrumentation;
import io.opentelemetry.javaagent.tooling.Instrumenter;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package io.opentelemetry.instrumentation.auto.akkaconcurrent;

import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.auto.tooling.bytebuddy.matcher.AgentElementMatchers.extendsClass;
import static io.opentelemetry.javaagent.tooling.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.javaagent.tooling.bytebuddy.matcher.AgentElementMatchers.extendsClass;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
import static net.bytebuddy.matcher.ElementMatchers.named;
Expand All @@ -27,13 +27,13 @@
import akka.dispatch.forkjoin.ForkJoinPool;
import akka.dispatch.forkjoin.ForkJoinTask;
import com.google.auto.service.AutoService;
import io.opentelemetry.auto.tooling.Instrumenter;
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.auto.api.ContextStore;
import io.opentelemetry.instrumentation.auto.api.InstrumentationContext;
import io.opentelemetry.instrumentation.auto.api.concurrent.AdviceUtils;
import io.opentelemetry.instrumentation.auto.api.concurrent.State;
import io.opentelemetry.instrumentation.auto.javaconcurrent.AbstractExecutorInstrumentation;
import io.opentelemetry.javaagent.tooling.Instrumenter;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import com.google.auto.service.AutoService;
import io.grpc.Context;
import io.opentelemetry.OpenTelemetry;
import io.opentelemetry.auto.tooling.Instrumenter;
import io.opentelemetry.context.Scope;
import io.opentelemetry.context.propagation.HttpTextFormat;
import io.opentelemetry.instrumentation.auto.api.CallDepthThreadLocalMap.Depth;
import io.opentelemetry.javaagent.tooling.Instrumenter;
import io.opentelemetry.trace.Span;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import akka.http.scaladsl.model.HttpResponse;
import akka.stream.Materializer;
import com.google.auto.service.AutoService;
import io.opentelemetry.auto.tooling.Instrumenter;
import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.tooling.Instrumenter;
import io.opentelemetry.trace.Span;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package io.opentelemetry.instrumentation.auto.apachehttpasyncclient;

import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.auto.tooling.bytebuddy.matcher.AgentElementMatchers.implementsInterface;
import static io.opentelemetry.instrumentation.api.tracer.HttpClientTracer.DEFAULT_SPAN_NAME;
import static io.opentelemetry.instrumentation.auto.apachehttpasyncclient.ApacheHttpAsyncClientTracer.TRACER;
import static io.opentelemetry.instrumentation.auto.apachehttpasyncclient.HttpHeadersInjectAdapter.SETTER;
import static io.opentelemetry.javaagent.tooling.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.javaagent.tooling.bytebuddy.matcher.AgentElementMatchers.implementsInterface;
import static io.opentelemetry.trace.TracingContextUtils.currentContextWith;
import static io.opentelemetry.trace.TracingContextUtils.withSpan;
import static java.util.Collections.singletonMap;
Expand All @@ -32,8 +32,8 @@
import com.google.auto.service.AutoService;
import io.grpc.Context;
import io.opentelemetry.OpenTelemetry;
import io.opentelemetry.auto.tooling.Instrumenter;
import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.tooling.Instrumenter;
import io.opentelemetry.trace.Span;
import java.io.IOException;
import java.util.Map;
Expand Down
Loading