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

Rename more properties #2486

Merged
merged 7 commits into from Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle/instrumentation.gradle
Expand Up @@ -111,13 +111,13 @@ evaluationDependsOn(":testing:agent-for-testing")
tasks.withType(Test).configureEach {
jvmArgs "-Dotel.javaagent.debug=true"
jvmArgs "-javaagent:${project(":testing:agent-for-testing").tasks.shadowJar.archiveFile.get().asFile.absolutePath}"
jvmArgs "-Dotel.initializer.jar=${shadowJar.archiveFile.get().asFile.absolutePath}"
jvmArgs "-Dinternal.testing.disable.global.library.ignores=true"
jvmArgs "-Dotel.javaagent.experimental.initializer.jar=${shadowJar.archiveFile.get().asFile.absolutePath}"
jvmArgs "-Dotel.javaagent.testing.additional-library-ignores.enabled=false"
// always run with the thread propagation debugger to help track down sporadic test failures
jvmArgs "-Dotel.threadPropagationDebugger=true"
jvmArgs "-Dotel.internal.failOnContextLeak=true"
jvmArgs "-Dotel.javaagent.experimental.thread-propagation-debugger.enabled=true"
jvmArgs "-Dotel.javaagent.testing.fail-on-context-leak=true"
// prevent sporadic gradle deadlocks, see SafeLogger for more details
jvmArgs "-Dotel.internal.enableTransformSafeLogging=true"
jvmArgs "-Dotel.javaagent.testing.transform-safe-logging.enabled=true"

dependsOn shadowJar
dependsOn ":testing:agent-for-testing:shadowJar"
Expand Down
Expand Up @@ -22,9 +22,9 @@ public final class ContextPropagationDebug {
ContextKey.named("thread-propagation-locations");

private static final boolean THREAD_PROPAGATION_DEBUGGER =
Boolean.getBoolean("otel.threadPropagationDebugger");
Boolean.getBoolean("otel.javaagent.experimental.thread-propagation-debugger.enabled");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about otel.javaagent.debug.thread-propagation.enabled instead? We could also set its default value to Config.isAgentDebugEnabled()

private static final boolean FAIL_ON_CONTEXT_LEAK =
Boolean.getBoolean("otel.internal.failOnContextLeak");
Boolean.getBoolean("otel.javaagent.testing.fail-on-context-leak");

public static boolean isThreadPropagationDebuggerEnabled() {
return THREAD_PROPAGATION_DEBUGGER;
Expand Down
Expand Up @@ -42,5 +42,5 @@ test.finalizedBy(tasks.register("testPropagationDisabled", Test) {
filter {
includeTestsMatching 'KafkaClientPropagationDisabledTest'
}
jvmArgs "-Dotel.instrumentation.kafka.client-propagation=false"
jvmArgs "-Dotel.instrumentation.kafka.client-propagation.enabled=false"
})
Expand Up @@ -10,7 +10,8 @@
public final class KafkaClientsConfig {

public static boolean isPropagationEnabled() {
return Config.get().getBooleanProperty("otel.instrumentation.kafka.client-propagation", true);
return Config.get()
.getBooleanProperty("otel.instrumentation.kafka.client-propagation.enabled", true);
}

public static boolean captureExperimentalSpanAttributes() {
Expand Down
Expand Up @@ -23,7 +23,7 @@ abstract class KafkaClientBaseTest extends AgentInstrumentationSpecification {
protected static final SHARED_TOPIC = "shared.topic"

private static final boolean propagationEnabled = Boolean.parseBoolean(
System.getProperty("otel.instrumentation.kafka.client-propagation", "true"))
System.getProperty("otel.instrumentation.kafka.client-propagation.enabled", "true"))

@Rule
KafkaEmbedded embeddedKafka = new KafkaEmbedded(1, true, SHARED_TOPIC)
Expand Down
Expand Up @@ -30,7 +30,7 @@ test.finalizedBy(tasks.register("testChunkRootSpan", Test) {
filter {
includeTestsMatching '*ChunkRootSpanTest'
}
jvmArgs '-Dotel.instrumentation.spring-batch.chunk.root-span=true'
jvmArgs '-Dotel.instrumentation.spring-batch.experimental.chunk.new-trace=true'
}).finalizedBy(tasks.register("testItemLevelSpan", Test) {
filter {
includeTestsMatching '*ItemLevelSpanTest'
Expand Down
Expand Up @@ -20,7 +20,8 @@ public final class SpringBatchInstrumentationConfig {
Config.get().isInstrumentationPropertyEnabled(instrumentationNames(), "item.enabled", false);
private static final boolean CREATE_ROOT_SPAN_FOR_CHUNK =
Config.get()
.isInstrumentationPropertyEnabled(instrumentationNames(), "chunk.root-span", false);
.isInstrumentationPropertyEnabled(
instrumentationNames(), "experimental.chunk.new-trace", false);

public static List<String> instrumentationNames() {
return INSTRUMENTATION_NAMES;
Expand Down
Expand Up @@ -29,7 +29,7 @@ public static boolean shouldAttachStateToTask(Object task) {
Class<?> enclosingClass = taskClass.getEnclosingClass();

// not much point in propagating root context
// plus it causes failures under otel.internal.failOnContextLeak=true
// plus it causes failures under otel.javaagent.testing.fail-on-context-leak=true
return Context.current() != Context.root()
// TODO Workaround for
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/787
Expand Down
Expand Up @@ -27,7 +27,7 @@ public class AgentClassLoader extends URLClassLoader {
}

private static final String AGENT_INITIALIZER_JAR =
System.getProperty("otel.initializer.jar", "");
System.getProperty("otel.javaagent.experimental.initializer.jar", "");

// Calling java.lang.instrument.Instrumentation#appendToBootstrapClassLoaderSearch
// adds a jar to the bootstrap class lookup, but not to the resource lookup.
Expand Down
Expand Up @@ -56,8 +56,8 @@ public class AgentInstaller {
// We set this system property when running the agent with unit tests to allow verifying that we
// don't ignore libraries that we actually attempt to instrument. It means either the list is
// wrong or a type matcher is.
private static final String DISABLE_GLOBAL_LIBRARY_IGNORES_FOR_TEST =
"internal.testing.disable.global.library.ignores";
private static final String ADDITIONAL_LIBRARY_IGNORES_ENABLED =
"otel.javaagent.testing.additional-library-ignores.enabled";

private static final Map<String, List<Runnable>> CLASS_LOAD_CALLBACKS = new HashMap<>();
private static volatile Instrumentation INSTRUMENTATION;
Expand Down Expand Up @@ -127,7 +127,7 @@ public static ResettableClassFileTransformer installBytebuddyAgent(
ignoredAgentBuilder =
ignoredAgentBuilder.or(
globalIgnoresMatcher(
Config.get().getBooleanProperty(DISABLE_GLOBAL_LIBRARY_IGNORES_FOR_TEST, false),
Config.get().getBooleanProperty(ADDITIONAL_LIBRARY_IGNORES_ENABLED, true),
ignoreMatcherProvider));

ignoredAgentBuilder = ignoredAgentBuilder.or(matchesConfiguredExcludes());
Expand Down
Expand Up @@ -34,7 +34,7 @@
public class AgentTracerProviderConfigurer implements SdkTracerProviderConfigurer {
private static final Logger log = LoggerFactory.getLogger(AgentTracerProviderConfigurer.class);

static final String EXPORTER_JAR_CONFIG = "otel.exporter.jar";
static final String EXPORTER_JAR_CONFIG = "otel.javaagent.experimental.exporter.jar";

@Override
public void configure(SdkTracerProviderBuilder sdkTracerProviderBuilder) {
Expand Down
Expand Up @@ -330,6 +330,6 @@ protected Map<String, String> contextStore() {
}

protected boolean defaultEnabled() {
return Config.get().getBooleanProperty("otel.instrumentation.default-enabled", true);
return Config.get().getBooleanProperty("otel.instrumentation.common.default-enabled", true);
}
}
Expand Up @@ -25,7 +25,7 @@
public class TransformSafeLogger {

private static final boolean ENABLE_TRANSFORM_SAFE_LOGGING =
Boolean.getBoolean("otel.internal.enableTransformSafeLogging");
Boolean.getBoolean("otel.javaagent.testing.transform-safe-logging.enabled");

private static final BlockingQueue<LogMessage> logMessageQueue;

Expand Down
Expand Up @@ -104,7 +104,7 @@ public class FieldBackedProvider implements InstrumentationContextProvider {
}

private static final boolean FIELD_INJECTION_ENABLED =
Config.get().getBooleanProperty("otel.javaagent.runtime.context.field.injection", true);
Config.get().getBooleanProperty("otel.javaagent.experimental.field-injection.enabled", true);

private final Class<?> instrumenterClass;
private final ByteBuddy byteBuddy;
Expand Down
Expand Up @@ -33,18 +33,18 @@ public class GlobalIgnoresMatcher<T extends TypeDescription>
Pattern.compile("com\\.mchange\\.v2\\.c3p0\\..*Proxy");

public static <T extends TypeDescription> ElementMatcher.Junction<T> globalIgnoresMatcher(
boolean skipAdditionalLibraryMatcher, IgnoreMatcherProvider ignoreMatcherProviders) {
return new GlobalIgnoresMatcher<>(skipAdditionalLibraryMatcher, ignoreMatcherProviders);
boolean additionalLibraryMatcher, IgnoreMatcherProvider ignoreMatcherProviders) {
return new GlobalIgnoresMatcher<>(additionalLibraryMatcher, ignoreMatcherProviders);
}

private final ElementMatcher<T> additionalLibraryIgnoreMatcher =
AdditionalLibraryIgnoresMatcher.additionalLibraryIgnoresMatcher();
private final boolean skipAdditionalLibraryMatcher;
private final boolean additionalLibraryMatcher;
private final IgnoreMatcherProvider ignoreMatcherProvider;

private GlobalIgnoresMatcher(
boolean skipAdditionalLibraryMatcher, IgnoreMatcherProvider ignoreMatcherProvider) {
this.skipAdditionalLibraryMatcher = skipAdditionalLibraryMatcher;
boolean additionalLibraryMatcher, IgnoreMatcherProvider ignoreMatcherProvider) {
this.additionalLibraryMatcher = additionalLibraryMatcher;
this.ignoreMatcherProvider = ignoreMatcherProvider;
}

Expand Down Expand Up @@ -194,7 +194,7 @@ public boolean matches(T target) {
return true;
}

if (!skipAdditionalLibraryMatcher && additionalLibraryIgnoreMatcher.matches(target)) {
if (additionalLibraryMatcher && additionalLibraryIgnoreMatcher.matches(target)) {
return true;
}

Expand Down
Expand Up @@ -86,7 +86,7 @@ class InstrumentationModuleTest extends Specification {
def "configure default sys prop as #value"() {
setup:
Config.INSTANCE = new ConfigBuilder().readProperties([
"otel.instrumentation.default-enabled": String.valueOf(value)
"otel.instrumentation.common.default-enabled": String.valueOf(value)
]).build()
def target = new TestInstrumentationModule(["test"])
target.instrument(new AgentBuilder.Default())
Expand All @@ -108,7 +108,7 @@ class InstrumentationModuleTest extends Specification {
def "configure sys prop enabled for #value when default is disabled"() {
setup:
Config.INSTANCE = new ConfigBuilder().readProperties([
"otel.instrumentation.default-enabled" : "false",
"otel.instrumentation.common.default-enabled" : "false",
("otel.instrumentation." + value + ".enabled"): "true"
]).build()

Expand Down
Expand Up @@ -40,6 +40,6 @@ test.finalizedBy(tasks.register("testFieldInjectionDisabled", Test) {
filter {
includeTestsMatching 'context.FieldInjectionDisabledTest'
}
jvmArgs '-Dotel.javaagent.runtime.context.field.injection=false'
jvmArgs '-Dotel.javaagent.experimental.field-injection.enabled=false'
jvmArgs '-Dotel.instrumentation.context-test-instrumentation.enabled=true'
})
Expand Up @@ -11,7 +11,7 @@ import java.lang.reflect.Field
import library.DisabledKeyClass

// this test is run using:
// -Dotel.javaagent.runtime.context.field.injection=false
// -Dotel.javaagent.experimental.field-injection.enabled=false
// -Dotel.instrumentation.context-test-instrumentation.enabled=true
// (see integration-tests.gradle)
class FieldInjectionDisabledTest extends AgentInstrumentationSpecification {
Expand Down