115
115
import org .apache .hadoop .yarn .api .protocolrecords .UpdateApplicationPriorityResponse ;
116
116
import org .apache .hadoop .yarn .api .protocolrecords .UpdateApplicationTimeoutsRequest ;
117
117
import org .apache .hadoop .yarn .api .protocolrecords .UpdateApplicationTimeoutsResponse ;
118
+ import org .apache .hadoop .yarn .api .records .ApplicationAttemptId ;
118
119
import org .apache .hadoop .yarn .api .records .ApplicationId ;
119
120
import org .apache .hadoop .yarn .api .records .ApplicationSubmissionContext ;
120
121
import org .apache .hadoop .yarn .api .records .ReservationId ;
166
167
import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .GET_NODETOLABELS ;
167
168
import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .GET_LABELSTONODES ;
168
169
import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .GET_CLUSTERNODELABELS ;
170
+ import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .GET_APPLICATION_ATTEMPT_REPORT ;
169
171
170
172
/**
171
173
* Extends the {@code AbstractRequestInterceptorClient} class and provides an
@@ -1319,6 +1321,8 @@ public GetClusterNodeLabelsResponse getClusterNodeLabels(
1319
1321
}
1320
1322
long stopTime = clock .getTime ();
1321
1323
routerMetrics .succeededGetClusterNodeLabelsRetrieved (stopTime - startTime );
1324
+ RouterAuditLogger .logSuccess (user .getShortUserName (), GET_CLUSTERNODELABELS ,
1325
+ TARGET_CLIENT_RM_SERVICE );
1322
1326
// Merge the ClusterNodeLabelsResponse
1323
1327
return RouterYarnClientUtils .mergeClusterNodeLabelsResponse (nodeLabels );
1324
1328
}
@@ -1347,9 +1351,11 @@ public GetApplicationAttemptReportResponse getApplicationAttemptReport(
1347
1351
if (request == null || request .getApplicationAttemptId () == null
1348
1352
|| request .getApplicationAttemptId ().getApplicationId () == null ) {
1349
1353
routerMetrics .incrAppAttemptReportFailedRetrieved ();
1350
- RouterServerUtil .logAndThrowException (
1351
- "Missing getApplicationAttemptReport request or applicationId " +
1352
- "or applicationAttemptId information." , null );
1354
+ String msg = "Missing getApplicationAttemptReport request or applicationId " +
1355
+ "or applicationAttemptId information." ;
1356
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_APPLICATION_ATTEMPT_REPORT , UNKNOWN ,
1357
+ TARGET_CLIENT_RM_SERVICE , msg );
1358
+ RouterServerUtil .logAndThrowException (msg , null );
1353
1359
}
1354
1360
1355
1361
long startTime = clock .getTime ();
@@ -1359,10 +1365,12 @@ public GetApplicationAttemptReportResponse getApplicationAttemptReport(
1359
1365
subClusterId = getApplicationHomeSubCluster (applicationId );
1360
1366
} catch (YarnException e ) {
1361
1367
routerMetrics .incrAppAttemptReportFailedRetrieved ();
1362
- RouterServerUtil .logAndThrowException ("ApplicationAttempt " +
1363
- request .getApplicationAttemptId () + " belongs to Application " +
1364
- request .getApplicationAttemptId ().getApplicationId () +
1365
- " does not exist in FederationStateStore." , e );
1368
+ String msgFormat = "ApplicationAttempt %s belongs to " +
1369
+ "Application %s does not exist in FederationStateStore." ;
1370
+ ApplicationAttemptId applicationAttemptId = request .getApplicationAttemptId ();
1371
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_APPLICATION_ATTEMPT_REPORT , UNKNOWN ,
1372
+ TARGET_CLIENT_RM_SERVICE , msgFormat , applicationAttemptId , applicationId );
1373
+ RouterServerUtil .logAndThrowException (e , msgFormat , applicationAttemptId , applicationId );
1366
1374
}
1367
1375
1368
1376
ApplicationClientProtocol clientRMProxy =
@@ -1376,6 +1384,8 @@ public GetApplicationAttemptReportResponse getApplicationAttemptReport(
1376
1384
String msg = String .format (
1377
1385
"Unable to get the applicationAttempt report for %s to SubCluster %s." ,
1378
1386
request .getApplicationAttemptId (), subClusterId .getId ());
1387
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_APPLICATION_ATTEMPT_REPORT , UNKNOWN ,
1388
+ TARGET_CLIENT_RM_SERVICE , msg );
1379
1389
RouterServerUtil .logAndThrowException (msg , e );
1380
1390
}
1381
1391
@@ -1387,6 +1397,8 @@ public GetApplicationAttemptReportResponse getApplicationAttemptReport(
1387
1397
1388
1398
long stopTime = clock .getTime ();
1389
1399
routerMetrics .succeededAppAttemptReportRetrieved (stopTime - startTime );
1400
+ RouterAuditLogger .logSuccess (user .getShortUserName (), GET_APPLICATION_ATTEMPT_REPORT ,
1401
+ TARGET_CLIENT_RM_SERVICE );
1390
1402
return response ;
1391
1403
}
1392
1404
0 commit comments