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 otel.trace.classes.excludes to otel.javaagent.exclude-classes #1747

Merged
merged 2 commits into from
Nov 25, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/suppressing-instrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ which could have unknown side-effects.
If you find yourself needing to use this, it would be great if you could drop us an issue explaining why,
so that we can try to come up with a better solution to address your need.

| System property | Environment variable | Purpose |
|-----------------------|-----------------------|---------------------------------------------------------------------------------------------------|
| otel.trace.classes.exclude | OTEL_TRACE_CLASSES_EXCLUDE | Suppresses all instrumentation for specific classes, format is "my.package.MyClass,my.package2.*" |
| System property | Environment variable | Purpose |
|--------------------------------|--------------------------------|---------------------------------------------------------------------------------------------------|
| otel.javaagent.exclude-classes | OTEL_JAVAAGENT_EXCLUDE_CLASSES | Suppresses all instrumentation for specific classes, format is "my.package.MyClass,my.package2.*" |
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,12 @@
*/

import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.instrumentation.test.utils.ConfigUtils
import io.opentelemetry.test.annotation.SayTracedHello

/**
* This test verifies that Otel supports various 3rd-party trace annotations
*/
class TraceProvidersTest extends AgentTestRunner {
//Don't bother to instrument inner closures of this test class
static final PREVIOUS_CONFIG = ConfigUtils.updateConfigAndResetInstrumentation {
it.remove("otel.trace.annotations")
it.setProperty("otel.trace.classes.exclude", TraceProvidersTest.name + "*")
}

def cleanupSpec() {
ConfigUtils.setConfig(PREVIOUS_CONFIG)
}

def "should support #provider"(String provider) {
setup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import io.opentracing.contrib.dropwizard.Trace

class TracedMethodsExclusionTest extends AgentTestRunner {
static final PREVIOUS_CONFIG = ConfigUtils.updateConfigAndResetInstrumentation {
// remove trace annotations in case previous tests have set it
it.remove("otel.trace.annotations")
it.setProperty("otel.trace.methods", "${TestClass.name}[included,excluded]")
it.setProperty("otel.trace.annotated.methods.exclude", "${TestClass.name}[excluded,annotatedButExcluded]")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import io.opentelemetry.test.annotation.TracedWithSpan
*/
class WithSpanInstrumentationTest extends AgentTestRunner {
static final PREVIOUS_CONFIG = ConfigUtils.updateConfigAndResetInstrumentation {
it.setProperty("otel.trace.classes.exclude", WithSpanInstrumentationTest.name + "*")
it.setProperty("otel.trace.annotated.methods.exclude", "${TracedWithSpan.name}[ignored]")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class AgentInstaller {
private static final Logger log = LoggerFactory.getLogger(AgentInstaller.class);

private static final String JAVAAGENT_ENABLED_CONFIG = "otel.javaagent.enabled";
private static final String EXCLUDED_CLASSES_CONFIG = "otel.trace.classes.exclude";
private static final String EXCLUDED_CLASSES_CONFIG = "otel.javaagent.exclude-classes";

private static final Map<String, List<Runnable>> CLASS_LOAD_CALLBACKS = new HashMap<>();
private static volatile Instrumentation INSTRUMENTATION;
Expand Down
2 changes: 1 addition & 1 deletion testing-common/src/test/groovy/AgentTestRunnerTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AgentTestRunnerTest extends AgentTestRunner {
private static final boolean AGENT_INSTALLED_IN_CLINIT

static final PREVIOUS_CONFIG = ConfigUtils.updateConfig {
it.setProperty("otel.trace.classes.exclude",
it.setProperty("otel.javaagent.exclude-classes",
"config.exclude.packagename.*, config.exclude.SomeClass,config.exclude.SomeClass\$NestedClass")
}

Expand Down