Skip to content

Commit

Permalink
Enable instrumentation of Spring EJB clients (#11104)
Browse files Browse the repository at this point in the history
Co-authored-by: Lauri Tulmin <[email protected]>
  • Loading branch information
zackman0010 and laurit authored May 10, 2024
1 parent ebc38b4 commit 48d4c13
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 183 deletions.
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.

Loading

0 comments on commit 48d4c13

Please sign in to comment.