-
Notifications
You must be signed in to change notification settings - Fork 896
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
Add thrift javaagent instrumentation #8370
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tkyun123,
Is this PR ready for review? Or perhaps did you want to open a draft PR?
@@ -71,7 +71,7 @@ tasks.withType<JavaCompile>().configureEach { | |||
"-Xlint:-options", | |||
|
|||
// Fail build on any warning | |||
"-Werror" | |||
// "-Werror" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's several "debug" changed in this PR you'll need to revert before it actually can receive approval; this is one of them.
settings.gradle.kts
Outdated
@@ -509,7 +509,7 @@ hideFromDependabot(":instrumentation:vibur-dbcp-11.0:javaagent") | |||
hideFromDependabot(":instrumentation:vibur-dbcp-11.0:library") | |||
hideFromDependabot(":instrumentation:vibur-dbcp-11.0:testing") | |||
hideFromDependabot(":instrumentation:wicket-8.0:javaagent") | |||
|
|||
hideFromDependabot(":instrumentation:thrift:javaagent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention, we put the minimum supported library version in the module name; in case of thrift it should be :instrumentation:thrift-0.14:javaagent
} | ||
|
||
dependencies { | ||
implementation("org.apache.thrift:libthrift:0.14.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implementation
will result in the library being included inside the javaagent, which probably is not what you're aiming for. You can use library
instead (our own "syntactic sugar" configuration that's equivalent to compileOnly
):
implementation("org.apache.thrift:libthrift:0.14.1") | |
library("org.apache.thrift:libthrift:0.14.1") |
thank for your advice,I will check and revert my debug changes,now this PR is not ready yet,I still need some time to finish all the test cases |
tests completed,please review |
closing and reopening to trigger checks |
@tkyun123 the first thing you should work on is to get the build passing |
build.gradle.kts
Outdated
@@ -98,3 +98,17 @@ if (gradle.startParameter.taskNames.any { it.equals("listTestsInPartition") }) { | |||
} | |||
} | |||
} | |||
|
|||
allprojects { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove this
import org.apache.thrift.protocol.TProtocolDecorator; | ||
|
||
public abstract class AbstractProtocolWrapper extends TProtocolDecorator { | ||
public static final String OIJ_THRIFT_FIELD_NAME = "OIJ_FIELD_NAME"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem to be used anywhere
|
||
public abstract class AbstractProtocolWrapper extends TProtocolDecorator { | ||
public static final String OIJ_THRIFT_FIELD_NAME = "OIJ_FIELD_NAME"; | ||
public static final short OIJ_THRIFT_FIELD_ID = 3333; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OIJ_THRIFT_FIELD_ID
is a weird name , what does OIJ
stand for? I assume that this is the id for the field that you use for context propagation? If so it would be nice to have a comment. Also would it make sense to use a larger number than 3333
? Would that reduce the risk of colliding with an existing field? Would it make sense to make this configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Make it configurable with a default value
May make sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Make it configurable with a default value
May make sense
public static final String OIJ_THRIFT_FIELD_NAME = "OIJ_FIELD_NAME"; | ||
public static final short OIJ_THRIFT_FIELD_ID = 3333; | ||
|
||
public AbstractProtocolWrapper(TProtocol protocol) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this class have any other purpose besides containing OIJ_THRIFT_FIELD_ID
field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No,just for containing this field
import org.apache.thrift.protocol.TMessage; | ||
import org.apache.thrift.protocol.TProtocol; | ||
|
||
@SuppressWarnings({"serial"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this @SuppressWarnings
needed, this class does not seem to be serializable?
@opentelemetrybot update |
@opentelemetrybot help |
Available commands:
|
@opentelemetrybot update |
ah, it looks like our automation doesn't work when the PR is from a branch named @tkyun123 can you merge |
Merge Main
I am sorry for the late reply. Now I have mergd main into my PR |
@Override | ||
public void transform(TypeTransformer transformer) { | ||
transformer.applyAdviceToMethod( | ||
isMethod().and(named("sendBase")).and(isProtected()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible that the sendbase method is public, should we remove this rule?
transformer.applyAdviceToMethod( | ||
isMethod().and(named("receiveBase")), | ||
ThriftClientInstrumentation.class.getName() + "$ClientReceiveAdvice"); | ||
transformer.applyAdviceToMethod( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two constructors for TServiceClient. One of them takes two arguments
return readFieldBegin(); | ||
} | ||
context = serverInstrumenter().start(clientContext, request); | ||
serverInstrumenter().end(context, request, 0, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is redundant
Where is this PR at? |
Fix: #1573
For personal needs, I'm trying to trace my thrift application, and I finally Implemented a general thrift javaagent instrumentation , I'd like to share with those who hava same need.
I hava completed javaagent part, and I will complete tests within the next few weeks