[ 
https://issues.apache.org/jira/browse/PIG-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15294297#comment-15294297
 ] 

Rohini Palaniswamy commented on PIG-4714:
-----------------------------------------

{code}
+        if (Boolean.parseBoolean(pigContext.getProperties()
+                .getProperty(PigConfiguration.ENABLE_ATS))) {
+            if (!Boolean.parseBoolean(pigContext.getProperties()
+                    .getProperty("yarn.timeline-service.enabled", "false"))) {
+                log.warn("ATS is disabled since"
+                    + " yarn.timeline-service.enabled set to false");
+            }
+            PigATSClient.ATSEvent event = new PigATSClient.ATSEvent(auditId, 
callerId);
+            try {
+                PigATSClient.getInstance().logEvent(event);
+            } catch (Exception e) {
+                StringWriter exceptionString = new StringWriter();
+                e.printStackTrace(new PrintWriter(exceptionString));
+                log.warn("Error posting to ATS: " + 
exceptionString.toString());
+            }
+        }
{code}

should be 

{code}
+        if (Boolean.parseBoolean(pigContext.getProperties()
+                .getProperty(PigConfiguration.ENABLE_ATS))) {
+            if (Boolean.parseBoolean(pigContext.getProperties()
+                    .getProperty("yarn.timeline-service.enabled", "false"))) {
+               PigATSClient.ATSEvent event = new 
PigATSClient.ATSEvent(auditId, callerId);
+               try {
+                   PigATSClient.getInstance().logEvent(event);   //Rohini: Log 
event only if timeline service is enabled.
+                } catch (Exception e) {
+                   log.warn("Error posting to ATS: " , e);  //Rohini: Log 
exception directly
+                }
+             }   else {
+                log.warn("ATS is disabled since"
+                    + " yarn.timeline-service.enabled set to false");
+            }
+        }
{code}

> Improve logging across multiple components with callerId
> --------------------------------------------------------
>
>                 Key: PIG-4714
>                 URL: https://issues.apache.org/jira/browse/PIG-4714
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>            Reporter: Daniel Dai
>            Assignee: Daniel Dai
>             Fix For: 0.16.0
>
>         Attachments: PIG-4714-1.patch, PIG-4714-2.patch, PIG-4714-3.patch, 
> PIG-4714-4.patch
>
>
> The idea is to add callerId to every component, so we can track the chain of 
> application which cause the underlining operation. A typical chain is 
> Oozie->Pig->Tez->Hdfs. With proper callerId logging, we can trace Hdfs 
> operation back to Oozie workflow which triggers it.
> The protocol we decided is every component log its immediate callerId. 
> For Pig, this includes passing Pig script ID to underlining components as 
> callerId using component specific API, log callerId of Pig and store it on 
> ATS. More specific, it includes:
> 1. Generate a CallerId for each Pig script, pass it to 
> Hdfs/Yarn/MapReduce/Tez which Pig invokes
> 2. Pig caller passes "pig.log.trace.id" to Pig, Pig will publish it to ATS



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to