You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/23 16:11:20 UTC

[GitHub] [pulsar] WJL3333 opened a new pull request, #18166: [improve] Split clientAppId() usage for better client request log.

WJL3333 opened a new pull request, #18166:
URL: https://github.com/apache/pulsar/pull/18166

   
   Fixes #18165
   
   
   ### Motivation
   
   Current request log use clientAppId for tracing client info.
   
   But when authentication is disabled. clientAppId always return null which makes it is difficult for problem tracing.
   
   This patch split caller for log tracing and for client role retrieve.
   
   ### Modifications
   
   the following usage are change from `clientAppId()` to `clientRole()`
   
   + `FunctionBase` 
   + `SchemasResourceBase`  
   + `TenantsBase`
   + `Functions`
   + `Worker`
   + `TopicsBase`
   + most unit test 
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   This change added tests and can be verified as follows:
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] Technoboy- commented on a diff in pull request #18166: [improve] Split clientAppId() usage for better client request log.

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #18166:
URL: https://github.com/apache/pulsar/pull/18166#discussion_r1002830237


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java:
##########
@@ -133,6 +133,11 @@ public static String splitPath(String source, int slice) {
      * @return the web service caller identification
      */
     public String clientAppId() {
+        return "clientIP=" + httpRequest.getRemoteAddr() +
+                "clientRole=" + httpRequest.getAttribute(AuthenticationFilter.AuthenticatedRoleAttributeName);
+    }
+
+    public String clientRole() {

Review Comment:
   It's better to change here, only changing the implementation of `clientAppId`. Then no need to replace the `clientRole` somewhere.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] WJL3333 commented on a diff in pull request #18166: [improve] Split clientAppId() usage for better client request log.

Posted by GitBox <gi...@apache.org>.
WJL3333 commented on code in PR #18166:
URL: https://github.com/apache/pulsar/pull/18166#discussion_r1002847170


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java:
##########
@@ -133,6 +133,11 @@ public static String splitPath(String source, int slice) {
      * @return the web service caller identification
      */
     public String clientAppId() {
+        return "clientIP=" + httpRequest.getRemoteAddr() +
+                "clientRole=" + httpRequest.getAttribute(AuthenticationFilter.AuthenticatedRoleAttributeName);
+    }
+
+    public String clientRole() {

Review Comment:
   thinks for review. i tried before. but after analysis the code, some code path use clientAppId to get authorization clientRole, direct change origin clientAppId may introduce other bug. sorry for change too much code but i think may be we can find a way to better make the change simle.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] WJL3333 closed pull request #18166: [improve] Split clientAppId() usage for better client request log.

Posted by GitBox <gi...@apache.org>.
WJL3333 closed pull request #18166: [improve] Split clientAppId() usage for better client request log.
URL: https://github.com/apache/pulsar/pull/18166


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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