/** * Checks whether this data object contains exception data. * * @param data * the <code>InvocationSequenceData</code> object. * @return whether this data object contains exception data. */ public static boolean hasExceptionData(InvocationSequenceData data) { return (null != data.getExceptionSensorDataObjects()) && !data.getExceptionSensorDataObjects().isEmpty(); }
/** * Returns if the given {@link InvocationSequenceData} should be removed due to the exception * constructor delegation. * * @param rsc * {@link RegisteredSensorConfig} * @param invocationSequenceData * {@link InvocationSequenceData} to check. * @return True if the invocation should be removed. */ private boolean removeDueToExceptionDelegation(RegisteredSensorConfig rsc, InvocationSequenceData invocationSequenceData) { List<IMethodSensor> sensors = rsc.getMethodSensors(); if (1 == sensors.size()) { MethodSensorTypeConfig methodSensorTypeConfig = sensors.get(0).getSensorTypeConfig(); if (ExceptionSensor.class.getName().equals(methodSensorTypeConfig.getClassName())) { return CollectionUtils.isEmpty(invocationSequenceData.getExceptionSensorDataObjects()); } } return false; }
/** * Process all the exceptions in the invData and passes exceptions to the chained processors. * <br> * <br> * Note also that only exception data with CREATED event are processed, since the PASSED and * HANDLED should be connected as children to the CREATED one. * * @param entityManager * {@link EntityManager} needed for DB persistence. * @param invData * Invocation data to be processed. * @param topInvocationParent * Top invocation object. */ private void processExceptionSensorData(EntityManager entityManager, InvocationSequenceData invData, InvocationSequenceData topInvocationParent) { if (CollectionUtils.isNotEmpty(invData.getExceptionSensorDataObjects())) { for (ExceptionSensorData exceptionData : invData.getExceptionSensorDataObjects()) { if (exceptionData.getExceptionEvent() == ExceptionEvent.CREATED) { // only if created exception is in invocation set to the parent topInvocationParent.setNestedExceptions(Boolean.TRUE); // we need to directly call Exception message processor, cause it can not be // chained exceptionMessageCmrProcessor.process(exceptionData, entityManager); exceptionData.addInvocationParentId(topInvocationParent.getId()); passToChainedProcessors(exceptionData, entityManager); } } } }
/** * Returns if the given {@link InvocationSequenceData} should be removed due to no data. Can be * in case of * <ul> * <li>the wrapping of the prepared SQL statements. * <li>having an empty logging element (if the logging occurred with a lower logging level than * the configuration) * <li>running remote sensor that provided no span * <li>having invocation sensor without any other sensor on the method * </ul> * * @param invocationSequenceData * {@link InvocationSequenceData} to check. * * @return True if the invocation should be removed. */ private boolean removeDueToNoData(InvocationSequenceData invocationSequenceData) { return (null == invocationSequenceData.getTimerData()) && (null == invocationSequenceData.getSqlStatementData()) && (null == invocationSequenceData.getLoggingData()) && (null == invocationSequenceData.getSpanIdent()) && CollectionUtils.isEmpty(invocationSequenceData.getExceptionSensorDataObjects()); }
secondary = invocationSequenceData.getSqlStatementData(); if (CollectionUtils.isNotEmpty(invocationSequenceData.getExceptionSensorDataObjects())) { secondary = invocationSequenceData.getExceptionSensorDataObjects().get(0);
/** * Extract data from the invocation and return it to the storage writer to process it. * * @param invocation * {@link InvocationSequenceData} */ private void extractDataFromInvocation(InvocationSequenceData invocation) { if (null != invocation.getTimerData()) { passToChainedProcessors(invocation.getTimerData()); } if (null != invocation.getSqlStatementData()) { passToChainedProcessors(invocation.getSqlStatementData()); } if (null != invocation.getExceptionSensorDataObjects()) { for (ExceptionSensorData exceptionSensorData : invocation.getExceptionSensorDataObjects()) { if (exceptionSensorData.getExceptionEvent() == ExceptionEvent.CREATED) { passToChainedProcessors(exceptionSensorData); } } } for (InvocationSequenceData child : invocation.getNestedSequences()) { extractDataFromInvocation(child); } }
assertThat(child.getParentSequence(), is(invocation)); assertThat(child.getChildCount(), is(0L)); assertThat(child.getExceptionSensorDataObjects(), is(Collections.singletonList(exceptionData)));
Object selectedObject = selection.getFirstElement(); if (selectedObject instanceof InvocationSequenceData) { List<ExceptionSensorData> exceptions = ((InvocationSequenceData) selectedObject).getExceptionSensorDataObjects(); if ((null != exceptions) && !exceptions.isEmpty()) { for (ExceptionSensorData exceptionSensorData : exceptions) {
dataToNavigateTo = (ExceptionSensorData) selectedObject; } else if (selectedObject instanceof InvocationSequenceData) { List<ExceptionSensorData> exceptions = ((InvocationSequenceData) selectedObject).getExceptionSensorDataObjects(); if ((null != exceptions) && !exceptions.isEmpty()) { for (ExceptionSensorData exSensorData : exceptions) {
/** * Clones invocation sequence. This method returns new object exactly same as the original * object, but with out nested sequences set. * * @return Cloned invocation sequence. */ public InvocationSequenceData getClonedInvocationSequence() { InvocationSequenceData clone = new InvocationSequenceData(this.getTimeStamp(), this.getPlatformIdent(), this.getSensorTypeIdent(), this.getMethodIdent()); clone.setId(this.getId()); clone.setSpanIdent(this.getSpanIdent()); clone.setChildCount(this.getChildCount()); clone.setDuration(this.getDuration()); clone.setEnd(this.getEnd()); clone.setNestedSequences(Collections.<InvocationSequenceData> emptyList()); clone.setParameterContentData(this.getParameterContentData()); clone.setParentSequence(this.getParentSequence()); clone.setPosition(this.getPosition()); clone.setSqlStatementData(this.getSqlStatementData()); clone.setTimerData(this.getTimerData()); clone.setExceptionSensorDataObjects(this.getExceptionSensorDataObjects()); clone.setStart(this.getStart()); clone.setNestedSqlStatements(this.isNestedSqlStatements()); clone.setNestedExceptions(this.isNestedExceptions()); clone.setLoggingData(this.getLoggingData()); clone.setApplicationId(this.getApplicationId()); clone.setBusinessTransactionId(this.getBusinessTransactionId()); return clone; }