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

Enable instrumentation of Spring EJB clients #11104

Merged
merged 9 commits into from
May 10, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ dependencies {
library("org.springframework:spring-context:4.0.0.RELEASE")
library("org.springframework:spring-aop:4.0.0.RELEASE")
testLibrary("org.springframework.boot:spring-boot:1.1.0.RELEASE")
testImplementation("org.apache.tomee:openejb-core:8.0.16")
testImplementation("org.apache.tomee:openejb-ejbd:8.0.16")
testImplementation("org.apache.tomee:openejb-client:8.0.16")

// rmi remoting was removed in spring 6
latestDepTestLibrary("org.springframework:spring-context:5.+") // documented limitation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.spring.rmi.v4_0;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.ignore.IgnoredTypesBuilder;
import io.opentelemetry.javaagent.extension.ignore.IgnoredTypesConfigurer;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;

@AutoService(IgnoredTypesConfigurer.class)
public class SpringRmiIgnoredTypesConfigurer implements IgnoredTypesConfigurer {

@Override
public void configure(IgnoredTypesBuilder builder, ConfigProperties config) {
// The Spring EJB classes are ignored in the AdditionalLibraryIgnoredTypesConfigurer, but
// are required when utilizing Spring's local-slsb and remote-slsb to access EJBs through RMI.
builder.allowClass("org.springframework.ejb.access.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.spring.rmi.v4_0.client;

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass;
import static io.opentelemetry.javaagent.instrumentation.spring.rmi.v4_0.SpringRmiSingletons.clientInstrumenter;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.named;
Expand All @@ -25,7 +26,8 @@ public class ClientInstrumentation implements TypeInstrumentation {

@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return named("org.springframework.remoting.rmi.RmiClientInterceptor");
return named("org.springframework.remoting.rmi.RmiClientInterceptor")
.or(extendsClass(named("org.springframework.ejb.access.AbstractSlsbInvokerInterceptor")));
}

@Override
Expand Down

This file was deleted.