public void process(Monitor monitor) {

    if (CompositeMonitor.class.isAssignableFrom(monitor.getClass())
        && !monitor.hasAttribute("resultCode")) {
      if (monitor.hasAttribute("failureThrowable")) {
        Throwable t = (Throwable) monitor.get("failureThrowable");
        while (t.getCause() != null) {
          t = t.getCause();
        }
        monitor.set("resultCode", t.getClass().getName());
      } else {
        monitor.set("resultCode", "success");
      }
    }
  }
 private void assertInheritableAttributes(
     final String appName, final Map<String, Monitor> monitors) {
   if (monitors.containsKey("in")) {
     Monitor m = monitors.get("in");
     assertEquals(appName, m.getAsString("appName"));
     assertEquals(0, m.getAsInt("requestId"));
     assertEquals("test", m.getAsString("attribute"));
   }
   if (monitors.containsKey("work")) {
     Monitor m = monitors.get("work");
     assertEquals(appName, m.getAsString("appName"));
     assertEquals(0, m.getAsInt("requestId"));
     assertEquals("test", m.getAsString("attribute"));
   }
   if (monitors.containsKey("out")) {
     Monitor m = monitors.get("out");
     assertEquals(appName, m.getAsString("appName"));
     assertEquals(0, m.getAsInt("requestId"));
     assertEquals("test", m.getAsString("attribute"));
   }
 }