Skip to content
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
11 changes: 11 additions & 0 deletions docs/instrumentation-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4505,6 +4505,11 @@ libraries:
type: LONG
guava:
- name: guava-10.0
description: |
This instrumentation enables context propagation for Guava ListenableFuture, it does not emit any telemetry on its own.
library_link: https://github.com/google/guava
features:
- CONTEXT_PROPAGATION
source_path: instrumentation/guava-10.0
scope:
name: io.opentelemetry.guava-10.0
Expand All @@ -4513,6 +4518,12 @@ libraries:
- com.google.guava:guava:[10.0,]
library:
- com.google.guava:guava:10.0
configurations:
- name: otel.instrumentation.guava.experimental-span-attributes
description: Enables experimental span attribute `guava.canceled` for cancelled
operations.
type: boolean
default: false
gwt:
- name: gwt-2.0
display_name: GWT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ protected final InstrumentationExtension testing() {
return testing;
}

protected boolean isExperimentalSpanAttributesEnabled() {
return true;
}

@Test
void success() {
AbstractTraced<T, U> traced = newTraced();
Expand Down Expand Up @@ -92,7 +96,10 @@ void canceled() {

List<AttributeAssertion> attributeAssertions =
codeFunctionAssertions(traced.getClass(), "completable");
attributeAssertions.add(equalTo(booleanKey(canceledKey()), true));

if (isExperimentalSpanAttributesEnabled()) {
attributeAssertions.add(equalTo(booleanKey(canceledKey()), true));
}

testing.waitAndAssertTraces(
trace ->
Expand Down
14 changes: 8 additions & 6 deletions instrumentation/guava-10.0/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ muzzle {
}
}

tasks.withType<Test>().configureEach {
// TODO run tests both with and without experimental span attributes
jvmArgs("-Dotel.instrumentation.guava.experimental-span-attributes=true")
}

dependencies {
bootstrap(project(":instrumentation:executors:bootstrap"))

Expand Down Expand Up @@ -47,7 +42,14 @@ tasks {
jvmArgs("-Dotel.semconv-stability.opt-in=code/dup")
}

val testExperimental by registering(Test::class) {
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath

jvmArgs("-Dotel.instrumentation.guava.experimental-span-attributes=true")
}

check {
dependsOn(testStableSemconv, testBothSemconv)
dependsOn(testStableSemconv, testBothSemconv, testExperimental)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
abstract class BaseGuavaWithSpanTest
extends AbstractWithSpanTest<SettableFuture<String>, ListenableFuture<String>> {

static final boolean isExperimentalEnabled =
Boolean.getBoolean("otel.instrumentation.guava.experimental-span-attributes");

@Override
protected void complete(SettableFuture<String> future, String value) {
future.set(value);
Expand Down Expand Up @@ -43,4 +46,9 @@ protected Throwable unwrapError(Throwable t) {
protected String canceledKey() {
return "guava.canceled";
}

@Override
protected boolean isExperimentalSpanAttributesEnabled() {
return isExperimentalEnabled;
}
}
11 changes: 11 additions & 0 deletions instrumentation/guava-10.0/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: >
This instrumentation enables context propagation for Guava ListenableFuture, it does not emit
any telemetry on its own.
features:
- CONTEXT_PROPAGATION
library_link: https://github.com/google/guava
configurations:
- name: otel.instrumentation.guava.experimental-span-attributes
description: Enables experimental span attribute `guava.canceled` for cancelled operations.
type: boolean
default: false
Loading