/** * Sorts list with aggregated {@link InvocationSequenceData} with the help of the summed * up exclusive times. */ @Override public int compare(AggregatedDiagnosisData o1, AggregatedDiagnosisData o2) { return Double.compare(o2.getAggregatedDiagnosisTimerData().getExclusiveDuration(), o1.getAggregatedDiagnosisTimerData().getExclusiveDuration()); } });
/** * Gets the {@link AggregatedDiagnosisData} with all the TimeWastingOperations. Just the * {@link InvocationSequenceData} with highest exclusive time are considered as * TimeWastingOperations. * * @param timeWastingOperationsCandidates * {@link AggregatedDiagnosisData} which are considered as candidates to be * TimeWastingOperations. * @return Returns the list of {@link AggregatedDiagnosisData} which are TimeWastingOperations. */ private List<AggregatedDiagnosisData> getTimeWastingOperations(List<AggregatedDiagnosisData> timeWastingOperationsCandidates) { List<AggregatedDiagnosisData> timeWastingOperations = new ArrayList<>(); double sumExecTime = 0; double globalContextDuration = globalContext.getDuration(); for (AggregatedDiagnosisData aggregatedDiagnosisData : timeWastingOperationsCandidates) { double aggregatedDataExclusiveDuration = aggregatedDiagnosisData.getAggregatedDiagnosisTimerData().getExclusiveDuration(); if ((sumExecTime < (PROPORTION * globalContextDuration)) || (aggregatedDataExclusiveDuration > baseline) || (aggregatedDiagnosisData.getAggregatedDiagnosisTimerData().getExclusiveCount() >= METHODEXECUTIONCOUNT)) { // increase sumExclusiveTime by duration of Time Wasting Operation. sumExecTime += aggregatedDataExclusiveDuration; timeWastingOperations.add(aggregatedDiagnosisData); } } return timeWastingOperations; }
/** * Gets the most significant cluster in the list. * * @param causeClusters * List of clusters to get the most significant. * @return Returns the most significant cluster in the list. */ private CauseCluster getSignificantCluster(List<CauseCluster> causeClusters) { // Checks if there is already a cluster with higher duration ratio // from overallExclusiveDuration. CauseCluster significantCluster = getHighDurationCluster(causeClusters, timeWastingOperation.getAggregatedDiagnosisTimerData().getExclusiveDuration()); // Iterates as long as there is no significantCluster. while ((null == significantCluster) && !stopClustering) { calculateDistancesToNextCluster(causeClusters); causeClusters = mergeClusters(causeClusters); significantCluster = getHighDurationCluster(causeClusters, timeWastingOperation.getAggregatedDiagnosisTimerData().getExclusiveDuration()); } // This rule does not return the Problem Context directly, but the significant cluster. // The Problem Context is the deepest node in the invocation tree that subsumes all // InvocationSequenceData the significant cluster holds and can be accessed via // cluster.getCommonContext(). return significantCluster; }
@BeforeMethod public void init() { when(problemOccurrence.getApplicationNameIdent()).thenReturn(APP_ID); when(problemOccurrence.getBusinessTransactionNameIdent()).thenReturn(BUSINESS_TX_ID); when(problemOccurrence.getProblemContext()).thenReturn(invocationIdentifier); when(problemOccurrence.getRequestRoot()).thenReturn(invocationIdentifier); when(problemOccurrence.getGlobalContext()).thenReturn(invocationIdentifier); when(problemOccurrence.getCauseType()).thenReturn(causeType); when(problemOccurrence.getSourceType()).thenReturn(sourceType); when(problemOccurrence.getRootCause()).thenReturn(rootCause); when(invocationIdentifier.getDiagnosisTimerData()).thenReturn(diagnosisTimerData); when(rootCause.getAggregatedDiagnosisTimerData()).thenReturn(aggregatedDiagnosisTimerData); when(diagnosisTimerData.getDuration()).thenReturn(DURATION); when(diagnosisTimerData.getExclusiveDuration()).thenReturn(EXCLUSIVE_DURATION); when(aggregatedDiagnosisTimerData.getExclusiveDuration()).thenReturn(EXCLUSIVE_DURATION); when(applicationData.getName()).thenReturn(APPLICATION_NAME); when(businessTransactionData.getName()).thenReturn(BUSINESS_TX); when(methodIdent.getMethodName()).thenReturn(METHOD); when(methodIdent.getFQN()).thenReturn(FQN); }
/** * Add fields to builder. * * @param data * ProblemOccurrence instance * @param builder * Builder that can be used to create influx points. */ protected void addFields(ProblemOccurrence data, Builder builder) { builder.addField(Series.ProblemOccurrenceInformation.FIELD_INVOCATION_ROOT_DURATION, data.getRequestRoot().getDiagnosisTimerData().getDuration()); builder.addField(Series.ProblemOccurrenceInformation.FIELD_GLOBAL_CONTEXT_METHOD_EXCLUSIVE_TIME, data.getGlobalContext().getDiagnosisTimerData().getExclusiveDuration()); builder.addField(Series.ProblemOccurrenceInformation.FIELD_ROOTCAUSE_METHOD_EXCLUSIVE_TIME, data.getRootCause().getAggregatedDiagnosisTimerData().getExclusiveDuration()); builder.addField(Series.ProblemOccurrenceInformation.FIELD_ROOTCAUSE_METHOD_EXCLUSIVE_COUNT, data.getRootCause().getAggregatedDiagnosisTimerData().getExclusiveCount()); }