-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #293 from lostsnow/fix/grpc-tracing
fixes grpc tracing
- Loading branch information
Showing
14 changed files
with
100 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
...st/core/bytecode/enhance/plugin/framework/grpc/ServerStreamListenerImplAdviceAdapter.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...re/bytecode/enhance/plugin/framework/grpc/ServerStreamListenerImplStartAdviceAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.dongtai.iast.core.bytecode.enhance.plugin.framework.grpc; | ||
|
||
import io.dongtai.iast.core.bytecode.enhance.asm.AsmMethods; | ||
import io.dongtai.iast.core.bytecode.enhance.asm.AsmTypes; | ||
import io.dongtai.iast.core.utils.AsmUtils; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.commons.AdviceAdapter; | ||
|
||
public class ServerStreamListenerImplStartAdviceAdapter extends AdviceAdapter implements AsmTypes, AsmMethods { | ||
protected ServerStreamListenerImplStartAdviceAdapter(MethodVisitor methodVisitor, int access, String name, String descriptor) { | ||
super(AsmUtils.api, methodVisitor, access, name, descriptor); | ||
} | ||
|
||
@Override | ||
protected void onMethodEnter() { | ||
invokeStatic(ASM_TYPE_SPY_HANDLER, SPY_HANDLER$getDispatcher); | ||
invokeInterface(ASM_TYPE_SPY_DISPATCHER, SPY$startGrpcCall); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
dongtai-core/src/main/java/io/dongtai/iast/core/handler/context/TraceManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.dongtai.iast.core.handler.context; | ||
|
||
import java.lang.dongtai.TraceIdHandler; | ||
|
||
public class TraceManager implements TraceIdHandler { | ||
@Override | ||
public String getTraceKey() { | ||
return ContextManager.getHeaderKey(); | ||
} | ||
|
||
@Override | ||
public String getTraceId() { | ||
return ContextManager.getSegmentId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...src/main/java/io/dongtai/iast/core/handler/hookpoint/framework/grpc/GrpcTraceManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.dongtai.iast.core.handler.hookpoint.framework.grpc; | ||
|
||
import io.dongtai.iast.core.handler.context.TraceManager; | ||
|
||
public class GrpcTraceManager extends TraceManager { | ||
@Override | ||
public String getTraceId() { | ||
String traceId = super.getTraceId(); | ||
GrpcHandler.setSharedTraceId(traceId); | ||
return traceId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
dongtai-plugins/dongtai-grpc/src/main/java/io/dongtai/plugin/GrpcProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
dongtai-spy/src/main/java/java/lang/dongtai/TraceIdHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package java.lang.dongtai; | ||
|
||
public interface TraceIdHandler { | ||
String getTraceKey(); | ||
String getTraceId(); | ||
} |