Skip to content

Commit

Permalink
Add baggage-processor configuration for javaagent testing
Browse files Browse the repository at this point in the history
  • Loading branch information
xiepuhuan committed Jan 11, 2025
1 parent a8daa71 commit 7a9b214
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class JavaagentTestArgumentsProvider(
"-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.grpc.internal.ServerImplBuilder=INFO",
"-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.grpc.internal.ManagedChannelImplBuilder=INFO",
"-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.perfmark.PerfMark=INFO",
"-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.grpc.Context=INFO"
"-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.grpc.Context=INFO",
"-Dotel.java.experimental.span-attributes.copy-from-baggage.include=*"
)
}

Expand All @@ -108,12 +109,22 @@ afterEvaluate {
// this dependency.
dependsOn(agentForTesting.buildDependencies)

jvmArgumentProviders.add(JavaagentTestArgumentsProvider(agentShadowJar, shadowJar.archiveFile.get().asFile))
jvmArgumentProviders.add(
JavaagentTestArgumentsProvider(
agentShadowJar,
shadowJar.archiveFile.get().asFile
)
)

// We do fine-grained filtering of the classpath of this codebase's sources since Gradle's
// configurations will include transitive dependencies as well, which tests do often need.
classpath = classpath.filter {
if (file(layout.buildDirectory.dir("resources/main")).equals(it) || file(layout.buildDirectory.dir("classes/java/main")).equals(it)) {
if (file(layout.buildDirectory.dir("resources/main")).equals(it) || file(
layout.buildDirectory.dir(
"classes/java/main"
)
).equals(it)
) {
// The sources are packaged into the testing jar, so we need to exclude them from the test
// classpath, which automatically inherits them, to ensure our shaded versions are used.
return@filter false
Expand Down

0 comments on commit 7a9b214

Please sign in to comment.