Skip to content

Support Hessian 4.0.x.#2644

Closed
wayilau wants to merge 47 commits into
apache:masterfrom
wayilau:feature2
Closed

Support Hessian 4.0.x.#2644
wayilau wants to merge 47 commits into
apache:masterfrom
wayilau:feature2

Conversation

@wayilau

@wayilau wayilau commented May 10, 2019

Copy link
Copy Markdown
Member

Please answer these questions before submitting pull request

  • Why submit this pull request?
  • Bug fix
  • New feature provided
  • Improve performance

Plugin Support hessian 4.0.x.

@wu-sheng

Copy link
Copy Markdown
Member

You need to submit test case to here https://github.com/SkyAPMTest/agent-auto-integration-testcases

You could find the document there too.

@wu-sheng wu-sheng added agent Language agent related. feature New feature plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor. TBD To be decided later, need more discussion or input. labels May 10, 2019
@wayilau

wayilau commented May 10, 2019

Copy link
Copy Markdown
Member Author

You need to submit test case to here https://github.com/SkyAPMTest/agent-auto-integration-testcases

You could find the document there too.
ok, i will do this follow the document .

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.0008%) to 16.423% when pulling b9665682c3a2df8b2897fae1198a87eb17f1f53d on wayilau:feature2 into 118485f on apache:master.

@coveralls

coveralls commented May 10, 2019

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.2%) to 17.1% when pulling fcf7b3716fed898c6c6bfebb8e2418a3baaab1b5 on wayilau:feature2 into 4f89ea2 on apache:master.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ExitSpan isn't been created all the time, but stopspan is always.
Here maybe some logical problems

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,thanks for your review. i will check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@wu-sheng

Copy link
Copy Markdown
Member

Please resolve the conflict, the shardingsphere plugin just got merged.

@wu-sheng

Copy link
Copy Markdown
Member

Be advised, RESTEasy plugin merged, conflict needs to be solved.

@wu-sheng

Copy link
Copy Markdown
Member

Also, as an RPC framework, Hessian logo is required in UI. Take apache/skywalking-rocketbot-ui#113 as an example.

@wayilau

wayilau commented May 28, 2019

Copy link
Copy Markdown
Member Author

Also, as an RPC framework, Hessian logo is required in UI. Take apache/skywalking-rocketbot-ui#113 as an example.

I will add this after i finished the tests.

@wayilau

wayilau commented Jun 3, 2019

Copy link
Copy Markdown
Member Author

@wu-sheng I have add an Instrumentation, but it doesn't works for me, also I can not debug into the Instrmentation when the agent start. so I could not get expected data when i was taking the skyapm tests. do I make some config mistakes ?

@wu-sheng

wu-sheng commented Jun 3, 2019

Copy link
Copy Markdown
Member

I don't know, the codes look like normal. Does other plugin work? Agent could be tested, read blog, http://skywalking.apache.org/zh/blog/2019-01-24-skywalking-remote-debug.html (CN) and learn remote debug.

@wayilau

wayilau commented Jun 3, 2019

Copy link
Copy Markdown
Member Author

I don't know, the codes look like normal. Does other plugin work? Agent could be tested, read blog, http://skywalking.apache.org/zh/blog/2019-01-24-skywalking-remote-debug.html (CN) and learn remote debug.
I provide 3 instrumentation,the other two works fine. I am finding the reason. the agent Transform the class when it is loading. also this class i intercept is loading, but just not work for me.

@wu-sheng

wu-sheng commented Jun 3, 2019

Copy link
Copy Markdown
Member

I provide 3 instrumentation,the other two works fine. I am finding the reason. the agent Transform the class when it is loading. also this class i intercept is loading, but just not work for me.

There is no special case for instrumentation.

@wayilau wayilau closed this Jun 21, 2019
@wayilau wayilau reopened this Jun 21, 2019
@wayilau

wayilau commented Jun 21, 2019

Copy link
Copy Markdown
Member Author

@wu-sheng why this builds fails, it tells me that other pkg's class is not allowed.

@kezhenxu94

kezhenxu94 commented Jun 22, 2019

Copy link
Copy Markdown
Member

@wu-sheng why this builds fails, it tells me that other pkg's class is not allowed.

Yes, importing third parties' class will break the agent when there is no such class in the target application, see #2871 and #2908 , and never try to use full qualified class names to work around the failure, use string literature if needed

@asfgit

asfgit commented Jun 23, 2019

Copy link
Copy Markdown

FAILURE

@asfgit

asfgit commented Jun 23, 2019

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/skywalking-e2e/16/

@wayilau

wayilau commented Jul 22, 2019

Copy link
Copy Markdown
Member Author

@kezhenxu94 Thanks for many useful suggestions. I have fixed this.

@kezhenxu94 kezhenxu94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wayilau , I noticed that you are instrumenting class org.springframework.remoting.caucho.HessianServiceExporter, which is not part of hessian core, and we cannot assume that the users use hessian with Spring framework always; actually hessian can be used in plain Java application like what I did based on your agent test code:

  • add Jetty dependency:
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
            <version>6.1.26</version>
        </dependency>
  • make your HelloServiceImpl extends HessianServlet:

  • modify the main method of the HessianServer:

@SpringBootApplication
public class HessianServer
{

    @Autowired
    private HelloService helloService = new HelloServiceImpl();

    public static void main( String[] args ) throws Exception {
        final Server server = new Server(9099);
        final Context context = new Context(server, "/", Context.SESSIONS);
        context.addServlet(HelloServiceImpl.class, "/HelloService");
        server.start();
    }

    @Bean(name="/HelloService")
    public HessianServiceExporter getExporter() {
        HessianServiceExporter exporter = new HessianServiceExporter();
        exporter.setServiceInterface(HelloService.class);
        exporter.setService(helloService);
        return exporter;
    }

}

we don't need all the annotations from Spring, but I'm lazy to remove :)

  • run the server as well as client

And the traces would break like this:

image

I have no experience with this case and I'm not sure whether this is acceptable, @wu-sheng WDYT

@wu-sheng

Copy link
Copy Markdown
Member

I am not a hession user, too. But org.springframework.remoting.caucho.HessianServiceExporter looks like not right indeed. @wayilau Why do you need to choose a Spring framework class? For most Spring components, they are just bridges, a hession-core level instrumentation should be enough. But if there is an exception, please make it clear to us.

Basically, I think @kezhenxu94 get the point, it should work w/ and w/o Spring both like other plugins did.

@wayilau

wayilau commented Jul 23, 2019

Copy link
Copy Markdown
Member Author

I am not a hession user, too. But org.springframework.remoting.caucho.HessianServiceExporter looks like not right indeed. @wayilau Why do you need to choose a Spring framework class? For most Spring components, they are just bridges, a hession-core level instrumentation should be enough. But if there is an exception, please make it clear to us.

Basically, I think @kezhenxu94 get the point, it should work w/ and w/o Spring both like other plugins did.

@wu-sheng @kezhenxu94
Yes , I give an spring instrumentation, because last month I give the patch, but the tag is the class name in the server side. you tell me that tags name misunderstood so I supplied a flag when true use the url tag, use class name when it is false. I can not get the url, so use the hessianserviceexporter, as @kezhenxu94 said hessian may use in nomal java application, but they all use Servlet, i think so. what 's you idea ?

@wayilau

wayilau commented Jul 23, 2019

Copy link
Copy Markdown
Member Author

I am not a hession user, too. But org.springframework.remoting.caucho.HessianServiceExporter looks like not right indeed. @wayilau Why do you need to choose a Spring framework class? For most Spring components, they are just bridges, a hession-core level instrumentation should be enough. But if there is an exception, please make it clear to us.
Basically, I think @kezhenxu94 get the point, it should work w/ and w/o Spring both like other plugins did.

@wu-sheng @kezhenxu94
Yes , I give an spring instrumentation, because last month I give the patch, but the tag is the class name in the server side. you tell me that tags name misunderstood so I supplied a flag when true use the url tag, use class name when it is false. I can not get the url, so use the hessianserviceexporter, as @kezhenxu94 said hessian may use in nomal java application, but they all use Servlet, i think so. what 's you idea ?

I shoud add an instrumentation for HessianServlet ? am i right ? @kezhenxu94
In springboot it doesn't use HessianServlet, it just uses HessianServiceExporter. so I give two instrumentation, it is enough?

@kezhenxu94

kezhenxu94 commented Jul 23, 2019

Copy link
Copy Markdown
Member

I shoud add an instrumentation for HessianServlet ? am i right ? @kezhenxu94
In springboot it doesn't use HessianServlet, it just uses HessianServiceExporter. so I give two instrumentation, it is enough?

Spring doesn't use HessianServlet indeed, but it uses HessianSkeleton (org.springframework.remoting.caucho.HessianExporter#doInvoke), HessianServlet also uses HessianSkeleton (com.caucho.hessian.server.HessianServlet#invoke), and it seems that you have already instrumented HessianSkeleton, so perhaps you can instrument HessianSkeleton and use SkyWalking dynamic field (or something similar) to keep the url (if any) in one request through the instrumented classes.

To summarize, I think class HessianSkeleton is the core of hessian, which should be used by any other frameworks that integrate with hessian, such as Spring, and instrumenting it should work with/wihout third-party frameworks

@wayilau

wayilau commented Jul 24, 2019

Copy link
Copy Markdown
Member Author

I shoud add an instrumentation for HessianServlet ? am i right ? @kezhenxu94
In springboot it doesn't use HessianServlet, it just uses HessianServiceExporter. so I give two instrumentation, it is enough?

Spring doesn't use HessianServlet indeed, but it uses HessianSkeleton (org.springframework.remoting.caucho.HessianExporter#doInvoke), HessianServlet also uses HessianSkeleton (com.caucho.hessian.server.HessianServlet#invoke), and it seems that you have already instrumented HessianSkeleton, so perhaps you can instrument HessianSkeleton and use SkyWalking dynamic field (or something similar) to keep the url (if any) in one request through the instrumented classes.

To summarize, I think class HessianSkeleton is the core of hessian, which should be used by any other frameworks that integrate with hessian, such as Spring, and instrumenting it should work with/wihout third-party frameworks

Yes, you are right. I will have a try to get the url from the HessianSkeleton and remove the spring's instrumentation.

@wayilau

wayilau commented Jul 25, 2019

Copy link
Copy Markdown
Member Author

@kezhenxu94 @wu-sheng
I think it's hard to get url from HessianSkeleton. In HessianSkeleton i only can get the api class. If i want get url, i should send it in the stream from client side, and get it from the inputstream in server side. that's not an easy thing.

@wu-sheng

Copy link
Copy Markdown
Member

I think it's hard to get url from HessianSkeleton. In HessianSkeleton i only can get the api class. If i want get url, i should send it in the stream from client side, and get it from the inputstream in server side. that's not an easy thing.

This is server side instrumentation, right? Why send from client side? That header should not be added.

@wayilau

wayilau commented Jul 25, 2019

Copy link
Copy Markdown
Member Author

I think it's hard to get url from HessianSkeleton. In HessianSkeleton i only can get the api class. If i want get url, i should send it in the stream from client side, and get it from the inputstream in server side. that's not an easy thing.

This is server side instrumentation, right? Why send from client side? That header should not be added.

Yes, HessianSkeleton is an instrumentation. in HessianSkeleton it only read or write data from stream.
Header value is in HessianServlet or HessianServiceExporter, the are the library out of hessian.

@wu-sheng

Copy link
Copy Markdown
Member

Yes, HessianSkeleton is an instrumentation. in HessianSkeleton it only read or write data from stream.
Header value is in HessianServlet or HessianServiceExporter, the are the library out of hessian.

Are you saying the data in HessianSkeleton is only binary and not encoded yet? If so, don't instrument there.


<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lomhok has been added at root.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

@wayilau

wayilau commented Jul 31, 2019

Copy link
Copy Markdown
Member Author

@kezhenxu94 Do you have any time to review this pr ? i have removed the spring's instrumentation.

@kezhenxu94

Copy link
Copy Markdown
Member

@kezhenxu94 Do you have any time to review this pr ? i have removed the spring's instrumentation.

@wayilau Did you test what I mentioned in #2644 (review) ? Seems that the trace still breaks, what's worse, the topology becomes uninterpretable

image

@kezhenxu94

Copy link
Copy Markdown
Member

Forget to attach the topology screenshot
image

@wayilau

wayilau commented Aug 1, 2019

Copy link
Copy Markdown
Member Author

@kezhenxu94 Do you have any time to review this pr ? i have removed the spring's instrumentation.

@wayilau Did you test what I mentioned in #2644 (review) ? Seems that the trace still breaks, what's worse, the topology becomes uninterpretable

image

sorry, i didn't do that, i will test this follow your code.

@wu-sheng wu-sheng added the no update The owner doesn't provide further feedback. label Aug 6, 2019
@wayilau

wayilau commented Aug 8, 2019

Copy link
Copy Markdown
Member Author

I close this first. i will reopen when i finish this.

@wayilau wayilau closed this Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Language agent related. feature New feature no update The owner doesn't provide further feedback. plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants