You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/02/05 10:42:13 UTC

[GitHub] [skywalking] libinglong opened a new pull request #6330: add debug info when type not match in instrumentation process

libinglong opened a new pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330


   <!--
       ⚠️ Please make sure to read this template first, pull requests that don't accord with this template
       maybe closed without notice.
       Texts surrounded by `<` and `>` are meant to be replaced by you, e.g. <framework name>, <issue number>.
       Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
   -->
   
   <!-- ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👇 ====
   ### Fix <bug description or the bug issue number or bug issue link>
   - [ ] Add a unit test to verify that the fix works.
   - [ ] Explain briefly why the bug exists and how to fix it.
        ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👆 ==== -->
   
   <!-- ==== 🔌 Remove this line WHEN AND ONLY WHEN you're adding a new plugin, follow the checklist 👇 ====
   ### Add an agent plugin to support <framework name>
   - [ ] Add a test case for the new plugin, refer to [the doc](https://github.com/apache/skywalking/blob/master/docs/en/guides/Plugin-test.md)
   - [ ] Add a component id in [the component-libraries.yml](https://github.com/apache/skywalking/blob/master/oap-server/server-bootstrap/src/main/resources/component-libraries.yml)
   - [ ] Add a logo in [the UI repo](https://github.com/apache/skywalking-rocketbot-ui/tree/master/src/views/components/topology/assets)
        ==== 🔌 Remove this line WHEN AND ONLY WHEN you're adding a new plugin, follow the checklist 👆 ==== -->
   
   <!-- ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👇 ====
   ### Improve the performance of <class or module or ...>
   - [ ] Add a benchmark for the improvement, refer to [the existing ones](https://github.com/apache/skywalking/blob/master/apm-commons/apm-datacarrier/src/test/java/org/apache/skywalking/apm/commons/datacarrier/LinkedArrayBenchmark.java)
   - [ ] The benchmark result.
   ```text
   <Paste the benchmark results here>
   ```
   - [ ] Links/URLs to the theory proof or discussion articles/blogs. <links/URLs here>
        ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👆 ==== -->
   
   
   ### <Feature description>
   - [x] If this is non-trivial feature, paste the links/URLs to the design doc.
   - [x] Update the documentation to include this new feature.
   - [x] Tests(including UT, IT, E2E) are added to verify the new feature.
   - [x] If it's UI related, attach the screenshots below.
   
   
   - [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #<issue number>.
   - [x] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/CHANGES.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng closed pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng closed pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] libinglong commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
libinglong commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774044921


   I know where I was wrong.
   I should requset a more valuable pr, add this log in passing.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774028761


   > > Principle, we should not add log for helping developing. The logs are for product env debug only.
   > 
   > I still do not think the log is just for product env. It's a worth as long as it can help any people resolve their problems and save their time. :) And I think adding logs here is cheap.
   
   Then a project has to face countless PR to add logs, because any line of codes could have potential risk, people could ask to log out anything. Then your system breaks.
   All internal systems are being added logs randomly, one way, it is a bad thing, and also, you only face limited developers, so damages are controllable. But in the open source, especially like SkyWalking, we have 400+ code contributors, and more in potential. We cant afford to argue with every one, this log is acceptable, and others are not.
   The easy, clear, and affordable principle could be only, you will need this in the runtime, or are facing the requirements.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] libinglong edited a comment on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
libinglong edited a comment on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774025150


   > Principle, we should not add log for helping developing. The logs are for product env debug only.
   
   I still do not think the log is just for product env. It's a worth as long as it can help any people resolve their problems and save their time. :)  And I think adding logs here is cheap.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] libinglong commented on a change in pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
libinglong commented on a change in pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#discussion_r570958734



##########
File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/match/ProtectiveShieldMatcher.java
##########
@@ -44,7 +44,11 @@ public ProtectiveShieldMatcher(ElementMatcher<? super T> matcher) {
     @Override
     public boolean matches(T target) {
         try {
-            return this.matcher.matches(target);
+            boolean match = this.matcher.matches(target);
+            if (LOGGER.isDebugEnable()) {
+                LOGGER.debug("type={}, match={}", target, match);
+            }
+            return match;

Review comment:
       People usually do not see log line by line. They search.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] libinglong commented on a change in pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
libinglong commented on a change in pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#discussion_r570933857



##########
File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/match/ProtectiveShieldMatcher.java
##########
@@ -44,7 +44,11 @@ public ProtectiveShieldMatcher(ElementMatcher<? super T> matcher) {
     @Override
     public boolean matches(T target) {
         try {
-            return this.matcher.matches(target);
+            boolean match = this.matcher.matches(target);
+            if (LOGGER.isDebugEnable()) {
+                LOGGER.debug("type={}, match={}", target, match);
+            }
+            return match;

Review comment:
       We can only log when match is false.
   
   In some scene, the result of match is not as we think. 
   Let's see the paragraph in https://github.com/apache/skywalking-website/pull/209/files#
   > Now we should decide how to do this. You can use the RunnableWrapper in the maven artifact org.apache.skywalking:apm-toolkit-trace to wrap the param, but you will face another problem. This RunnableWrapper has a plugin whose active condition is checking if there is @TraceCrossThread. Byte buddy in
   skywalking will use net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to find the annotations of a class. The LazyTypeDescription finds annotations by using a URLClassLoader with no urls if the classloader is null(bootstrap classloader). So it can not find the @TraceCrossThread class unless you change the LocationStrategy of skywalking java agent builder.
   
   When I inject the RunnableWrapper in the maven artifact org.apache.skywalking:apm-toolkit-trace into the bootstrap classloader. It can not be enhanced properly because the byte buddy can not find it's  @TraceCrossThread annotation.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on a change in pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#discussion_r570946405



##########
File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/match/ProtectiveShieldMatcher.java
##########
@@ -44,7 +44,11 @@ public ProtectiveShieldMatcher(ElementMatcher<? super T> matcher) {
     @Override
     public boolean matches(T target) {
         try {
-            return this.matcher.matches(target);
+            boolean match = this.matcher.matches(target);
+            if (LOGGER.isDebugEnable()) {
+                LOGGER.debug("type={}, match={}", target, match);
+            }
+            return match;

Review comment:
       This kind of issue will exist always, but we can't add logs in every place, which causes logs unreadable too. This kind of issue could be located by agent debug easily.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774019973


   Principle, we should not add log for helping developing. The logs are for product env debug only.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774041749


   > How many contributors is agent contributors of the 400+ code contributors?
   
   Over 70% focused on or worked on agent, AFAIK. Agent side clearly has more plugins than the server side, and easier.
   
   > I think this log is important because I feel it. Actually I merely log anything in my project. I am not a crazy logger.
   
   You may not, but how the community should answer the question, when another people want to add logs and quote this PR? How could I prove this is useful than another log? :) It is hard for the community, and hard to understand to the new contributors.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng edited a comment on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng edited a comment on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774041749


   > How many contributors is agent contributors of the 400+ code contributors?
   
   Over 70% focused on or worked on agent, AFAIK. Agent side clearly has more plugins than the server side, and easier.
   
   > I think this log is important because I feel it. Actually I merely log anything in my project. I am not a crazy logger.
   
   You may not, but how the community should answer the question, when another people want to add logs and quote this PR? How could I prove this is more useful than another log? :) It is hard for the community, and hard to understand to the new contributors.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on a change in pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#discussion_r570900063



##########
File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/match/ProtectiveShieldMatcher.java
##########
@@ -44,7 +44,11 @@ public ProtectiveShieldMatcher(ElementMatcher<? super T> matcher) {
     @Override
     public boolean matches(T target) {
         try {
-            return this.matcher.matches(target);
+            boolean match = this.matcher.matches(target);
+            if (LOGGER.isDebugEnable()) {
+                LOGGER.debug("type={}, match={}", target, match);
+            }
+            return match;

Review comment:
       Why add log here? From my understanding, there will cause a lot of logs in every plugin. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] libinglong commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
libinglong commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774576469


   Should we add a troubleshoutting at the plugin develop doc?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] libinglong commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
libinglong commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774039423


   > Then a project has to face countless PR to add logs, because any line of codes could have potential risk, people could ask to log out anything. Then your system breaks.
   > All internal systems are being added logs randomly, one way, it is a bad thing, and also, you only face limited developers, so damages are controllable. But in the open source, especially like SkyWalking, we have 400+ code contributors, and more in potential. We cant afford to argue with every one, this log is acceptable, and others are not.
   > The easy, clear, and affordable principle could be only, you will need this in the runtime, or are facing the requirements.
   
   How many contributors is agent contributors of the 400+ code contributors?
   I think this log is important because I feel it. Actually I merely log anything in my project. I am not a crazy logger.
   
   > The easy, clear, and affordable principle could be only, you will need this in the runtime, or are facing the requirements.
   
   This is a acceptable reason but still good for me. :)
   Anyway, thank you for spending you energy on this pr. :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] libinglong commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
libinglong commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774025150


   > Principle, we should not add log for helping developing. The logs are for product env debug only.
   
   I still do not think the log is just for product env. It's a worth as long as it can help any people resolve their problems and save their time. :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on pull request #6330: add debug info when type not match in instrumentation process

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #6330:
URL: https://github.com/apache/skywalking/pull/6330#issuecomment-774577472


   > Should we add a troubleshoutting at the plugin develop doc?
   
   That depends, how it could be written. It is not easy to provide such kind of documentation. Usually it is a presentation of showcases, but documentation will require it more like a book.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org