Author: rkanter
Date: Wed Dec 18 00:29:11 2013
New Revision: 1551778

URL: http://svn.apache.org/r1551778
Log:
OOZIE-1616 Add sharelib and launcherlib locations to the instrumentation info 
(rkanter)

Modified:
    oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java
    oozie/trunk/release-log.txt

Modified: 
oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java?rev=1551778&r1=1551777&r2=1551778&view=diff
==============================================================================
--- 
oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java 
(original)
+++ 
oozie/trunk/core/src/main/java/org/apache/oozie/service/ShareLibService.java 
Wed Dec 18 00:29:11 2013
@@ -47,12 +47,13 @@ import org.apache.hadoop.fs.permission.F
 import org.apache.oozie.action.ActionExecutor;
 import org.apache.oozie.action.hadoop.JavaActionExecutor;
 import org.apache.oozie.client.rest.JsonUtils;
-
+import org.apache.oozie.util.Instrumentable;
+import org.apache.oozie.util.Instrumentation;
 import org.apache.oozie.util.XLog;
 
 import com.google.common.annotations.VisibleForTesting;
 
-public class ShareLibService implements Service {
+public class ShareLibService implements Service, Instrumentable {
 
     public static final String LAUNCHERJAR_LIB_RETENTION = CONF_PREFIX + 
"ShareLibService.temp.sharelib.retention.days";
 
@@ -565,4 +566,73 @@ public class ShareLibService implements 
         }
         return path;
     }
+
+    /**
+     * Instruments the log service.
+     * <p/>
+     * It sets instrumentation variables indicating the location of the 
sharelib and launcherlib
+     *
+     * @param instr instrumentation to use.
+     */
+    @Override
+    public void instrument(Instrumentation instr) {
+        instr.addVariable("libs", "sharelib.source", new 
Instrumentation.Variable<String>() {
+            @Override
+            public String getValue() {
+                if (!StringUtils.isEmpty(sharelibMappingFile)) {
+                    return SHARELIB_MAPPING_FILE;
+                }
+                return WorkflowAppService.SYSTEM_LIB_PATH;
+            }
+        });
+        instr.addVariable("libs", "sharelib.mapping.file", new 
Instrumentation.Variable<String>() {
+            @Override
+            public String getValue() {
+                if (!StringUtils.isEmpty(sharelibMappingFile)) {
+                    return sharelibMappingFile;
+                }
+                return "(none)";
+            }
+        });
+        instr.addVariable("libs", "sharelib.system.libpath", new 
Instrumentation.Variable<String>() {
+            @Override
+            public String getValue() {
+                String sharelibPath = "(unavailable)";
+                try {
+                    sharelibPath = 
getLatestLibPath(services.get(WorkflowAppService.class).getSystemLibPath(), 
SHARED_LIB_PREFIX)
+                        .toUri().toString();
+                }
+                catch (IOException ioe) {
+                    // ignore exception because we're just doing 
instrumentation
+                }
+                return sharelibPath;
+            }
+        });
+        instr.addVariable("libs", "sharelib.mapping.file.timestamp", new 
Instrumentation.Variable<String>() {
+            @Override
+            public String getValue() {
+                if (!StringUtils.isEmpty(sharelibMetaFileOldTimeStamp)) {
+                    return sharelibMetaFileOldTimeStamp;
+                }
+                return "(none)";
+            }
+        });
+        instr.addVariable("libs", "sharelib.keys", new 
Instrumentation.Variable<String>() {
+            @Override
+            public String getValue() {
+                Map<String, List<Path>> shareLib = getShareLib();
+                if (shareLib != null && !shareLib.isEmpty()) {
+                    Set<String> keySet = shareLib.keySet();
+                    return keySet.toString();
+                }
+                return "(unavailable)";
+            }
+        });
+        instr.addVariable("libs", "launcherlib.system.libpath", new 
Instrumentation.Variable<String>() {
+            @Override
+            public String getValue() {
+                return getLauncherlibPath().toUri().toString();
+            }
+        });
+    }
 }

Modified: oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1551778&r1=1551777&r2=1551778&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Wed Dec 18 00:29:11 2013
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1616 Add sharelib and launcherlib locations to the instrumentation info 
(rkanter)
 OOZIE-1647 oozie-setup.sh doesn't check exit code of java executions (alazarev 
via rkanter)
 OOZIE-1642 writeUTF 64k limit for counters (puru via rohini)
 OOZIE-1641 oozie-audit.log - add remote IP (puru via rohini)


Reply via email to