-
Couldn't load subscription status.
- Fork 1k
Bring in newer upstream Couchbase instrumentation to fix span kind #14995
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
83846d4
Update couchbase tests
trask c782f7b
Couchbase 3.4
trask 561228d
up
trask 5dc0d69
./gradlew spotlessApply
otelbot[bot] af55dd9
up
trask 7d88ac7
fossa
trask 68f1d26
cross test
trask 0c4e308
fix
trask 319f9a3
./gradlew spotlessApply
otelbot[bot] 8999bec
fix
trask 2534bda
fix
trask File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
instrumentation/couchbase/couchbase-3.4/javaagent/build.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| plugins { | ||
| id("otel.javaagent-instrumentation") | ||
| } | ||
|
|
||
| muzzle { | ||
| pass { | ||
| group.set("com.couchbase.client") | ||
| module.set("java-client") | ||
| versions.set("[3.4.0,)") | ||
| // these versions were released as ".bundle" instead of ".jar" | ||
| skip("2.7.5", "2.7.8") | ||
| assertInverse.set(true) | ||
| } | ||
| } | ||
|
|
||
| sourceSets { | ||
| main { | ||
| val shadedDep = project(":instrumentation:couchbase:couchbase-3.4:tracing-opentelemetry-shaded") | ||
| output.dir( | ||
| shadedDep.file("build/extracted/shadow"), | ||
| "builtBy" to ":instrumentation:couchbase:couchbase-3.4:tracing-opentelemetry-shaded:extractShadowJar", | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| compileOnly( | ||
| project( | ||
| path = ":instrumentation:couchbase:couchbase-3.4:tracing-opentelemetry-shaded", | ||
| configuration = "shadow", | ||
| ), | ||
| ) | ||
|
|
||
| library("com.couchbase.client:java-client:3.4.0") | ||
|
|
||
| testImplementation("org.testcontainers:testcontainers-couchbase") | ||
|
|
||
| testInstrumentation(project(":instrumentation:couchbase:couchbase-2.0:javaagent")) | ||
| testInstrumentation(project(":instrumentation:couchbase:couchbase-2.6:javaagent")) | ||
| testInstrumentation(project(":instrumentation:couchbase:couchbase-3.1:javaagent")) | ||
| // TODO testInstrumentation(project(":instrumentation:couchbase:couchbase-3.1.6:javaagent")) | ||
| testInstrumentation(project(":instrumentation:couchbase:couchbase-3.2:javaagent")) | ||
| } | ||
|
|
||
| tasks { | ||
| withType<Test>().configureEach { | ||
| systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) | ||
| usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) | ||
| } | ||
|
|
||
| val testStableSemconv by registering(Test::class) { | ||
| testClassesDirs = sourceSets.test.get().output.classesDirs | ||
| classpath = sourceSets.test.get().runtimeClasspath | ||
|
|
||
| jvmArgs("-Dotel.semconv-stability.opt-in=database") | ||
| } | ||
|
|
||
| check { | ||
| dependsOn(testStableSemconv) | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
...lemetry/javaagent/instrumentation/couchbase/v3_4/CouchbaseEnvironmentInstrumentation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.javaagent.instrumentation.couchbase.v3_4; | ||
|
|
||
| import static net.bytebuddy.matcher.ElementMatchers.isConstructor; | ||
| import static net.bytebuddy.matcher.ElementMatchers.named; | ||
|
|
||
| import com.couchbase.client.core.env.CoreEnvironment; | ||
| import io.opentelemetry.api.GlobalOpenTelemetry; | ||
| import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; | ||
| import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; | ||
| import io.opentelemetry.javaagent.instrumentation.couchbase.v3_4.shaded.com.couchbase.client.tracing.opentelemetry.OpenTelemetryRequestTracer; | ||
| import net.bytebuddy.asm.Advice; | ||
| import net.bytebuddy.description.type.TypeDescription; | ||
| import net.bytebuddy.matcher.ElementMatcher; | ||
|
|
||
| public class CouchbaseEnvironmentInstrumentation implements TypeInstrumentation { | ||
|
|
||
| @Override | ||
| public ElementMatcher<TypeDescription> typeMatcher() { | ||
| return named("com.couchbase.client.core.env.CoreEnvironment$Builder"); | ||
| } | ||
|
|
||
| @Override | ||
| public void transform(TypeTransformer transformer) { | ||
| transformer.applyAdviceToMethod( | ||
| isConstructor(), | ||
| CouchbaseEnvironmentInstrumentation.class.getName() + "$ConstructorAdvice"); | ||
| } | ||
|
|
||
| @SuppressWarnings("unused") | ||
| public static class ConstructorAdvice { | ||
|
|
||
| @Advice.OnMethodExit(suppress = Throwable.class) | ||
| public static void onExit(@Advice.This CoreEnvironment.Builder<?> builder) { | ||
| builder.requestTracer(OpenTelemetryRequestTracer.wrap(GlobalOpenTelemetry.get())); | ||
| } | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
...pentelemetry/javaagent/instrumentation/couchbase/v3_4/CouchbaseInstrumentationModule.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.javaagent.instrumentation.couchbase.v3_4; | ||
|
|
||
| import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; | ||
|
|
||
| import com.google.auto.service.AutoService; | ||
| import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; | ||
| import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; | ||
| import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import net.bytebuddy.matcher.ElementMatcher; | ||
|
|
||
| @AutoService(InstrumentationModule.class) | ||
| public class CouchbaseInstrumentationModule extends InstrumentationModule | ||
| implements ExperimentalInstrumentationModule { | ||
| public CouchbaseInstrumentationModule() { | ||
| super("couchbase", "couchbase-3.4"); | ||
| } | ||
|
|
||
| @Override | ||
| public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() { | ||
| // CoreTransactionRequest was introduced in 3.4.0 with integrated transactions support. | ||
| return hasClassesNamed( | ||
| "com.couchbase.client.core.transaction.components.CoreTransactionRequest"); | ||
| } | ||
|
|
||
| @Override | ||
| public List<TypeInstrumentation> typeInstrumentations() { | ||
| return Collections.singletonList(new CouchbaseEnvironmentInstrumentation()); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isIndyReady() { | ||
| return true; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is needed to be done for all of these TODOs in each gradle file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to find a class that exists in one of the versions that doesn't exist so we can scope the version better via muzzle