[ 
https://issues.apache.org/jira/browse/YARN-11137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

fanshilun updated YARN-11137:
-----------------------------
    Description: 
While reading the relevant yarn-federation-router's code, I found the following 
issues with logging in FederationClientInterceptor:

1.The implemented methods are inconsistent with the use of RouterAuditLogger,as 
follows:
org.apache.hadoop.yarn.server.router.clientrmsubmit.FederationClientInterceptor#submitApplication,After
 judging that the request is null, directly throws YarnException

```
if (request == null || request.getApplicationSubmissionContext() == null
        || request.getApplicationSubmissionContext()
            .getApplicationId() == null) {
      routerMetrics.incrAppsFailedSubmitted();
      String errMsg =
          "Missing submitApplication request or applicationSubmissionContext "
              + "information.";
      RouterAuditLogger.logFailure(user.getShortUserName(),
          RouterAuditLogger.AuditConstants.SUBMIT_NEW_APP, "UNKNOWN",
          "RouterClientRMService", errMsg);
      throw new YarnException(errMsg);
    }
```
org.apache.hadoop.yarn.server.router.clientrmsubmit.FederationClientInterceptor#getApplications,After
 judging that the request is null, Use RouterServerUtil.logAndThrowException 
for handling
```
if (request == null) {
      routerMetrics.incrMultipleAppsFailedRetrieved();
      RouterServerUtil.logAndThrowException(
          "Missing getApplications request.",
          null);
    }
```

  was:
While reading the relevant yarn-federation-router's code, I found the following 
issues with logging in FederationClientInterceptor:

1.The implemented methods are inconsistent with the use of RouterAuditLogger,as 
follows:
org.apache.hadoop.yarn.server.router.clientrmsubmit.FederationClientInterceptor#submitApplication,After
 judging that the request is null, directly throws YarnException
```
if (request == null || request.getApplicationSubmissionContext() == null
        || request.getApplicationSubmissionContext()
            .getApplicationId() == null) {
      routerMetrics.incrAppsFailedSubmitted();
      String errMsg =
          "Missing submitApplication request or applicationSubmissionContext "
              + "information.";
      RouterAuditLogger.logFailure(user.getShortUserName(),
          RouterAuditLogger.AuditConstants.SUBMIT_NEW_APP, "UNKNOWN",
          "RouterClientRMService", errMsg);
      throw new YarnException(errMsg);
    }
```
org.apache.hadoop.yarn.server.router.clientrmsubmit.FederationClientInterceptor#getApplications,After
 judging that the request is null, Use RouterServerUtil.logAndThrowException 
for handling
```
if (request == null) {
      routerMetrics.incrMultipleAppsFailedRetrieved();
      RouterServerUtil.logAndThrowException(
          "Missing getApplications request.",
          null);
    }
```


> Improve log message in FederationClientInterceptor
> --------------------------------------------------
>
>                 Key: YARN-11137
>                 URL: https://issues.apache.org/jira/browse/YARN-11137
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: federation
>    Affects Versions: 3.4.0
>            Reporter: fanshilun
>            Assignee: fanshilun
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>         Attachments: YARN-11137.01.patch
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> While reading the relevant yarn-federation-router's code, I found the 
> following issues with logging in FederationClientInterceptor:
> 1.The implemented methods are inconsistent with the use of 
> RouterAuditLogger,as follows:
> org.apache.hadoop.yarn.server.router.clientrmsubmit.FederationClientInterceptor#submitApplication,After
>  judging that the request is null, directly throws YarnException
> ```
> if (request == null || request.getApplicationSubmissionContext() == null
>         || request.getApplicationSubmissionContext()
>             .getApplicationId() == null) {
>       routerMetrics.incrAppsFailedSubmitted();
>       String errMsg =
>           "Missing submitApplication request or applicationSubmissionContext "
>               + "information.";
>       RouterAuditLogger.logFailure(user.getShortUserName(),
>           RouterAuditLogger.AuditConstants.SUBMIT_NEW_APP, "UNKNOWN",
>           "RouterClientRMService", errMsg);
>       throw new YarnException(errMsg);
>     }
> ```
> org.apache.hadoop.yarn.server.router.clientrmsubmit.FederationClientInterceptor#getApplications,After
>  judging that the request is null, Use RouterServerUtil.logAndThrowException 
> for handling
> ```
> if (request == null) {
>       routerMetrics.incrMultipleAppsFailedRetrieved();
>       RouterServerUtil.logAndThrowException(
>           "Missing getApplications request.",
>           null);
>     }
> ```



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to