/** * Gets the mon key. * * @return monitor key * * @see com.jamonapi.Monitor#getMonKey() */ public MonKey getMonKey() { return monitor.getMonKey(); }
/** * Gets the mon key. * * @return monitor key * * @see com.jamonapi.Monitor#getMonKey() */ public MonKey getMonKey() { return monitor.getMonKey(); }
private void initializeForLookUps() { map = new HashMap<MonKey, Monitor>(); if (monitors!=null) { for (Monitor mon : monitors) { map.put(mon.getMonKey(), mon); } } }
/** Returns the label for the monitor */ public String getLabel() { return (String) getMonKey().getValue(MonKey.LABEL_HEADER); }
/** Returns the units for the monitor */ public String getUnits() { return (String) getMonKey().getValue(MonKey.UNITS_HEADER); }
/** Returns the label for the monitor */ public String getLabel() { return (String) getMonKey().getValue(MonKey.LABEL_HEADER); }
/** Returns the units for the monitor */ public String getUnits() { return (String) getMonKey().getValue(MonKey.UNITS_HEADER); }
/** * * @return A collection of all the unit types that are currently in this object (i.e. ms., ns., Exception,...) * @since 2.81 */ public Collection<String> getDistinctUnits() { Set<String> units = new TreeSet<String>(); int size=monitors.length; for (int i=0;i<size;i++) { units.add(monitors[i].getMonKey().getRangeKey()); } return units; }
private SQLDeArgMon appendDetails(String stackTrace) { if ("".equalsIgnoreCase(stackTrace)) return this; Monitor[] monArr=monitors.getMonitors(); StringBuilder sb=new StringBuilder(); sb.append(monArr[0].getMonKey().getDetails()).append("\n").append(stackTrace); for (int i=0;i<monArr.length;i++) { Monitor mon=monArr[i]; mon.getMonKey().setDetails(sb.toString()); } return this; }
private Monitor[] getMonitorsWithUnits(String units) { if (monitors==null || units==null) { return null; } else if ("AllMonitors".equalsIgnoreCase(units)) { return monitors; } int size=monitors.length; List rows=new ArrayList(monitors.length); for (int i=0;i<size;i++) { // if units of range match units of this monitor then if (units.equalsIgnoreCase(monitors[i].getMonKey().getRangeKey())) { rows.add(monitors[i]); } } if (rows.size()==0) { return null; } else { return (MonitorImp[]) rows.toArray(new MonitorImp[0]); } }
public JAMonDetailValue getJAMonDetailRow() { if (monData.enabled) { synchronized (monData) { return new JAMonDetailValue(getMonKey(), monData.lastValue, monData.getThisActiveCount(), monData.lastAccess); } } else return JAMonDetailValue.NULL_VALUE; }
private void changeDetails() { int len=(timeMons==null) ? 0 : timeMons.length; for (int i=0;i<len;i++) timeMons[i].getMonKey().setDetails( getDetailLabel()); }
/** Note this creates 2 exception monitors and the more specific one is returned */ @Override public Monitor addException(Monitor mon, Throwable throwable) { String stackTtrace = new StringBuffer("stackTrace=") .append(Misc.getExceptionTrace(throwable)) .toString(); if (mon!=null) { MonKey key = mon.getMonKey(); key.setDetails(stackTtrace); } MonitorFactory.add(new MonKeyImp(MonitorFactory.EXCEPTIONS_LABEL, stackTtrace, "Exception"), 1); return MonitorFactory.add(new MonKeyImp(throwable.getClass().getName(), stackTtrace, "Exception"), 1); }
public JAMonDetailRow getJAMonDetailRow() { if (monData.enabled) { synchronized (monData) { return new JAMonDetailValue(getMonKey().getDetailLabel(), monData.lastValue, monData.activityStats.thisActive.getCount(), monData.lastAccess); } } else return JAMonDetailValue.NULL_VALUE; }
/** @return Return all the MonitorComposites passed into the constructor as one List */ public List<Monitor> toList() { List<Monitor> list = new ArrayList<Monitor>(); while (hasNext()) { Monitor mon = next(); if (!currentMonitorComposite.isLocalInstance()) { // done so monitors can be identified by instance when viewed in jamonadmin.jsp // Don't want to do this for the local instance as it is not needed as it is the default and // it is the only one that is not a copy/clone of the original. mon.getMonKey().setInstanceName(currentMonitorComposite.getInstanceName()); } list.add(mon); } return list; } }
@Override public void stop(Monitor mon, Throwable throwable) { mon.stop(); put(throwable); // note the following 'get' always succeeds because of the above 'put' mon.getMonKey().setDetails(get(throwable)); }
@Override public void stop(Monitor mon, Throwable throwable) { mon.stop(); put(throwable); // note the following 'get' always succeeds because of the above 'put' mon.getMonKey().setDetails(get(throwable)); }
public FinalizedMonitor(Monitor m){ header = (String)m.getMonKey().getValue(MonKey.LABEL_HEADER); units = (String)m.getMonKey().getValue(MonKey.UNITS_HEADER); avg = m.getAvg(); hits = m.getHits(); stdDev = m.getStdDev(); lastValue = m.getLastValue(); max = m.getMax(); min = m.getMin(); total = m.getTotal(); }
/** * When this event is fired the monitor will be added to the rolling buffer. * If it is a log4j monitor the buffer will be specific to log4j fields * (i.e.LoggingEvent info such as threadname, formattedmessage, exception * stack trace and a few others. If it is not then the super class's * processEvent is called. * */ @Override public void processEvent(Monitor mon) { MonKey monKey = mon.getMonKey(); // If the key is a log4j key it has the LoggingEvent in it and we can // put that data into the buffer. If the first record is passed and it is a Log4JMonKey then use // more specific log4j detail buffer array. Note this variable is also used in the header method. if (monKey instanceof Log4jMonKey && !isLog4jMonKey) isLog4jMonKey = true; if (isLog4jMonKey) { Log4jMonKey key = (Log4jMonKey) monKey; getBufferList().addRow(toArray(key.getLoggingEvent(), mon)); } else super.processEvent(mon); }
/** * method that returns an array to use in the Buffer. It can return any * sortable objects as long as they match what is returned in the * getHeader() method. * * @param event * @param mon * @return Object[] */ protected Object[] toArray(LoggingEvent event, Monitor mon) { // populate header with standard monitor data first and after the fact by log4j data Object[] data=log4jHeader.getData(mon); data[0]=mon.getMonKey().getDetails(); data[1]=event.getLoggerName(); data[2]=event.getLevel().toString(); data[3]=event.getThreadName(); data[4]=(event.getThrowableInformation() == null || event.getThrowableInformation().getThrowable() == null) ? "" : Misc.getExceptionTrace(event.getThrowableInformation().getThrowable()); return data; }