Skip to content

Commit

Permalink
Rename more properties (#2486)
Browse files Browse the repository at this point in the history
* Rename more props to experimental

* Rename more properties

* Rename .internal to .testing

* Revert changes to examples distro

* Move chunk.new-trace to experimental

* Fix unrelated build issue
  • Loading branch information
trask committed Mar 4, 2021
1 parent 7efa58d commit 0abc492
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 61 deletions.
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");
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 @@ -36,19 +36,15 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
/**
* Temporarily using emq instead of localstack till the latter supports AWS trace propagation
*
sqs = new LocalStackContainer(DockerImageName.parse("localstack/localstack:latest"))
.withServices(LocalStackContainer.Service.SQS)
sqs.start()
sqsPort = sqs.getMappedPort(4566)
sqs = new LocalStackContainer(DockerImageName.parse("localstack/localstack:latest"))
.withServices(LocalStackContainer.Service.SQS)
sqs.start()
sqsPort = sqs.getMappedPort(4566)
def app = new SpringApplication(SqsConfig)
app.addInitializers(new ApplicationContextInitializer<AbstractApplicationContext>() {
@Override
void initialize(AbstractApplicationContext applicationContext) {
applicationContext.getBeanFactory().registerSingleton("localStack", sqs)
}
})
server = app.run()**/
def app = new SpringApplication(SqsConfig)
app.addInitializers(new ApplicationContextInitializer<AbstractApplicationContext>() {@Override
void initialize(AbstractApplicationContext applicationContext) {applicationContext.getBeanFactory().registerSingleton("localStack", sqs)}})
server = app.run()**/

sqsPort = PortUtils.randomOpenPort()
sqs = SQSRestServerBuilder.withPort(sqsPort).withInterface("localhost").start()
Expand Down Expand Up @@ -105,7 +101,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "SendMessageRequest"
"aws.operation" "SendMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -124,7 +120,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand Down Expand Up @@ -156,7 +152,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -177,7 +173,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "DeleteMessageRequest"
"aws.operation" "DeleteMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -198,7 +194,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -219,7 +215,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -240,7 +236,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand Down Expand Up @@ -275,7 +271,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "SendMessageRequest"
"aws.operation" "SendMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -294,7 +290,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand Down Expand Up @@ -326,7 +322,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -347,7 +343,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "DeleteMessageRequest"
"aws.operation" "DeleteMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -368,7 +364,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -389,7 +385,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -410,7 +406,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand Down Expand Up @@ -449,7 +445,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "CreateQueueRequest"
"aws.operation" "CreateQueue"
"aws.queue.name" "sqsCamelSeparateQueueTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand Down Expand Up @@ -488,7 +484,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "SendMessageRequest"
"aws.operation" "SendMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelSeparateQueueTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -507,7 +503,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelSeparateQueueTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
Expand All @@ -533,7 +529,7 @@ class SqsCamelTest extends AgentInstrumentationSpecification {
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" "http://localhost:$sqsPort"
"aws.operation" "ReceiveMessageRequest"
"aws.operation" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/queue/sqsCamelSeparateQueueTest"
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
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
2 changes: 1 addition & 1 deletion testing-common/integration-tests/integration-tests.gradle
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'
})

0 comments on commit 0abc492

Please sign in to comment.