From 0110e24ed8670f0563220f969fc592dd760ec0b8 Mon Sep 17 00:00:00 2001 From: Xianming Lei <31424839+leixm@users.noreply.github.com> Date: Sat, 20 May 2023 17:27:45 +0800 Subject: [PATCH] YARN-11496. Improve TimelineService log format. (#5677). Contributed by Xianming Lei. Reviewed-by: Shilun Fan Signed-off-by: Ayush Saxena --- .../NodeTimelineCollectorManager.java | 32 ++--- .../PerNodeTimelineCollectorsAuxService.java | 4 +- .../collector/TimelineCollectorManager.java | 10 +- .../TimelineCollectorWebService.java | 6 +- .../reader/TimelineReaderServer.java | 4 +- .../reader/TimelineReaderWebServices.java | 133 ++++++++---------- ...ineReaderWhitelistAuthorizationFilter.java | 6 +- .../storage/FileSystemTimelineWriterImpl.java | 6 +- 8 files changed, 94 insertions(+), 107 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/NodeTimelineCollectorManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/NodeTimelineCollectorManager.java index 15063978dd..3f1cac3e43 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/NodeTimelineCollectorManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/NodeTimelineCollectorManager.java @@ -181,7 +181,7 @@ public long renewTokenForAppCollector( return tokenMgrService.renewToken(appCollector.getDelegationTokenForApp(), appCollector.getAppDelegationTokenRenewer()); } else { - LOG.info("Delegation token not available for renewal for app " + + LOG.info("Delegation token not available for renewal for app {}", appCollector.getTimelineEntityContext().getAppId()); return -1; } @@ -226,7 +226,7 @@ private org.apache.hadoop.yarn.api.records.Token generateTokenAndSetTimer( renewalOrRegenerationFuture, tokenId.getMaxDate(), tokenId.getRenewer().toString()); } - LOG.info("Generated a new token " + timelineToken + " for app " + appId); + LOG.info("Generated a new token {} for app {}", timelineToken, appId); return org.apache.hadoop.yarn.api.records.Token.newInstance( timelineToken.getIdentifier(), timelineToken.getKind().toString(), timelineToken.getPassword(), timelineToken.getService().toString()); @@ -249,7 +249,7 @@ protected void doPostPut(ApplicationId appId, TimelineCollector collector) { reportNewCollectorInfoToNM(appId, token); } catch (YarnException | IOException e) { // throw exception here as it cannot be used if failed communicate with NM - LOG.error("Failed to communicate with NM Collector Service for " + appId); + LOG.error("Failed to communicate with NM Collector Service for {}", appId); throw new YarnRuntimeException(e); } } @@ -260,7 +260,7 @@ protected void postRemove(ApplicationId appId, TimelineCollector collector) { try { cancelTokenForAppCollector((AppLevelTimelineCollector) collector); } catch (IOException e) { - LOG.warn("Failed to cancel token for app collector with appId " + + LOG.warn("Failed to cancel token for app collector with appId {}", appId, e); } } @@ -328,7 +328,7 @@ private void startWebApp() { //TODO: We need to think of the case of multiple interfaces this.timelineRestServerBindAddress = WebAppUtils.getResolvedAddress( timelineRestServer.getConnectorAddress(0)); - LOG.info("Instantiated the per-node collector webapp at " + + LOG.info("Instantiated the per-node collector webapp at {}", timelineRestServerBindAddress); } @@ -338,8 +338,8 @@ private void reportNewCollectorInfoToNM(ApplicationId appId, ReportNewCollectorInfoRequest request = ReportNewCollectorInfoRequest.newInstance(appId, this.timelineRestServerBindAddress, token); - LOG.info("Report a new collector for application: " + appId + - " to the NM Collector Service."); + LOG.info("Report a new collector for application: {}" + + " to the NM Collector Service.", appId); getNMCollectorService().reportNewCollectorInfo(request); } @@ -348,7 +348,7 @@ private void updateTimelineCollectorContext( throws YarnException, IOException { GetTimelineCollectorContextRequest request = GetTimelineCollectorContextRequest.newInstance(appId); - LOG.info("Get timeline collector context for " + appId); + LOG.info("Get timeline collector context for {}", appId); GetTimelineCollectorContextResponse response = getNMCollectorService().getTimelineCollectorContext(request); String userId = response.getUserId(); @@ -384,7 +384,7 @@ protected CollectorNodemanagerProtocol getNMCollectorService() { YarnConfiguration.NM_COLLECTOR_SERVICE_ADDRESS, YarnConfiguration.DEFAULT_NM_COLLECTOR_SERVICE_ADDRESS, YarnConfiguration.DEFAULT_NM_COLLECTOR_SERVICE_PORT); - LOG.info("nmCollectorServiceAddress: " + nmCollectorServiceAddress); + LOG.info("nmCollectorServiceAddress: {}", nmCollectorServiceAddress); final YarnRPC rpc = YarnRPC.create(conf); // TODO Security settings. @@ -418,8 +418,8 @@ private void renewToken(AppLevelTimelineCollector appCollector) // Set renewal or regeneration timer based on delay. long renewalDelay = 0; if (newExpirationTime > 0) { - LOG.info("Renewed token for " + appId + " with new expiration " + - "timestamp = " + newExpirationTime); + LOG.info("Renewed token for {} with new expiration " + + "timestamp = {}", appId, newExpirationTime); renewalDelay = getRenewalDelay(newExpirationTime - Time.now()); } long regenerationDelay = @@ -442,7 +442,7 @@ private void regenerateToken(AppLevelTimelineCollector appCollector) try { reportNewCollectorInfoToNM(appId, token); } catch (YarnException e) { - LOG.warn("Unable to report regenerated token to NM for " + appId); + LOG.warn("Unable to report regenerated token to NM for {}", appId); } } @@ -450,8 +450,8 @@ private void regenerateToken(AppLevelTimelineCollector appCollector) public void run() { TimelineCollector collector = get(appId); if (collector == null) { - LOG.info("Cannot find active collector while " + (timerForRenewal ? - "renewing" : "regenerating") + " token for " + appId); + LOG.info("Cannot find active collector while {} token for {}", + (timerForRenewal ? "renewing" : "regenerating"), appId); return; } AppLevelTimelineCollector appCollector = @@ -466,8 +466,8 @@ public void run() { regenerateToken(appCollector); } } catch (Exception e) { - LOG.warn("Unable to " + (timerForRenewal ? "renew" : "regenerate") + - " token for " + appId, e); + LOG.warn("Unable to {} token for {}", + (timerForRenewal ? "renew" : "regenerate"), appId, e); } } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/PerNodeTimelineCollectorsAuxService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/PerNodeTimelineCollectorsAuxService.java index d1b1f8da48..fb54442cfb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/PerNodeTimelineCollectorsAuxService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/PerNodeTimelineCollectorsAuxService.java @@ -193,8 +193,8 @@ public void run() { synchronized (appIdToContainerId) { Set masterContainers = appIdToContainerId.get(appId); if (masterContainers == null) { - LOG.info("Stop container for " + containerId - + " is called before initializing container."); + LOG.info("Stop container for {}" + + " is called before initializing container.", containerId); return; } masterContainers.remove(containerId); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorManager.java index 2a9165bd1d..70c2824167 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorManager.java @@ -75,7 +75,7 @@ private TimelineWriter createTimelineWriter(final Configuration conf) { String timelineWriterClassName = conf.get( YarnConfiguration.TIMELINE_SERVICE_WRITER_CLASS, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WRITER_CLASS); - LOG.info("Using TimelineWriter: " + timelineWriterClassName); + LOG.info("Using TimelineWriter: {}", timelineWriterClassName); try { Class timelineWriterClazz = Class.forName(timelineWriterClassName); if (TimelineWriter.class.isAssignableFrom(timelineWriterClazz)) { @@ -139,14 +139,14 @@ public TimelineCollector putIfAbsent(ApplicationId appId, collector.setWriter(writer); collector.start(); collectors.put(appId, collector); - LOG.info("the collector for " + appId + " was added"); + LOG.info("the collector for {} was added", appId); collectorInTable = collector; postPut(appId, collectorInTable); } catch (Exception e) { throw new YarnRuntimeException(e); } } else { - LOG.info("the collector for " + appId + " already exists!"); + LOG.info("the collector for {} already exists!", appId); } } return collectorInTable; @@ -182,14 +182,14 @@ protected void doPostPut(ApplicationId appId, TimelineCollector collector) { public boolean remove(ApplicationId appId) { TimelineCollector collector = collectors.remove(appId); if (collector == null) { - LOG.error("the collector for " + appId + " does not exist!"); + LOG.error("the collector for {} does not exist!", appId); } else { synchronized (collector) { postRemove(appId, collector); // stop the service to do clean up collector.stop(); } - LOG.info("The collector service for " + appId + " was removed"); + LOG.info("The collector service for {} was removed", appId); } return collector != null; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java index a25b0a2223..b93019cd9d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java @@ -175,7 +175,7 @@ public Response putEntities( NodeTimelineCollectorManager.COLLECTOR_MANAGER_ATTR_KEY); TimelineCollector collector = collectorManager.get(appID); if (collector == null) { - LOG.error("Application: "+ appId + " is not found"); + LOG.error("Application: {} is not found", appId); throw new NotFoundException("Application: "+ appId + " is not found"); } @@ -244,7 +244,7 @@ public Response putDomain( NodeTimelineCollectorManager.COLLECTOR_MANAGER_ATTR_KEY); TimelineCollector collector = collectorManager.get(appID); if (collector == null) { - LOG.error("Application: " + appId + " is not found"); + LOG.error("Application: {} is not found", appId); throw new NotFoundException("Application: " + appId + " is not found"); } @@ -270,7 +270,7 @@ private static ApplicationId parseApplicationId(String appId) { return null; } } catch (IllegalFormatException e) { - LOG.error("Invalid application ID: " + appId); + LOG.error("Invalid application ID: {}", appId); return null; } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java index 9dd717087c..b1f19f6938 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java @@ -102,7 +102,7 @@ private TimelineReader createTimelineReaderStore(final Configuration conf) { String timelineReaderClassName = conf.get( YarnConfiguration.TIMELINE_SERVICE_READER_CLASS, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_READER_CLASS); - LOG.info("Using store: " + timelineReaderClassName); + LOG.info("Using store: {}", timelineReaderClassName); try { Class timelineReaderClazz = Class.forName(timelineReaderClassName); if (TimelineReader.class.isAssignableFrom(timelineReaderClazz)) { @@ -192,7 +192,7 @@ private void startTimelineReaderWebApp() { String bindAddress = WebAppUtils .getWebAppBindURL(conf, hostProperty, webAppURLWithoutScheme); - LOG.info("Instantiating TimelineReaderWebApp at " + bindAddress); + LOG.info("Instantiating TimelineReaderWebApp at {}", bindAddress); try { String httpScheme = WebAppUtils.getHttpSchemePrefix(conf); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java index 8d3436374a..89a8c98979 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java @@ -179,8 +179,8 @@ private static void handleException(Exception e, String url, long startTime, String invalidNumMsg) throws BadRequestException, WebApplicationException { long endTime = Time.monotonicNow(); - LOG.info("Processed URL " + url + " but encountered exception (Took " + - (endTime - startTime) + " ms.)"); + LOG.info("Processed URL {} but encountered exception (Took " + + "{} ms.)", url, (endTime - startTime)); if (e instanceof NumberFormatException) { throw new BadRequestException(invalidNumMsg + " is not a numeric value."); } else if (e instanceof IllegalArgumentException) { @@ -356,8 +356,8 @@ public Set getEntities( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -389,8 +389,8 @@ public Set getEntities( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {}" + + " (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); @@ -659,8 +659,8 @@ public Set getEntities(HttpServletRequest req, QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -689,8 +689,7 @@ public Set getEntities(HttpServletRequest req, } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); @@ -759,8 +758,8 @@ public TimelineEntity getEntity( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -784,12 +783,11 @@ public TimelineEntity getEntity( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entity == null) { - LOG.info("Processed URL " + url + " but entity not found" + " (Took " + - (Time.monotonicNow() - startTime) + " ms.)"); + LOG.info("Processed URL {} but entity not found" + " (Took {} ms.)", + url, (Time.monotonicNow() - startTime)); throw new NotFoundException("Timeline entity with uid: " + uId + "is not found"); } @@ -808,8 +806,8 @@ public TimelineEntity getEntity(HttpServletRequest req, QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -832,12 +830,11 @@ public TimelineEntity getEntity(HttpServletRequest req, } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entity == null) { - LOG.info("Processed URL " + url + " but entity not found" + " (Took " + - (Time.monotonicNow() - startTime) + " ms.)"); + LOG.info("Processed URL {} but entity not found" + " (Took " + + "{} ms.)", url, (Time.monotonicNow() - startTime)); throw new NotFoundException("Timeline entity {id: " + entityId + ", type: " + entityType + " } is not found"); } @@ -1040,8 +1037,8 @@ public TimelineEntity getFlowRun( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -1065,12 +1062,11 @@ public TimelineEntity getFlowRun( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entity == null) { - LOG.info("Processed URL " + url + " but flowrun not found (Took " + - (Time.monotonicNow() - startTime) + " ms.)"); + LOG.info("Processed URL {} but flowrun not found (Took {} ms.)", + url, (Time.monotonicNow() - startTime)); throw new NotFoundException("Flowrun with uid: " + uId + "is not found"); } return entity; @@ -1158,8 +1154,8 @@ public TimelineEntity getFlowRun( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -1182,12 +1178,11 @@ public TimelineEntity getFlowRun( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entity == null) { - LOG.info("Processed URL " + url + " but flowrun not found (Took " + - (Time.monotonicNow() - startTime) + " ms.)"); + LOG.info("Processed URL {} but flowrun not found (Took {} ms.)", + url, (Time.monotonicNow() - startTime)); throw new NotFoundException("Flow run {flow name: " + TimelineReaderWebServicesUtils.parseStr(flowName) + ", run id: " + TimelineReaderWebServicesUtils.parseLongStr(flowRunId) + @@ -1254,8 +1249,8 @@ public Set getFlowRuns( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -1283,8 +1278,7 @@ public Set getFlowRuns( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); @@ -1413,8 +1407,8 @@ public Set getFlowRuns( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -1443,8 +1437,7 @@ public Set getFlowRuns( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); @@ -1556,8 +1549,8 @@ public Set getFlows( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -1581,8 +1574,7 @@ public Set getFlows( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); @@ -1654,8 +1646,8 @@ public TimelineEntity getApp( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -1680,12 +1672,11 @@ public TimelineEntity getApp( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entity == null) { - LOG.info("Processed URL " + url + " but app not found" + " (Took " + - (Time.monotonicNow() - startTime) + " ms.)"); + LOG.info("Processed URL {} but app not found" + " (Took " + + "{} ms.)", url, (Time.monotonicNow() - startTime)); throw new NotFoundException("App with uid " + uId + " not found"); } return entity; @@ -1833,8 +1824,8 @@ public TimelineEntity getApp( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -1856,12 +1847,11 @@ public TimelineEntity getApp( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entity == null) { - LOG.info("Processed URL " + url + " but app not found" + " (Took " + - (Time.monotonicNow() - startTime) + " ms.)"); + LOG.info("Processed URL {} but app not found" + " (Took " + + "{} ms.)", url, (Time.monotonicNow() - startTime)); throw new NotFoundException("App " + appId + " not found"); } return entity; @@ -1971,8 +1961,8 @@ public Set getFlowRunApps( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -2003,8 +1993,7 @@ public Set getFlowRunApps( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); @@ -3382,8 +3371,8 @@ public Set getEntityTypes( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -3401,8 +3390,7 @@ public Set getEntityTypes( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntityTypesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } return results; } @@ -3468,8 +3456,8 @@ public Set getSubAppEntities( QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " + - TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -3496,8 +3484,7 @@ public Set getSubAppEntities( } finally { long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); - LOG.info("Processed URL " + url + - " (Took " + latency + " ms.)"); + LOG.info("Processed URL {} (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); @@ -3544,8 +3531,8 @@ public Set getSubAppEntities(@Context HttpServletRequest req, : QUERY_STRING_SEP + req.getQueryString()); UserGroupInformation callerUGI = TimelineReaderWebServicesUtils.getUser(req); - LOG.info("Received URL " + url + " from user " - + TimelineReaderWebServicesUtils.getUserName(callerUGI)); + LOG.info("Received URL {} from user {}", + url, TimelineReaderWebServicesUtils.getUserName(callerUGI)); long startTime = Time.monotonicNow(); boolean succeeded = false; init(res); @@ -3569,7 +3556,7 @@ public Set getSubAppEntities(@Context HttpServletRequest req, long latency = Time.monotonicNow() - startTime; METRICS.addGetEntitiesLatency(latency, succeeded); LOG.info( - "Processed URL " + url + " (Took " + latency + " ms.)"); + "Processed URL {} (Took {} ms.)", url, latency); } if (entities == null) { entities = Collections.emptySet(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/security/TimelineReaderWhitelistAuthorizationFilter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/security/TimelineReaderWhitelistAuthorizationFilter.java index b5497781e4..f14837a4cd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/security/TimelineReaderWhitelistAuthorizationFilter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/security/TimelineReaderWhitelistAuthorizationFilter.java @@ -105,9 +105,9 @@ public void init(FilterConfig conf) throws ServletException { listAllowedUsers = YarnConfiguration.DEFAULT_TIMELINE_SERVICE_READ_ALLOWED_USERS; } - LOG.info("listAllowedUsers=" + listAllowedUsers); + LOG.info("listAllowedUsers={}", listAllowedUsers); allowedUsersAclList = new AccessControlList(listAllowedUsers); - LOG.info("allowedUsersAclList=" + allowedUsersAclList.getUsers()); + LOG.info("allowedUsersAclList={}", allowedUsersAclList.getUsers()); // also allow admins String adminAclListStr = conf.getInitParameter(YarnConfiguration.YARN_ADMIN_ACL); @@ -117,7 +117,7 @@ public void init(FilterConfig conf) throws ServletException { LOG.info("adminAclList not set, hence setting it to \"\""); } adminAclList = new AccessControlList(adminAclListStr); - LOG.info("adminAclList=" + adminAclList.getUsers()); + LOG.info("adminAclList={}", adminAclList.getUsers()); } } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java index d407636cb6..4b96f4ddd0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java @@ -142,7 +142,7 @@ private synchronized void writeInternal(String clusterId, String userId, .append("\n").toString().getBytes("UTF-8"); writeFileWithRetries(filePath, record); } catch (Exception ioe) { - LOG.warn("Interrupted operation:" + ioe.getMessage()); + LOG.warn("Interrupted operation:{}", ioe.getMessage()); TimelineWriteError error = createTimelineWriteError(entity); /* * TODO: set an appropriate error code after PoC could possibly be: @@ -274,8 +274,8 @@ T runWithRetries() throws IOException, InterruptedException { LOG.info("Maxed out FS retries. Giving up!"); throw e; } - LOG.info("Will retry operation on FS. Retry no. " + retry + - " after sleeping for " + fsRetryInterval + " seconds"); + LOG.info("Will retry operation on FS. Retry no. {}" + + " after sleeping for {} seconds", retry, fsRetryInterval); Thread.sleep(fsRetryInterval); } }