Skip to content

Commit c54f287

Browse files
committed
Add support gRPC 1.60.x and 1.70.x server interceptor trace
1 parent eec4132 commit c54f287

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
</properties>
3636

3737
<dependencies>
38+
<!-- https://mvnrepository.com/artifact/io.grpc/grpc-all -->
3839
<dependency>
3940
<groupId>io.grpc</groupId>
4041
<artifactId>grpc-all</artifactId>
41-
<version>${grpc-all.version}</version>
42+
<version>1.73.0</version>
4243
<scope>provided</scope>
4344
</dependency>
4445
</dependencies>

apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/define/AbstractServerImplBuilderInstrumentation.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@
2424
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
2525
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
2626
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
27+
import org.apache.skywalking.apm.agent.core.plugin.match.MultiClassNameMatch;
2728

2829
import static net.bytebuddy.matcher.ElementMatchers.named;
2930
import static net.bytebuddy.matcher.ElementMatchers.takesNoArguments;
30-
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
3131

3232
public class AbstractServerImplBuilderInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
3333

34-
public static final String ENHANCE_CLASS = "io.grpc.internal.AbstractServerImplBuilder";
35-
public static final String ENHANCE_METHOD = "build";
36-
public static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.grpc.v1.server.AbstractServerImplBuilderInterceptor";
37-
3834
@Override
3935
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
4036
return new ConstructorInterceptPoint[0];
@@ -46,12 +42,12 @@ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
4642
new InstanceMethodsInterceptPoint() {
4743
@Override
4844
public ElementMatcher<MethodDescription> getMethodsMatcher() {
49-
return named(ENHANCE_METHOD).and(takesNoArguments());
45+
return named("build").and(takesNoArguments());
5046
}
5147

5248
@Override
5349
public String getMethodsInterceptor() {
54-
return INTERCEPT_CLASS;
50+
return "org.apache.skywalking.apm.plugin.grpc.v1.server.AbstractServerImplBuilderInterceptor";
5551
}
5652

5753
@Override
@@ -64,6 +60,9 @@ public boolean isOverrideArgs() {
6460

6561
@Override
6662
protected ClassMatch enhanceClass() {
67-
return byName(ENHANCE_CLASS);
63+
return MultiClassNameMatch.byMultiClassMatch(
64+
"io.grpc.internal.AbstractServerImplBuilder",
65+
"io.grpc.internal.ServerImplBuilder",
66+
"io.grpc.internal.ForwardingServerBuilder");
6867
}
6968
}

0 commit comments

Comments
 (0)