Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c911faa
lambda
SylvainJuge Jan 20, 2025
26e79f9
inject proxies for indy
SylvainJuge Jan 20, 2025
7f3ae3b
kotlinx + integration tests
SylvainJuge Jan 21, 2025
9183992
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Jan 21, 2025
29c99dd
inject missing classes for indy
SylvainJuge Jan 21, 2025
45ead47
do not inject proxies for lambda
SylvainJuge Jan 21, 2025
ba30ba8
move back comment in the expected location
SylvainJuge Jan 21, 2025
eb945b8
remove duplication
SylvainJuge Jan 22, 2025
eba7e20
add jpms compatible class file transformer
SylvainJuge Jan 22, 2025
7a1cbc7
remove lambda java9 module
SylvainJuge Jan 22, 2025
590f86e
fix pebkc
SylvainJuge Jan 22, 2025
a8cbb24
fix lambda instrumentation, must not redefine them
SylvainJuge Jan 22, 2025
403caaa
fix javadoc
SylvainJuge Jan 22, 2025
506cc62
fix things again
SylvainJuge Jan 22, 2025
da1c13d
fix it again
SylvainJuge Jan 22, 2025
c4350d0
make the comments a bit better
SylvainJuge Jan 23, 2025
1d54a14
fix typo
SylvainJuge Jan 23, 2025
03aa810
avoid injecting classes for kotlinxcoroutines
SylvainJuge Jan 24, 2025
2ed4e96
remove commented code
SylvainJuge Jan 24, 2025
77a4f00
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Jan 27, 2025
d9cd13f
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Jan 29, 2025
5e2ef89
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Jan 30, 2025
20856e3
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Jan 31, 2025
a38763f
revert commented code that was there for a reason
SylvainJuge Jan 31, 2025
b77428c
add LambdaTransformer interface + rename things
SylvainJuge Jan 31, 2025
bc785b9
fix typos and comments
SylvainJuge Jan 31, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
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 io.opentelemetry.javaagent.extension.instrumentation.internal.injection.ClassInjector;
import io.opentelemetry.javaagent.extension.instrumentation.internal.injection.InjectionMode;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import java.util.ArrayList;
import java.util.List;
import net.bytebuddy.utility.JavaModule;

@AutoService(InstrumentationModule.class)
public class LambdaInstrumentationModule extends InstrumentationModule {
public class LambdaInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {
public LambdaInstrumentationModule() {
super("internal-lambda");
}
Expand All @@ -28,8 +32,17 @@ public boolean defaultEnabled(ConfigProperties config) {
}

@Override
public boolean isIndyModule() {
return false;
public void injectClasses(ClassInjector injector) {
injector
.proxyBuilder(
"io.opentelemetry.javaagent.instrumentation.internal.lambda.LambdaTransformer")
.inject(InjectionMode.CLASS_ONLY);
if (JavaModule.isSupported()) {
injector
.proxyBuilder(
"io.opentelemetry.javaagent.instrumentation.internal.lambda.Java9LambdaTransformer")
.inject(InjectionMode.CLASS_ONLY);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
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.Arrays;
import java.util.List;
import net.bytebuddy.matcher.ElementMatcher;

/** Instrumentation for methods annotated with {@code WithSpan} annotation. */
@AutoService(InstrumentationModule.class)
public class AnnotationInstrumentationModule extends InstrumentationModule {
public class AnnotationInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

public AnnotationInstrumentationModule() {
super(
Expand All @@ -26,12 +29,6 @@ public AnnotationInstrumentationModule() {
"opentelemetry-instrumentation-annotations");
}

@Override
public boolean isIndyModule() {
// needs helper classes in the same class loader
return false;
}

@Override
public int order() {
// Run first to ensure other automatic instrumentation is added after and therefore is executed
Expand All @@ -50,4 +47,13 @@ public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new WithSpanInstrumentation());
}

@Override
public List<String> injectedClassNames() {
return Arrays.asList(
"io.opentelemetry.javaagent.instrumentation.kotlinxcoroutines.instrumentationannotations.AnnotationSingletons",
"io.opentelemetry.javaagent.instrumentation.kotlinxcoroutines.instrumentationannotations.AnnotationInstrumentationHelper",
"io.opentelemetry.javaagent.instrumentation.kotlinxcoroutines.instrumentationannotations.MethodRequest",
"io.opentelemetry.javaagent.instrumentation.kotlinxcoroutines.instrumentationannotations.MethodRequestCodeAttributesGetter");
}
}
2 changes: 0 additions & 2 deletions testing-common/integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@ tasks {
includeTestsMatching("InstrumentOldBytecode")
}
include("**/InstrumentOldBytecode.*")
jvmArgs("-Dotel.instrumentation.inline-ibm-resource-level.enabled=false")
}

val testInlineModuleOldBytecodeInstrumentation by registering(Test::class) {
filter {
includeTestsMatching("InstrumentOldBytecode")
}
include("**/InstrumentOldBytecode.*")
jvmArgs("-Dotel.instrumentation.indy-ibm-resource-level.enabled=false")
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import java.util.List;

@AutoService(InstrumentationModule.class)
public class InlineIbmResourceLevelInstrumentationModule extends InstrumentationModule {
public InlineIbmResourceLevelInstrumentationModule() {
super("inline-ibm-resource-level");
public class IbmResourceLevelInstrumentationModule extends InstrumentationModule {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[for reviewer] there is no need to maintain an inline and indy variants of this instrumentation, so we only need one that is compatible with both.

public IbmResourceLevelInstrumentationModule() {
super("ibm-resource-level");
}

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new InlineResourceLevelInstrumentation());
return singletonList(new ResourceLevelInstrumentation());
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;

public class IndyResourceLevelInstrumentation implements TypeInstrumentation {
public class ResourceLevelInstrumentation implements TypeInstrumentation {
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return named("com.ibm.as400.resource.ResourceLevel");
Expand All @@ -25,7 +25,7 @@ public void transform(TypeTransformer transformer) {

@SuppressWarnings("unused")
public static class ToStringAdvice {
@Advice.OnMethodExit(suppress = Throwable.class, inline = false)
@Advice.OnMethodExit(suppress = Throwable.class)
@Advice.AssignReturned.ToReturned
public static String toStringReplace() {
return "instrumented";
Expand Down
Loading